Daily news, dev blogs, and stories from Game Developer straight to your inbox
Generating audio for Unity-projects with Chuck and OSC
Short note about generating audio for Unity (Survival Shooter) with Chuck audio-programming language and Open Sound Control (OSC).
January 16, 2017
2 Min Read
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.
How it works
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:
Zombunny Hurt (small green mob)
Zombear Hurt (small red mob)
Hellephant Hurt (big yellow mob)
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:
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.
Read more about:Blogs
You May Also Like
Exploring the 2024 State of the Game Industry report - Game Developer Podcast ep. 39Feb 2, 2024
Phantom inspiration and the ethical auteur with Xalavier Nelson Jr.Dec 8, 2023
Designing Killer Queen: from playground experiment to modern arcade sensationOct 18, 2023
Rod Humble and King Choi illustrate the ambition of Life By YouSep 22, 2023
Get daily news, dev blogs, and stories from Game Developer straight to your inbox
Subscribe to Game Developer Newsletters to stay caught up with the latest news, design insights, marketing tips, and more