Cabbage Logo
Back to Cabbage Site

Breakup in Csound with Unity

I am trying to tie my agent’s position to pitches and get period breakup in the sound. I have about 50 agents and have set amp levels to 0.5/agents. I also stagger the frequency commands to Csound by a random pacing of the agents and throttling commands with Time.deltaTime in Unity. Even with a reduced number of agents I get sound breakup. What should I check?


p.s. further tests show no breakup at around 20 agents. could this be a cpu/dsp overload problem? the voice architecture in csound is 1 synth driven by 20 or more agents. 1 moog ladder filter, sawtooth waveform. 1 csound engine is instantiated and shared by all.

Each agent starts a new instance of the instrument? I think it could be a CPU issue. How are you creating the waveform? If you can post your instrument we can take a look. Another thing to do is try a simpler instrument, with just an oscili perhaps. It that works ok, then it’s safe to assume that your current instrument is not the most efficient.

I think I’m just using 1 instrument and triggering sounds (notes) from it. I first FindObjectOfType(typeOf(CSoundUnity) as CSoundUnity for all the agents. Then each agent sends a ScoreEvent to start a sound. In the Update() it just sends frequency update information. I will try a simpler model for the sound. Would like to use pluck, does this have much overhead? Thanks

pluck should be ok. It’s just a delay line. Try it out and see. If each agent can fire off 20 events, how many agents are there? Are we talking hundreds of notes a second, or tens of notes?

Each agent would probably trigger from 2-3/second, so with at least 50 agents I’d have about 150 notes/second max, unless I could add more agents.
would it help to have very short notes?
would controlling granular be better?

Short notes will help. With that many notes per second you probably lose the sense of ‘notes’. Things probably get quite textualised. It should be possible to recreate those sounds using other techniques?

It’s kind of Xenakis-like as a texture. Pluck seems to work fine with 50 agents, I’d kind of like a more swarm-like sound, like bees, though. I will look into other synth models. b.t.w., on my computer the DSP usage hovers around 45%, when I trigger a “fleeing” response which drives the rate of playback up it gets up to around 60%. (I have a 2.3 gHz i7) Will continue to test performance. Flocking tests next. Thanks Rory!

p.s. at max rate it amounts to about 500 events/second…

Maybe a singular instrument don’t some kind of granular synthesis might work? It would probably be much less CPU intensive.