Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
January 24, 2020
arrowPress Releases

If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Generating audio for Unity-projects with Chuck and OSC

by Petr Yakyamsev on 01/16/17 12:27:00 pm

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.


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.

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:

  • 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 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.


Related Jobs

Insomniac Games
Insomniac Games — Burbank, California, United States

UI Developer
Iridium Studios
Iridium Studios — Los Angeles, California, United States

Gameplay Engineer
Bohemia Interactive
Bohemia Interactive — Amsterdam, Netherlands

C++ Programmer
Amazon Game Studios
Amazon Game Studios — Irvine, California, United States

Sr. Game Server Engineer - New World

Loading Comments

loader image