Cabbage Logo
Back to Cabbage Site

Processing Unity audio output in Csound

Hi :slight_smile:

I am trying to pass Unity’s audio output to a Csound instrument (basically a filter) via CsoundUnity so that it can process Unity’s sound. Is that possible? Thank you!

Chen Liu.

Hi Chen Liu!
Yes you can play an AudioClip in the AudioSource that is in the same GameObject of the CsoundUnity component, and toggle “Process Clip Audio”, you can then read the AudioClip samples using the “in” or “inch” opcodes in Csound.
Have a look at the Process Clip Audio sample!

Instead if you need to pass audio between different GameObjects it requires some scripting.
The easiest way is to use a table inside Csound, and update its values using CopyTableOut.
I’ll prepare a sample showing how to do that in the next days!