parameters via chnget and OSC
Date | 2017-03-19 21:17 |
From | Richard |
Subject | parameters via chnget and OSC |
In my CabbageSplitter program I am creating 2 csd's from a Cabbage csd: the GUI part and the 'csd' part. They communicate by OSC. The target csd part can run on another machine, e.g. a Raspberry Pi. I noticed the following: If I leave the chnget's in the target csd followed by an OSCListen, it seems the variables get 0 again. Example: instr 1 kmodfreq chnget "mod" ksemi1 chnget "semi" ... k1 OSClisten gihandle, "/sliders","ffffffffffffff",kmodfreq,ksemi1, ... printk2 kmodfreq When I turn the knob, kmodfreq gets a value but then right after that becomes 0 again. Only if I leave out the chnget, declare all variables as global and initialize them, it works. Like so: gkmodfreq init 0 gksemi1 init 0 instr 1 ... k1 OSClisten gihandle, "/sliders","ffffffffffffff",gkmodfreq,gksemi1, ... printk2 gkmodfreq Is this the best way to do this? Richard 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 |
Date | 2017-03-19 21:27 |
From | Victor Lazzarini |
Subject | Re: parameters via chnget and OSC |
chnget runs at k-rate, so it will keep being updated by what’s in the channel. You could try writing the value you got from OSC to the channel, and if there is nothing else changing the value, it will keep it that way. But if cabbage keeps writing 0 to the channel, there is nothing much you can do. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 19 Mar 2017, at 21:17, Richard |
Date | 2017-03-19 21:39 |
From | Richard |
Subject | Re: parameters via chnget and OSC |
Yes, but the chnget has no function here. I left it there out of convenience. The GUI part does use the channels in this way: instr 1 kmodfreq chnget "mod" ksemi1 chnget "semi" ... OSCsend kmodfreq+ksemi1+ ...,"localhost",7777,"/sliders","ffffffffffffff",kmodfreq,ksemi1,... So it only sends when one of the triggers changes. Richard On 19/03/17 22:27, Victor Lazzarini wrote: > chnget runs at k-rate, so it will keep being updated by what’s in the channel. You could try writing the value you got from OSC > to the channel, and if there is nothing else changing the value, it will keep it that way. But if cabbage keeps writing 0 to the channel, > there is nothing much you can do. > > ======================== > Prof. Victor Lazzarini > Dean of Arts, Celtic Studies, and Philosophy, > Maynooth University, > Maynooth, Co Kildare, Ireland > Tel: 00 353 7086936 > Fax: 00 353 1 7086952 > >> On 19 Mar 2017, at 21:17, Richard |
Date | 2017-03-20 14:03 |
From | Rory Walsh |
Subject | Re: parameters via chnget and OSC |
Can you prepare a very simple example? kmodfreq should be whatever value the slider is. Looks out for widgets that use the same channel name by accident. One of them could be zeroing the "mod" channel. A minimal example should help find the source of the problem. On 19 March 2017 at 21:39, Richard <zappfinger@gmail.com> wrote: Yes, but the chnget has no function here. I left it there out of convenience. The GUI part does use the channels in this way: |
Date | 2017-03-20 20:51 |
From | Richard |
Subject | Re: parameters via chnget and OSC |
Attachments | simpleCSD.csd simpleGUI.csd |
Here is a simple example. Start the simpleGUI.csd first with Cabbage. Start the simpleCSD.csd then via the command line on the same computer. See the comments in this csd. Richard On 20/03/17 15:03, Rory Walsh wrote:
|
Date | 2017-03-20 23:05 |
From | Rory Walsh |
Subject | Re: parameters via chnget and OSC |
Attachments | simpleCSD.csd |
Looks odd to me, but it's nothing to do with Cabbage. The following illustrates the issue in a more minimal way. I've also attached a .csd. I've printed the output below. I would have assumed that the value of kmod in instrument 10 would be overwritten each time by the OSClisten opcode but it appears to happen on every second k-cycle. <CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> sr = 44100 ksmps = 1 nchnls = 2 0dbfs = 1 gihandle OSCinit 7777 instr 1 kmod oscil 100, .01 OSCsend kmod,"localhost",7777,"/sliders","f",kmod endin instr 10 kmod = 0 k1 OSClisten gihandle, "/sliders","f",kmod printk2 kmod endin </CsInstruments> <CsScore> i1 0 36000 i10 0 36000 </CsScore> </CsoundSynthesizer> i10 0.00000 i10 1.07377 i10 0.00000 i10 2.07073 i10 0.00000 i10 3.06748 i10 0.00000 i10 4.06393 i10 0.00000 i10 5.09827 i10 0.00000 i10 6.09380 i10 0.00000 i10 7.01220 etc.. On 20 March 2017 at 20:51, Richard <zappfinger@gmail.com> wrote:
|
Date | 2017-03-20 23:25 |
From | Richard |
Subject | Re: parameters via chnget and OSC |
I figured it had nothing to do with Cabbage, that's why I posted
it here... ;-) Richard On 21/03/17 00:05, Rory Walsh wrote:
|
Date | 2017-03-20 23:29 |
From | Victor Lazzarini |
Subject | Re: parameters via chnget and OSC |
Don't you need a k-rate loop
there in case two or more messages arrive in the same ksmps cycle (see man example)?
Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2017-03-21 00:01 |
From | Richard |
Subject | Re: parameters via chnget and OSC |
You are right, I tried it with the loop and it works as expected.. Richard On 21/03/17 00:29, Victor Lazzarini
wrote:
|
Date | 2017-03-21 08:33 |
From | Richard |
Subject | Re: parameters via chnget and OSC |
One mystery remains: If I use init the loop is not needed: <CsoundSynthesizer> On 21/03/17 00:29, Victor Lazzarini
wrote:
|
Date | 2017-03-21 09:51 |
From | Rory Walsh |
Subject | Re: parameters via chnget and OSC |
This makes sense, but the previous one still has me wondering. On 21 Mar 2017 08:34, "Richard" <zappfinger@gmail.com> wrote:
|
Date | 2017-03-21 10:02 |
From | Victor Lazzarini |
Subject | Re: parameters via chnget and OSC |
There is one important difference: kmod =0 ; runs at k-rate, every k-cycle kmod init 0 ; runs only once at i-time. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 21 Mar 2017, at 09:51, Rory Walsh |
Date | 2017-03-21 10:36 |
From | Rory Walsh |
Subject | Re: parameters via chnget and OSC |
Yes this is clear. But did you try the file I posted. What does OSCListen alternate between 0 and the value sent by OSCSend? On 21 March 2017 at 10:02, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: There is one important difference: |
Date | 2017-03-21 12:07 |
From | Victor Lazzarini |
Subject | Re: parameters via chnget and OSC |
Doesn’t kmod = 0 resets the variable at each kcycle? If no messages arrive, then it will stay at 0. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 21 Mar 2017, at 10:36, Rory Walsh |
Date | 2017-03-21 12:27 |
From | Rory Walsh |
Subject | Re: parameters via chnget and OSC |
But instrument one is sending a new value on every k-cycle is it now? I guess this all come down to how the OSC messages are transmitted in the first place. When sending information over a network I guess it's naive to assume that they will be fired off at such a high resolution. On 21 March 2017 at 12:07, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: Doesn’t kmod = 0 resets the variable at each kcycle? If no messages arrive, then it will stay at 0. |
Date | 2017-03-21 12:32 |
From | Victor Lazzarini |
Subject | Re: parameters via chnget and OSC |
It is sending, but it’s not arriving at every k-cycle. Sometimes more than of them arrive at some k-cycles, and none on the others. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 21 Mar 2017, at 12:27, Rory Walsh |
Date | 2017-03-21 12:39 |
From | Rory Walsh |
Subject | Re: parameters via chnget and OSC |
Thanks. I failed to keep to mind that this is all happening over a network! On 21 March 2017 at 12:32, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: It is sending, but it’s not arriving at every k-cycle. Sometimes more than of them arrive at some k-cycles, and none on the others. |