[Csnd] parameters via chnget and OSC

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] parameters via chnget and OSC

zappfinger
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

Victor Lazzarini
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 <[hidden email]> wrote:
>
> 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
> [hidden email]
> 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


Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

zappfinger
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 <[hidden email]> wrote:
>>
>> 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
>> [hidden email]
>> 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
>
> Csound mailing list
> [hidden email]
> 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

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

rorywalsh
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

zappfinger

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:
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

simpleCSD.csd (1K) Download Attachment
simpleGUI.csd (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

rorywalsh
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 <[hidden email]> wrote:

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:
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

simpleCSD.csd (540 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

zappfinger

I figured it had nothing to do with Cabbage, that's why I posted it here... ;-)
It's weird indeed!

Richard


On 21/03/17 00:05, Rory Walsh wrote:
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 <[hidden email]> wrote:

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:
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

Victor Lazzarini
In reply to this post by rorywalsh
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

On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:

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 <[hidden email]> wrote:

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:
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
<simpleCSD.csd>
Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

zappfinger

You are right, I tried it with the loop and it works as expected..

Richard


On 21/03/17 00:29, Victor Lazzarini wrote:
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

On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:

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 <[hidden email]> wrote:

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:
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
<simpleCSD.csd>
Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

zappfinger
In reply to this post by Victor Lazzarini

One mystery remains: If I use init the loop is not needed:

<CsoundSynthesizer>
<CsOptions>
-odac -Ma
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 1
nchnls = 2
0dbfs = 1

gihandle OSCinit 7777

instr    1
    kmod    init    0
    kmod    oscil 100, .01
    OSCsend kmod,"localhost",7777,"/sliders","f",kmod
endin

instr    10
    ;kmod = 0            ; loop is needed here
    kmod    init    0    ; loop is not needed here
nxtmsg:
    k1 OSClisten gihandle, "/sliders","f",kmod
    ;if (k1 == 0) goto ex
     printk2    kmod
    ;kgoto nxtmsg
ex:

endin

</CsInstruments>
<CsScore>
i1    0    36000
i10     0    36000
</CsScore>
</CsoundSynthesizer>


On 21/03/17 00:29, Victor Lazzarini wrote:
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

On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:

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 <[hidden email]> wrote:

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:
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
<simpleCSD.csd>
Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

rorywalsh
This makes sense, but the previous one still has me wondering. 

On 21 Mar 2017 08:34, "Richard" <[hidden email]> wrote:

One mystery remains: If I use init the loop is not needed:

<CsoundSynthesizer>
<CsOptions>
-odac -Ma
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 1
nchnls = 2
0dbfs = 1

gihandle OSCinit 7777

instr    1
    kmod    init    0
    kmod    oscil 100, .01
    OSCsend kmod,"localhost",7777,"/sliders","f",kmod
endin

instr    10
    ;kmod = 0            ; loop is needed here
    kmod    init    0    ; loop is not needed here
nxtmsg:
    k1 OSClisten gihandle, "/sliders","f",kmod
    ;if (k1 == 0) goto ex
     printk2    kmod
    ;kgoto nxtmsg
ex:

endin

</CsInstruments>
<CsScore>
i1    0    36000
i10     0    36000
</CsScore>
</CsoundSynthesizer>


On 21/03/17 00:29, Victor Lazzarini wrote:
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

On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:

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 <[hidden email]> wrote:

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:
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 <[hidden email]> 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:

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 <[hidden email]> wrote:

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
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
<simpleCSD.csd>
Csound mailing list [hidden email] 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

Csound mailing list [hidden email] 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
Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

Victor Lazzarini
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 <[hidden email]> wrote:
>
> This makes sense, but the previous one still has me wondering.
>
> On 21 Mar 2017 08:34, "Richard" <[hidden email]> wrote:
> One mystery remains: If I use init the loop is not needed:
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac -Ma
> </CsOptions>
> <CsInstruments>
> sr = 44100
> ksmps = 1
> nchnls = 2
> 0dbfs = 1
>
> gihandle OSCinit 7777
>
> instr    1
>     kmod    init    0
>     kmod    oscil 100, .01
>     OSCsend kmod,"localhost",7777,"/sliders","f",kmod
> endin
>
> instr    10
>     ;kmod = 0            ; loop is needed here
>     kmod    init    0    ; loop is not needed here
> nxtmsg:
>     k1 OSClisten gihandle, "/sliders","f",kmod
>     ;if (k1 == 0) goto ex
>      printk2    kmod
>     ;kgoto nxtmsg
> ex:
>
> endin
>
> </CsInstruments>
> <CsScore>
> i1    0    36000
> i10     0    36000
> </CsScore>
> </CsoundSynthesizer>
>
>
> On 21/03/17 00:29, Victor Lazzarini wrote:
>> 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
>>
>> On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:
>>
>>> 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 <[hidden email]> wrote:
>>> 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:
>>>> 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 <[hidden email]> 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:
>>>>
>>>> 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 <[hidden email]> wrote:
>>>>
>>>> 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
>>>> [hidden email]
>>>> 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
>>>>
>>>> Csound mailing list
>>>> [hidden email]
>>>> 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
>>>>
>>>> Csound mailing list
>>>> [hidden email]
>>>> 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
>>>>
>>>> Csound mailing list [hidden email] 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
>>>
>>> Csound mailing list [hidden email] 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
>>>
>>> Csound mailing list [hidden email] 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
>>> <simpleCSD.csd>
>> Csound mailing list [hidden email] 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
>
> Csound mailing list [hidden email] 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
> Csound mailing list [hidden email] 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


Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

rorywalsh
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 <[hidden email]> wrote:
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 <[hidden email]> wrote:
>
> This makes sense, but the previous one still has me wondering.
>
> On 21 Mar 2017 08:34, "Richard" <[hidden email]> wrote:
> One mystery remains: If I use init the loop is not needed:
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac -Ma
> </CsOptions>
> <CsInstruments>
> sr = 44100
> ksmps = 1
> nchnls = 2
> 0dbfs = 1
>
> gihandle OSCinit 7777
>
> instr    1
>     kmod    init    0
>     kmod    oscil 100, .01
>     OSCsend kmod,"localhost",7777,"/sliders","f",kmod
> endin
>
> instr    10
>     ;kmod = 0            ; loop is needed here
>     kmod    init    0    ; loop is not needed here
> nxtmsg:
>     k1 OSClisten gihandle, "/sliders","f",kmod
>     ;if (k1 == 0) goto ex
>      printk2    kmod
>     ;kgoto nxtmsg
> ex:
>
> endin
>
> </CsInstruments>
> <CsScore>
> i1    0    36000
> i10     0    36000
> </CsScore>
> </CsoundSynthesizer>
>
>
> On 21/03/17 00:29, Victor Lazzarini wrote:
>> 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
>>
>> On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:
>>
>>> 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 <[hidden email]> wrote:
>>> 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:
>>>> 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 <[hidden email]> 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:
>>>>
>>>> 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 <[hidden email]> wrote:
>>>>
>>>> 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
>>>> [hidden email]
>>>> 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
>>>>
>>>> Csound mailing list
>>>> [hidden email]
>>>> 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
>>>>
>>>> Csound mailing list
>>>> [hidden email]
>>>> 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
>>>>
>>>> Csound mailing list [hidden email] 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
>>>
>>> Csound mailing list [hidden email] 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
>>>
>>> Csound mailing list [hidden email] 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
>>> <simpleCSD.csd>
>> Csound mailing list [hidden email] 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
>
> Csound mailing list [hidden email] 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
> Csound mailing list [hidden email] 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


Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

Victor Lazzarini
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 <[hidden email]> wrote:
>
> 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 <[hidden email]> wrote:
> 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 <[hidden email]> wrote:
> >
> > This makes sense, but the previous one still has me wondering.
> >
> > On 21 Mar 2017 08:34, "Richard" <[hidden email]> wrote:
> > One mystery remains: If I use init the loop is not needed:
> >
> > <CsoundSynthesizer>
> > <CsOptions>
> > -odac -Ma
> > </CsOptions>
> > <CsInstruments>
> > sr = 44100
> > ksmps = 1
> > nchnls = 2
> > 0dbfs = 1
> >
> > gihandle OSCinit 7777
> >
> > instr    1
> >     kmod    init    0
> >     kmod    oscil 100, .01
> >     OSCsend kmod,"localhost",7777,"/sliders","f",kmod
> > endin
> >
> > instr    10
> >     ;kmod = 0            ; loop is needed here
> >     kmod    init    0    ; loop is not needed here
> > nxtmsg:
> >     k1 OSClisten gihandle, "/sliders","f",kmod
> >     ;if (k1 == 0) goto ex
> >      printk2    kmod
> >     ;kgoto nxtmsg
> > ex:
> >
> > endin
> >
> > </CsInstruments>
> > <CsScore>
> > i1    0    36000
> > i10     0    36000
> > </CsScore>
> > </CsoundSynthesizer>
> >
> >
> > On 21/03/17 00:29, Victor Lazzarini wrote:
> >> 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
> >>
> >> On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:
> >>
> >>> 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 <[hidden email]> wrote:
> >>> 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:
> >>>> 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 <[hidden email]> 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:
> >>>>
> >>>> 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 <[hidden email]> wrote:
> >>>>
> >>>> 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
> >>>> [hidden email]
> >>>> 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
> >>>>
> >>>> Csound mailing list
> >>>> [hidden email]
> >>>> 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
> >>>>
> >>>> Csound mailing list
> >>>> [hidden email]
> >>>> 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
> >>>>
> >>>> Csound mailing list [hidden email] 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
> >>>
> >>> Csound mailing list [hidden email] 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
> >>>
> >>> Csound mailing list [hidden email] 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
> >>> <simpleCSD.csd>
> >> Csound mailing list [hidden email] 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
> >
> > Csound mailing list [hidden email] 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
> > Csound mailing list [hidden email] 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
>
>
> Csound mailing list
> [hidden email]
> 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
>
> Csound mailing list [hidden email] 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


Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

rorywalsh
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 <[hidden email]> wrote:
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 <[hidden email]> wrote:
>
> 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 <[hidden email]> wrote:
> 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 <[hidden email]> wrote:
> >
> > This makes sense, but the previous one still has me wondering.
> >
> > On 21 Mar 2017 08:34, "Richard" <[hidden email]> wrote:
> > One mystery remains: If I use init the loop is not needed:
> >
> > <CsoundSynthesizer>
> > <CsOptions>
> > -odac -Ma
> > </CsOptions>
> > <CsInstruments>
> > sr = 44100
> > ksmps = 1
> > nchnls = 2
> > 0dbfs = 1
> >
> > gihandle OSCinit 7777
> >
> > instr    1
> >     kmod    init    0
> >     kmod    oscil 100, .01
> >     OSCsend kmod,"localhost",7777,"/sliders","f",kmod
> > endin
> >
> > instr    10
> >     ;kmod = 0            ; loop is needed here
> >     kmod    init    0    ; loop is not needed here
> > nxtmsg:
> >     k1 OSClisten gihandle, "/sliders","f",kmod
> >     ;if (k1 == 0) goto ex
> >      printk2    kmod
> >     ;kgoto nxtmsg
> > ex:
> >
> > endin
> >
> > </CsInstruments>
> > <CsScore>
> > i1    0    36000
> > i10     0    36000
> > </CsScore>
> > </CsoundSynthesizer>
> >
> >
> > On 21/03/17 00:29, Victor Lazzarini wrote:
> >> 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
> >>
> >> On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:
> >>
> >>> 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 <[hidden email]> wrote:
> >>> 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:
> >>>> 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 <[hidden email]> 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:
> >>>>
> >>>> 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 <[hidden email]> wrote:
> >>>>
> >>>> 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
> >>>> [hidden email]
> >>>> 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
> >>>>
> >>>> Csound mailing list
> >>>> [hidden email]
> >>>> 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
> >>>>
> >>>> Csound mailing list
> >>>> [hidden email]
> >>>> 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
> >>>>
> >>>> Csound mailing list [hidden email] 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
> >>>
> >>> Csound mailing list [hidden email] 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
> >>>
> >>> Csound mailing list [hidden email] 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
> >>> <simpleCSD.csd>
> >> Csound mailing list [hidden email] 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
> >
> > Csound mailing list [hidden email] 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
> > Csound mailing list [hidden email] 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
>
>
> Csound mailing list
> [hidden email]
> 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
>
> Csound mailing list [hidden email] 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


Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

Victor Lazzarini
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 <[hidden email]> wrote:
>
> 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 <[hidden email]> wrote:
> 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 <[hidden email]> wrote:
> >
> > 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 <[hidden email]> wrote:
> > 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 <[hidden email]> wrote:
> > >
> > > This makes sense, but the previous one still has me wondering.
> > >
> > > On 21 Mar 2017 08:34, "Richard" <[hidden email]> wrote:
> > > One mystery remains: If I use init the loop is not needed:
> > >
> > > <CsoundSynthesizer>
> > > <CsOptions>
> > > -odac -Ma
> > > </CsOptions>
> > > <CsInstruments>
> > > sr = 44100
> > > ksmps = 1
> > > nchnls = 2
> > > 0dbfs = 1
> > >
> > > gihandle OSCinit 7777
> > >
> > > instr    1
> > >     kmod    init    0
> > >     kmod    oscil 100, .01
> > >     OSCsend kmod,"localhost",7777,"/sliders","f",kmod
> > > endin
> > >
> > > instr    10
> > >     ;kmod = 0            ; loop is needed here
> > >     kmod    init    0    ; loop is not needed here
> > > nxtmsg:
> > >     k1 OSClisten gihandle, "/sliders","f",kmod
> > >     ;if (k1 == 0) goto ex
> > >      printk2    kmod
> > >     ;kgoto nxtmsg
> > > ex:
> > >
> > > endin
> > >
> > > </CsInstruments>
> > > <CsScore>
> > > i1    0    36000
> > > i10     0    36000
> > > </CsScore>
> > > </CsoundSynthesizer>
> > >
> > >
> > > On 21/03/17 00:29, Victor Lazzarini wrote:
> > >> 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
> > >>
> > >> On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:
> > >>
> > >>> 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 <[hidden email]> wrote:
> > >>> 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:
> > >>>> 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 <[hidden email]> 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:
> > >>>>
> > >>>> 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 <[hidden email]> wrote:
> > >>>>
> > >>>> 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
> > >>>> [hidden email]
> > >>>> 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
> > >>>>
> > >>>> Csound mailing list
> > >>>> [hidden email]
> > >>>> 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
> > >>>>
> > >>>> Csound mailing list
> > >>>> [hidden email]
> > >>>> 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
> > >>>>
> > >>>> Csound mailing list [hidden email] 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
> > >>>
> > >>> Csound mailing list [hidden email] 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
> > >>>
> > >>> Csound mailing list [hidden email] 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
> > >>> <simpleCSD.csd>
> > >> Csound mailing list [hidden email] 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
> > >
> > > Csound mailing list [hidden email] 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
> > > Csound mailing list [hidden email] 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
> >
> >
> > Csound mailing list
> > [hidden email]
> > 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
> >
> > Csound mailing list [hidden email] 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
>
>
> Csound mailing list
> [hidden email]
> 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
>
> Csound mailing list [hidden email] 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


Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] parameters via chnget and OSC

rorywalsh
Thanks. I failed to keep to mind that this is all happening over a network! 

On 21 March 2017 at 12:32, Victor Lazzarini <[hidden email]> 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.
========================
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 <[hidden email]> wrote:
>
> 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 <[hidden email]> wrote:
> 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 <[hidden email]> wrote:
> >
> > 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 <[hidden email]> wrote:
> > 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 <[hidden email]> wrote:
> > >
> > > This makes sense, but the previous one still has me wondering.
> > >
> > > On 21 Mar 2017 08:34, "Richard" <[hidden email]> wrote:
> > > One mystery remains: If I use init the loop is not needed:
> > >
> > > <CsoundSynthesizer>
> > > <CsOptions>
> > > -odac -Ma
> > > </CsOptions>
> > > <CsInstruments>
> > > sr = 44100
> > > ksmps = 1
> > > nchnls = 2
> > > 0dbfs = 1
> > >
> > > gihandle OSCinit 7777
> > >
> > > instr    1
> > >     kmod    init    0
> > >     kmod    oscil 100, .01
> > >     OSCsend kmod,"localhost",7777,"/sliders","f",kmod
> > > endin
> > >
> > > instr    10
> > >     ;kmod = 0            ; loop is needed here
> > >     kmod    init    0    ; loop is not needed here
> > > nxtmsg:
> > >     k1 OSClisten gihandle, "/sliders","f",kmod
> > >     ;if (k1 == 0) goto ex
> > >      printk2    kmod
> > >     ;kgoto nxtmsg
> > > ex:
> > >
> > > endin
> > >
> > > </CsInstruments>
> > > <CsScore>
> > > i1    0    36000
> > > i10     0    36000
> > > </CsScore>
> > > </CsoundSynthesizer>
> > >
> > >
> > > On 21/03/17 00:29, Victor Lazzarini wrote:
> > >> 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
> > >>
> > >> On 20 Mar 2017, at 23:06, Rory Walsh <[hidden email]> wrote:
> > >>
> > >>> 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 <[hidden email]> wrote:
> > >>> 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:
> > >>>> 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 <[hidden email]> 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:
> > >>>>
> > >>>> 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 <[hidden email]> wrote:
> > >>>>
> > >>>> 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
> > >>>> [hidden email]
> > >>>> 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
> > >>>>
> > >>>> Csound mailing list
> > >>>> [hidden email]
> > >>>> 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
> > >>>>
> > >>>> Csound mailing list
> > >>>> [hidden email]
> > >>>> 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
> > >>>>
> > >>>> Csound mailing list [hidden email] 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
> > >>>
> > >>> Csound mailing list [hidden email] 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
> > >>>
> > >>> Csound mailing list [hidden email] 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
> > >>> <simpleCSD.csd>
> > >> Csound mailing list [hidden email] 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
> > >
> > > Csound mailing list [hidden email] 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
> > > Csound mailing list [hidden email] 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
> >
> >
> > Csound mailing list
> > [hidden email]
> > 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
> >
> > Csound mailing list [hidden email] 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
>
>
> Csound mailing list
> [hidden email]
> 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
>
> Csound mailing list [hidden email] 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


Csound mailing list
[hidden email]
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

Csound mailing list [hidden email] 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