issue with channels..
| Date | 2017-07-05 11:07 |
| From | Rory Walsh |
| Subject | issue with channels.. |
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it... <CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 instr 100 kChan init 1 kVal init 1 if metro(1) == 1 && kChan < 3 then Schannel sprintfk "rslider%d", kChan chnset k(1), Schannel printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel) kChan+=1 endif endin </CsInstruments> <CsScore> i100 0 z </CsScore> </CsoundSynthesizer> |
| Date | 2017-07-05 11:51 |
| From | Tarmo Johannes |
| Subject | Re: issue with channels.. |
I think chnget takes string only in init time so all later k-time operations are void. This is of course quite a problem in many cases... Tarmo 05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
|
| Date | 2017-07-05 12:05 |
| From | Rory Walsh |
| Subject | Re: issue with channels.. |
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work. On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
|
| Date | 2017-07-05 12:50 |
| From | Rory Walsh |
| Subject | Re: issue with channels.. |
Hmm. I thought the following would work, but I get an invalid channel name error? instr 100 kChan init 0 iCnt init 0 SChannels[] init 4 while iCnt < 2 do SChannels[iCnt] sprintf "rslider%d", iCnt+1 iCnt+=1 od if metro(1) == 1 && kChan < 2 then printks SChannels[kChan], 0 chnset k(1), SChannels[kChan] ;printks "Value of slider channel: %f", 0, chnget:k(SChannels[kChan]) kChan+=1 endif endin On 5 July 2017 at 12:05, Rory Walsh <rorywalsh@ear.ie> wrote:
|
| Date | 2017-07-05 13:08 |
| From | Tarmo Johannes |
| Subject | Re: issue with channels.. |
String from array witk k-index is still a k-time string and chget does not get it at i-time. Very annoying. I think I needed to write another instrument to do the work on i-time but I agree it should not be that unconfortable. Tarmo 05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
|
| Date | 2017-07-05 13:45 |
| From | Rory Walsh |
| Subject | Re: issue with channels.. |
Ouch. That sounds like a nightmare. Was it always this way? I can't seem to remember having those issues before. On 5 July 2017 at 13:08, Tarmo Johannes <trmjhnns@gmail.com> wrote:
|
| Date | 2017-07-05 14:16 |
| From | Oeyvind Brandtsegg |
| Subject | Re: issue with channels.. |
Could you do: if metro(1) == 1 && kChan < 3 then if changed(kChan) then reinit chan_name endif chan_name: Schannel sprintf "rslider%d", i(kChan) chnset k(1), Schannel rireturn ? 2017-07-05 14:45 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Oeyvind Brandtsegg Professor of Music Technology NTNU 7491 Trondheim Norway Cell: +47 92 203 205 http://www.partikkelaudio.com/ http://crossadaptive.hf.ntnu.no http://gdsp.hf.ntnu.no/ http://soundcloud.com/brandtsegg http://flyndresang.no/ http://soundcloud.com/t-emp |
| Date | 2017-07-05 14:16 |
| From | Oeyvind Brandtsegg |
| Subject | Re: issue with channels.. |
(not tested here, beware of typos) 2017-07-05 15:16 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
Oeyvind Brandtsegg Professor of Music Technology NTNU 7491 Trondheim Norway Cell: +47 92 203 205 http://www.partikkelaudio.com/ http://crossadaptive.hf.ntnu.no http://gdsp.hf.ntnu.no/ http://soundcloud.com/brandtsegg http://flyndresang.no/ http://soundcloud.com/t-emp |
| Date | 2017-07-05 14:24 |
| From | Rory Walsh |
| Subject | Re: issue with channels.. |
Probably, to it seems very cumbersome. I wonder is there any way chnget can be updated to deal with k-time strings? On 5 July 2017 at 14:16, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
|
| Date | 2017-07-05 17:37 |
| From | joachim heintz |
| Subject | Re: issue with channels.. |
i think what you could do is to call an instrument which does the job at
i-time:
instr 100
kChan init 1
kVal init 1
if metro(1) == 1 && kChan < 3 then
event "i", "Reset", 0, 1, kChan, kVal
kChan+=1
endif
endin
instr Reset
Schannel sprintf "rslider%d", p4
chnset p5, Schannel
prints "Slider%dVal:%f\n", p4, chnget:i(Schannel)
turnoff
endin
would this work for you?
joachim
On 05/07/17 15:24, Rory Walsh wrote:
> Probably, to it seems very cumbersome. I wonder is there any way chnget
> can be updated to deal with k-time strings?
>
> On 5 July 2017 at 14:16, Oeyvind Brandtsegg |
| Date | 2017-07-05 18:08 |
| From | Rory Walsh |
| Subject | Re: issue with channels.. |
I think both of these solutions would work. I think it would be nice though if we could do it straight out of the box. On 5 July 2017 at 17:37, joachim heintz <jh@joachimheintz.de> wrote: i think what you could do is to call an instrument which does the job at i-time: |