[Cs-dev] Getting i-rate value from k-rate value doesn't work
Date | 2013-06-17 11:16 |
From | lppier |
Subject | [Cs-dev] Getting i-rate value from k-rate value doesn't work |
Hi, Using csound ios I'm trying to get parameters from the app. The below works fine, with the exception of kdeltimeL. delayr only accepts an irate variable, and ideltimeL = i(kdeltimeL) doesn't seem to work. I've verified the variable naming. replacing i(kdeltimeL) with a hard coded value 0.5 works. Any ideas how I can resolve this? instr 101 kdelayOn chnget "delayOn" kfdbkL chnget "feedbackL" kdeltimeL chnget "delaytimeL" kamp chnget "delaydepth" ain = gaDelayBus gaDelayBus = 0 ;iamp = p4 ideltimeL = i(kdeltimeL) if (kdelayOn==1) then ;simple delay aout delayr ideltimeL delayw ain + (aout * kfdbkL) aout = aout * kamp outs aout, aout endif endin |
Date | 2013-06-17 11:27 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
It won't work because k-rate variables are undefined at i-time. You can try this ideltime chnget "delaytimeL" which will run the i-time chnget opcode to get the channel value at i-time. Victor On 17 Jun 2013, at 11:16, lppier wrote: > Hi, > > Using csound ios I'm trying to get parameters from the app. > The below works fine, with the exception of kdeltimeL. > > delayr only accepts an irate variable, and > ideltimeL = i(kdeltimeL) doesn't seem to work. I've verified the variable > naming. > replacing i(kdeltimeL) with a hard coded value 0.5 works. > Any ideas how I can resolve this? > > instr 101 > > kdelayOn chnget "delayOn" > kfdbkL chnget "feedbackL" > kdeltimeL chnget "delaytimeL" > kamp chnget "delaydepth" > > ain = gaDelayBus > gaDelayBus = 0 > ;iamp = p4 > > ideltimeL = i(kdeltimeL) > > if (kdelayOn==1) then > ;simple delay > > aout delayr ideltimeL > delayw ain + (aout * kfdbkL) > aout = aout * kamp > outs aout, aout > > endif > > > endin > > > |
Date | 2013-06-17 11:59 |
From | lppier |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
Attachments | None None |
Hi Victor, Thanks. I've tried that. The issue is that the delay instrument is being run all the time. ie. i101 0 360000 in the score. So putting ideltime chnget "delaytimeL" in the instrument 101 code will only allow me to get the value once on the start of 101, right? On 17 Jun, 2013, at 6:28 PM, "Victor Lazzarini [via Csound]" <[hidden email]> wrote: It won't work because k-rate variables are undefined at i-time. You can try this View this message in context: Re: Getting i-rate value from k-rate value doesn't work Sent from the Csound - Dev mailing list archive at Nabble.com. |
Date | 2013-06-17 12:03 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
Attachments | None None |
The delay line has a fixed length, that can't be changed at perf-time. You can use a deltapi etc opcode to tap the delayline.Maybe you should study some texts Csound programming, which will cover these things. Take a look Victor On 17 Jun 2013, at 11:59, lppier wrote: Hi Victor, Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2013-06-17 12:28 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
You can also use a reinit. Here's an example: http://www.thecabbagefoundation.org/viewtopic.php?f=17&t=323 On 17 June 2013 12:03, Victor Lazzarini |
Date | 2013-06-18 03:36 |
From | lppier |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
Attachments | None None |
Hi Rory, Thanks for the link, I tried that, but no luck there. Here's my code where I tried it. Maybe it's due to the fact that my instrument is triggered from the score like this? i101 0 360000 instr 101 kdelayOn chnget "delayOn" kfdbkL chnget "feedbackL" kdeltimeL chnget "delaytimeL" kamp chnget "delaydepth" kLoopUpdated changed kdeltimeL if(kLoopUpdated==1) then ;update iLoop each time we change the ;loop time reinit beginReInit; endif ain = gaDelayBus gaDelayBus = 0 ;iamp = p4 ;specify where re-init will start from beginReInit: ideltimeL = i(kdeltimeL) if (kdelayOn==1) then ;simple delay aout delayr 0.2 delayw ain + (aout * kfdbkL) aout = aout * kamp outs aout, aout endif endin On 17 Jun, 2013, at 7:28 PM, rory walsh [via Csound] <[hidden email]> wrote: You can also use a reinit. Here's an example: View this message in context: Re: Getting i-rate value from k-rate value doesn't work Sent from the Csound - Dev mailing list archive at Nabble.com. |
Date | 2013-06-18 03:37 |
From | lppier |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
Attachments | None None |
Hi Victor, deltapi definitely does work, I've tried it prior to sending the mail. I think I can get it to emulate what I was trying to do with delayw/delayr Thanks for the link! Pier. On 17 Jun, 2013, at 7:03 PM, Victor Lazzarini [via Csound] <[hidden email]> wrote:
View this message in context: Re: Getting i-rate value from k-rate value doesn't work Sent from the Csound - Dev mailing list archive at Nabble.com. |
Date | 2013-06-18 11:27 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
Attachments | test.csd None None |
It seems you're not passing the ideltimeL to your delay line? Therefore you won't get any change in delay times. Sounds like Victors idea works fine for you. I've attached a working version of the code below in case you want to check it out. > instr 101 > > kdelayOn chnget "delayOn" > kfdbkL chnget "feedbackL" > kdeltimeL chnget "delaytimeL" > kamp chnget "delaydepth" > > kLoopUpdated changed kdeltimeL > if(kLoopUpdated==1) then > ;update iLoop each time we change the > ;loop time > reinit beginReInit; > endif > > ain = gaDelayBus > gaDelayBus = 0 > ;iamp = p4 > > > > ;specify where re-init will start from > beginReInit: > ideltimeL = i(kdeltimeL) > > if (kdelayOn==1) then > ;simple delay > > aout delayr 0.2 > delayw ain + (aout * kfdbkL) > aout = aout * kamp > outs aout, aout > > endif > > endin > > |
Date | 2013-06-18 13:26 |
From | Pier |
Subject | Re: [Cs-dev] Getting i-rate value from k-rate value doesn't work |
Hi Rory, Sorry I cut and pasted the wrong code for which I put a test value for ideltimeL - I can still hear the click sounds when I use the port opcode. However, your code works for me - the offending line was this : aout delayr ideltimeL +0.01 In my version, I did not put +0.01 , I think this is not accepted by delayr as there is a possibility that the input is 0. Thank you very much Rory and Victor for your help, much appreciated. On 18 Jun, 2013, at 6:27 PM, Rory Walsh |