[Csnd] Additive synthesis using many independent oscillators
Date | 2021-09-19 05:52 |
From | Iain Duncan |
Subject | [Csnd] Additive synthesis using many independent oscillators |
Hello folks, I'm hoping someone can share with me what the best way to run additive synthesis in csound is if I want total control over each partial. I realize this is super expensive, but it's for a computation analysis class and is more a proof of concept than perhaps practical. I wish to control each oscillator's params (phase, amp, cps, env) from Scheme, so the logistic side of dealing with the numbers is not really a problem as I can get the numbers into csound from Scheme in whatever format make sense.
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
The first thing I tried was just making a simple one osc, one env instrument and triggering many instances of it. I'm able to trigger 128 instances of a poscil sine wave using 128 sequential messages to the csound~ object in Max, but it starts crapping out at 256, even though cpu usage seems to still have lots of headroom. So I'm curious if anyone knows if this is a csound~/Max specific issue, or does csound create a particularly large spike from 128 simultaneously note onsets, or some other thing I don't know. I have some ideas for other things to try, but figured I'd ask in case a) I'm just doing this wrong and it's stupid, or b) there are ways around it (like having csound receive one really long message and internally dispatching to 128 oscillators or something. thanks! iain |
Date | 2021-09-19 07:56 |
From | Eduardo Moguillansky |
Subject | Re: [Csnd] Additive synthesis using many independent oscillators |
Without looking at code it is difficult to say why sound "starts crapping out". With my laptop and built-in soundcard, which aren't anything to be proud of I can get ~2000 single instances of oscili (being driven by "poly", otherwise using one instance per oscil reduces that number to ~1200), or ~10000 using beadsynt. The cpu usage is stable and can be pushed to around 90% without xruns. This is without using -j, just a single core. regards, Eduardo On 19.09.21 06:52, Iain Duncan wrote:
|
Date | 2021-09-19 15:35 |
From | Iain Duncan |
Subject | Re: [Csnd] Additive synthesis using many independent oscillators |
thanks Eduardo, that's helpful to know. I expect I'm hitting something to do with the number of messages going into the csound~ object at once in Max as your numbers seem much more inline with that I was expecting. I will experiment with the same stuff on command line. I have been away from Csound for a long time so am coming up to speed on new practices. If you have example code anywhere of how you do it, it would be great to see it. iain On Sat, Sep 18, 2021 at 11:56 PM Eduardo Moguillansky <eduardo.moguillansky@gmail.com> wrote:
|
Date | 2021-09-19 16:36 |
From | Iain Duncan |
Subject | Re: [Csnd] Additive synthesis using many independent oscillators |
Also, the orc code I am using is below. If this is not a good way, I'm all ears! giSine ftgen 0, 0, 8192, 10, 1 instr 1 aosc oscil p4, p5, giSine aenv adsr 0.05, 0.2, 0.5, 0.4 asig = aosc * aenv * .1 outs asig, asig endin iain On Sun, Sep 19, 2021 at 7:35 AM Iain Duncan <iainduncanlists@gmail.com> wrote:
|
Date | 2021-09-19 16:41 |
From | Iain Duncan |
Subject | Re: [Csnd] Additive synthesis using many independent oscillators |
oops, I was actually using poscil, that was copied from the wrong buffer On Sun, Sep 19, 2021 at 8:36 AM Iain Duncan <iainduncanlists@gmail.com> wrote:
|
Date | 2021-09-19 17:05 |
From | Eduardo Moguillansky |
Subject | Re: [Csnd] Additive synthesis using many independent oscillators |
I would not use poscil for this (or in general), it is quite
inefficient. For linearly interpolated table lookup use oscili, it
is as efficient as it can be (although not particularly simd
friendly). If using lots of oscillators, oscil is also just fine
and you don't need the linear interpolation. On 19.09.21 17:41, Iain Duncan wrote:
|
Date | 2021-09-19 22:55 |
From | Iain Duncan |
Subject | Re: [Csnd] Additive synthesis using many independent oscillators |
Thanks Eduardo, that helped. I have switched things around so that I now send a message from Scheme for Max to csound~ with the data for many oscillators at once, and between that and switching to oscil and a krate env for each oscil I'm getting 1024 oscillators ok at once. Should be enough to go on for now. iain On Sun, Sep 19, 2021 at 9:05 AM Eduardo Moguillansky <eduardo.moguillansky@gmail.com> wrote:
|