[Csnd] collecting output from several instances
Date | 2014-09-24 15:25 |
From | Pablo Fernandez |
Subject | [Csnd] collecting output from several instances |
Hi all, encouraged by the many useful replies to my previous post I now dare ask another silly question. I have this program that sustains recorded samples using those fantastic pvs opcodes. It works like this: Each time a new sample comes in, an instrument is triggered that subsequently runs pvsanal, pvsbuffer, pvsbufread, pvsynth and finally outputs the "sustained" audio via outs. Since new samples come in before previous ones die out, the sustained notes overlap. That is, I have several instances of the pvs-instrument running. This works fine, but: I would like to access the sum of all sustained sounds before sending it to the csound output (in order to compress it, etc.). How should I do that? thanks in advance! pablo |
Date | 2014-09-24 15:43 |
From | Steven Yi |
Subject | Re: [Csnd] collecting output from several instances |
Hi Pablo, There's a few ways to do this. One way would be to have your instruments that use pvsynth write the audio output to channel, such as: chnset "masterOut_L", aLeft chnset "masterOut_R", aRight and in another instrument that is always-on, use: aLeft chnget "masterOut_L" aRight chnget "masterOut_R" process(aLeft,aRight) outc aLeft, aRight I wrote an article in the Csound Journal a while ago that talks about mixer setups [1]. There are certainly other ways to do this, but the above should do the job. steven [1] - http://www.csounds.com/journal/issue13/emulatingMidiBasedStudios.html On Wed, Sep 24, 2014 at 10:25 AM, Pablo Fernandez |
Date | 2014-09-24 15:50 |
From | Dave Seidel |
Subject | Re: [Csnd] collecting output from several instances |
Steven, Do the chn* opcodes also handle fsigs? Or is there a better solution for passing fsigs around? I would prefer to call pvsanal in one place, and then allow other instrument instances to process the data. - Dave On Wed, Sep 24, 2014 at 10:43 AM, Steven Yi <stevenyi@gmail.com> wrote: Hi Pablo, |
Date | 2014-09-24 15:54 |
From | Dave Seidel |
Subject | Re: [Csnd] collecting output from several instances |
Oh well, I guess not: error: Unable to find opcode entry for 'chnset' with matching argument types: Found: (null) chnset fS On Wed, Sep 24, 2014 at 10:50 AM, Dave Seidel <dave.seidel@gmail.com> wrote:
|
Date | 2014-09-24 16:25 |
From | Rory Walsh |
Subject | Re: [Csnd] collecting output from several instances |
Perhaps you can write the fsig data to function tables? On 24 September 2014 16:54, Dave Seidel |
Date | 2014-09-24 16:36 |
From | Steven Yi |
Subject | Re: [Csnd] collecting output from several instances |
No, there doesn't seem to be one for chnset. As Victor mentioned, you can use global fsigs as a bus for sending signals around. This seems to compile with the version of csound I have here: gfSigBus[] init 4 instr 1 fsig0 = gfSigBus[0] endin so f-sig arrays may be useful for creating a bus. On Wed, Sep 24, 2014 at 10:54 AM, Dave Seidel |
Date | 2014-09-24 16:49 |
From | Dave Seidel |
Subject | Re: [Csnd] collecting output from several instances |
Nice! Thanks, Steven, I will give that a try. This is for realtime code, which is what's motivating me to minimize redundant processing. - Dave On Wed, Sep 24, 2014 at 11:36 AM, Steven Yi <stevenyi@gmail.com> wrote: No, there doesn't seem to be one for chnset. As Victor mentioned, you |
Date | 2014-09-24 20:55 |
From | Pablo Fernandez |
Subject | Re: [Csnd] collecting output from several instances |
Hi Steven, thank you very much for your fast reply. I'm afraid I still cannot achieve my goal...Could you please tell me what I am missing? Here is an example code. With chnset/get, I only hear sound from a single instance. Now if I uncomment the last line in instr 2, then I can hear several instances simultaneously, which is what I want - but I would like to lay my hands on the audio before it goes out! thanks! instr 1
seed 0 ktrig random 0, 2 schedkwhen ktrig, 0.2, 4, 2, 0, 1 amix chnget "mix" outc amix, amix
endin
instr 2
iamp = .2 icps random 440, 660 asig oscil iamp, icps, 1 chnset asig, "mix"
;outc asig,asig
endin
</CsInstruments> <CsScore>
i 1 0 10 </CsScore> On 24/09/14 16:43, Steven Yi wrote:
Hi Pablo, There's a few ways to do this. One way would be to have your instruments that use pvsynth write the audio output to channel, such as: chnset "masterOut_L", aLeft chnset "masterOut_R", aRight and in another instrument that is always-on, use: aLeft chnget "masterOut_L" aRight chnget "masterOut_R" process(aLeft,aRight) outc aLeft, aRight I wrote an article in the Csound Journal a while ago that talks about mixer setups [1]. There are certainly other ways to do this, but the above should do the job. steven [1] - http://www.csounds.com/journal/issue13/emulatingMidiBasedStudios.html On Wed, Sep 24, 2014 at 10:25 AM, Pablo Fernandez <blopaaf@gmail.com> wrote:Hi all, encouraged by the many useful replies to my previous post I now dare ask another silly question. I have this program that sustains recorded samples using those fantastic pvs opcodes. It works like this: Each time a new sample comes in, an instrument is triggered that subsequently runs pvsanal, pvsbuffer, pvsbufread, pvsynth and finally outputs the "sustained" audio via outs. Since new samples come in before previous ones die out, the sustained notes overlap. That is, I have several instances of the pvs-instrument running. This works fine, but: I would like to access the sum of all sustained sounds before sending it to the csound output (in order to compress it, etc.). How should I do that? thanks in advance! pablo Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2014-09-24 21:53 |
From | Steven Yi |
Subject | Re: [Csnd] collecting output from several instances |
Hi Pablo, That's my mistake. For mixing into a channel, you should use chnmix [1]. It will add the signal into what is already in the channel. However, that also means you will need to clear the channel after you grab the summed values, or the next time around, you'll keep adding more and more into the channel. I'd do two things: 1. Move your mixing instrument to have the highest instrument number. Csound processes instruments in order by number, so you'd want to put everything into the bus, read it out and output the signal, then clear it. Technically, you'll get the same result if you keep it with a lower number except the audio signal will be processed one ksmps buffer later. 2. Use something like this: instr 2 iamp = .2 icps random 440, 660 asig oscil iamp, icps, 1 chnmix asig, "mix" ;outc asig,asig endin instr 10 seed 0 ktrig random 0, 2 schedkwhen ktrig, 0.2, 4, 2, 0, 1 amix chnget "mix" chnclear "mix" outc amix, amix endin I haven't tested the above but I think it should work. Let us know if you run into further hurdles. Cheers! steven [1] - http://csound.github.io/docs/manual/chnmix.html On Wed, Sep 24, 2014 at 3:55 PM, Pablo Fernandez |
Date | 2014-09-25 21:16 |
From | Pablo Fernandez |
Subject | Re: [Csnd] collecting output from several instances |
Thanks Steven! your code works perfectly. pablo On 24/09/14 22:53, Steven Yi wrote: > Hi Pablo, > > That's my mistake. For mixing into a channel, you should use chnmix > [1]. It will add the signal into what is already in the channel. > However, that also means you will need to clear the channel after you > grab the summed values, or the next time around, you'll keep adding > more and more into the channel. > > I'd do two things: > > 1. Move your mixing instrument to have the highest instrument number. > Csound processes instruments in order by number, so you'd want to put > everything into the bus, read it out and output the signal, then clear > it. Technically, you'll get the same result if you keep it with a > lower number except the audio signal will be processed one ksmps > buffer later. > > 2. Use something like this: > > instr 2 > > iamp = .2 > icps random 440, 660 > asig oscil iamp, icps, 1 > chnmix asig, "mix" > ;outc asig,asig > > endin > > > instr 10 > > seed 0 > ktrig random 0, 2 > schedkwhen ktrig, 0.2, 4, 2, 0, 1 > amix chnget "mix" > chnclear "mix" > > outc amix, amix > > endin > > I haven't tested the above but I think it should work. Let us know if > you run into further hurdles. > > Cheers! > steven > > [1] - http://csound.github.io/docs/manual/chnmix.html > > On Wed, Sep 24, 2014 at 3:55 PM, Pablo Fernandez |