Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
Short note about generating audio for Unity (Survival Shooter) with Chuck audio-programming language and Open Sound Control (OSC).
Short note about generating audio for Unity (Survival Shooter) with Chuck audio-programming language and Open Sound Control (OSC). After all we will get this result:
All sound generates on the fly in Chuck. Wav-files is not used at all. For voice generation I use Perry Cook’s solution which is explained in his Physics-Based Sound Synthesis for Games and Interactive Systems course. For shooting I use simple sawtooth oscillator with falling pitch and a little bit of chorus.
For sending OSC-messages I use solutions from Mike Heavers. They must be imported in the Unity project: Osc.cs plugin, UDPPacketIO.cs plugin, OSCTestSender.cs script. Connect this plugins and modified script to every game object which produce sound. OSCTestSender.cs needs to be modified for every game object to specify unique OSC-address.
We have 9 sound events in game:
Player Shoot
Player Hurt
Player Death
Zombunny Hurt (small green mob)
Zombunny Death
Zombear Hurt (small red mob)
Zombear Death
Hellephant Hurt (big yellow mob)
Hellephant Death
To receive OSC-messages in Chuck you must use OscIn class. Write down the port (oin.port) and address (oin.addAddress). Programm the sound effect that needs to be triggered by this message.
On the Chuck side there are 5 projects:
oscin_shoot
oscin_player_hurt
oscin_zombunny_hurt
oscin_zombear_hurt
oscin_hellephant_hurt
For testing, you must run all Chuck scripts first. This can be done via init.ck solution which launches all 5 projects at the same time. Then start Unity project. Play the game, OSC-messages will be generated and sent to Chuck. Then Chuck will generate appropriate sound effects.
The whole process can be demonstrated on the scheme:
The only issue I don't know how to beat is the spawn of multiple targets of the same type (for example 3 bunnies and 4 bears). The OSC-port is stick to the first enemy of particular type (first bunny and first bear) and will switch to new enemy only after mob will be killed.
Hope you enjoy the result, and if you have some links regarding OSC or sound generation - please share them in comments.
Thanks!
Petr
Read more about:
BlogsYou May Also Like