Csound Csound-dev Csound-tekno Search About

[Csnd] Is it possible to set initial value to channel?

Date2023-02-07 10:44
FromAnton Kholomiov
Subject[Csnd] Is it possible to set initial value to channel?
Hi, there)

Is it possible to init a named channel with an initial value?

I've tried to use chnset with i-rate value,
but when later I try to write a-rate signal to it, the compiler
complains that thisname is already used at a different rate.

Is there some workaround? 
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2023-02-07 11:06
Fromjoachim heintz
SubjectRe: [Csnd] Is it possible to set initial value to channel?
hi anton -

this is a workaround:

chn_a("bla",3)

instr Init
   chnset(a(1),"bla")
   turnoff
endin
schedule("Init",0,1)

instr Test
   aBla = chnget:a("bla")
   printk2(k(aBla))
endin
schedule("Test",0,1)

perhaps on the long run init could be extended to do this job.

best -
	joachim



On 07/02/2023 11:44, Anton Kholomiov wrote:
> Hi, there)
> 
> Is it possible to init a named channel with an initial value?
> 
> I've tried to use chnset with i-rate value,
> but when later I try to write a-rate signal to it, the compiler
> complains that thisname is already used at a different rate.
> 
> Is there some workaround?
> Csound mailing list Csound@listserv.heanet.ie 
>  
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND 
>  Send bugs reports to 
> https://github.com/csound/csound/issues 
>  Discussions of bugs and 
> features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2023-02-07 16:57
FromAnton Kholomiov
SubjectRe: [Csnd] Is it possible to set initial value to channel?
Hi Joachim
Thank you for this trick. I will try it out.

вт, 7 февр. 2023 г. в 14:07, joachim heintz <jh@joachimheintz.de>:
hi anton -

this is a workaround:

chn_a("bla",3)

instr Init
   chnset(a(1),"bla")
   turnoff
endin
schedule("Init",0,1)

instr Test
   aBla = chnget:a("bla")
   printk2(k(aBla))
endin
schedule("Test",0,1)

perhaps on the long run init could be extended to do this job.

best -
        joachim



On 07/02/2023 11:44, Anton Kholomiov wrote:
> Hi, there)
>
> Is it possible to init a named channel with an initial value?
>
> I've tried to use chnset with i-rate value,
> but when later I try to write a-rate signal to it, the compiler
> complains that thisname is already used at a different rate.
>
> Is there some workaround?
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> https://github.com/csound/csound/issues
> <https://github.com/csound/csound/issues> Discussions of bugs and
> features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2023-02-11 07:40
FromAnton Kholomiov
SubjectRe: [Csnd] Is it possible to set initial value to channel?
Actually I can not use this trick because I don't know in advance the name of the channel.
I use them to pass signals between instruments and to keep the channels unique between several instances 
of the same instrument. I use an ever increasing counter to generate fresh names for channels. 

So the names for channels are not fixed.


вт, 7 февр. 2023 г. в 19:57, Anton Kholomiov <anton.kholomiov@gmail.com>:
Hi Joachim
Thank you for this trick. I will try it out.

вт, 7 февр. 2023 г. в 14:07, joachim heintz <jh@joachimheintz.de>:
hi anton -

this is a workaround:

chn_a("bla",3)

instr Init
   chnset(a(1),"bla")
   turnoff
endin
schedule("Init",0,1)

instr Test
   aBla = chnget:a("bla")
   printk2(k(aBla))
endin
schedule("Test",0,1)

perhaps on the long run init could be extended to do this job.

best -
        joachim



On 07/02/2023 11:44, Anton Kholomiov wrote:
> Hi, there)
>
> Is it possible to init a named channel with an initial value?
>
> I've tried to use chnset with i-rate value,
> but when later I try to write a-rate signal to it, the compiler
> complains that thisname is already used at a different rate.
>
> Is there some workaround?
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> https://github.com/csound/csound/issues
> <https://github.com/csound/csound/issues> Discussions of bugs and
> features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2023-02-11 10:36
Fromjoachim heintz
SubjectRe: [Csnd] Is it possible to set initial value to channel?
but how do you want to set an initial value to a channel whichs name you 
don't know?
if you create the names dynamically, it should be possible to do it in a 
similar way, with sprintf.


On 11/02/2023 08:40, Anton Kholomiov wrote:
> Actually I can not use this trick because I don't know in advance the 
> name of the channel.
> I use them to pass signals between instruments and to keep the channels 
> unique between several instances
> of the same instrument. I use an ever increasing counter to generate 
> fresh names for channels.
> 
> So the names for channels are not fixed.
> 
> 
> вт, 7 февр. 2023 г. в 19:57, Anton Kholomiov  >:
> 
>     Hi Joachim
>     Thank you for this trick. I will try it out.
> 
>     вт, 7 февр. 2023 г. в 14:07, joachim heintz      >:
> 
>         hi anton -
> 
>         this is a workaround:
> 
>         chn_a("bla",3)
> 
>         instr Init
>             chnset(a(1),"bla")
>             turnoff
>         endin
>         schedule("Init",0,1)
> 
>         instr Test
>             aBla = chnget:a("bla")
>             printk2(k(aBla))
>         endin
>         schedule("Test",0,1)
> 
>         perhaps on the long run init could be extended to do this job.
> 
>         best -
>                  joachim
> 
> 
> 
>         On 07/02/2023 11:44, Anton Kholomiov wrote:
>          > Hi, there)
>          >
>          > Is it possible to init a named channel with an initial value?
>          >
>          > I've tried to use chnset with i-rate value,
>          > but when later I try to write a-rate signal to it, the compiler
>          > complains that thisname is already used at a different rate.
>          >
>          > Is there some workaround?
>          > Csound mailing list Csound@listserv.heanet.ie
>         
>          >          >
>          > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>         
>          >          > Send bugs
>         reports to
>          > https://github.com/csound/csound/issues
>         
>          >          > Discussions of bugs and
>          > features can be posted here
> 
>         Csound mailing list
>         Csound@listserv.heanet.ie 
>         https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>         
>         Send bugs reports to
>         https://github.com/csound/csound/issues
>         
>         Discussions of bugs and features can be posted here
> 
> Csound mailing list Csound@listserv.heanet.ie 
>  
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND 
>  Send bugs reports to 
> https://github.com/csound/csound/issues 
>  Discussions of bugs and 
> features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2023-02-11 11:08
Fromthorin kerr
SubjectRe: [Csnd] Is it possible to set initial value to channel?
Steven Yi's 'xchan' UDO might be of use. You may have to make an arate version, but it should be fine.


On Sat, Feb 11, 2023 at 5:47 PM Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
Actually I can not use this trick because I don't know in advance the name of the channel.
I use them to pass signals between instruments and to keep the channels unique between several instances 
of the same instrument. I use an ever increasing counter to generate fresh names for channels. 

So the names for channels are not fixed.


вт, 7 февр. 2023 г. в 19:57, Anton Kholomiov <anton.kholomiov@gmail.com>:
Hi Joachim
Thank you for this trick. I will try it out.

вт, 7 февр. 2023 г. в 14:07, joachim heintz <jh@joachimheintz.de>:
hi anton -

this is a workaround:

chn_a("bla",3)

instr Init
   chnset(a(1),"bla")
   turnoff
endin
schedule("Init",0,1)

instr Test
   aBla = chnget:a("bla")
   printk2(k(aBla))
endin
schedule("Test",0,1)

perhaps on the long run init could be extended to do this job.

best -
        joachim



On 07/02/2023 11:44, Anton Kholomiov wrote:
> Hi, there)
>
> Is it possible to init a named channel with an initial value?
>
> I've tried to use chnset with i-rate value,
> but when later I try to write a-rate signal to it, the compiler
> complains that thisname is already used at a different rate.
>
> Is there some workaround?
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> https://github.com/csound/csound/issues
> <https://github.com/csound/csound/issues> Discussions of bugs and
> features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2023-02-18 17:14
FromAnton Kholomiov
SubjectRe: [Csnd] Is it possible to set initial value to channel?
Thanks, I see it's nice ide with i-rate update on 0 value, maybe I can use it.
And also explicit query of chnget to work at rate.
I was not aware of that feature. I mean this chnget:rate that Steven uses in the code

сб, 11 февр. 2023 г. в 14:09, thorin kerr <thorin.kerr@gmail.com>:
Steven Yi's 'xchan' UDO might be of use. You may have to make an arate version, but it should be fine.


On Sat, Feb 11, 2023 at 5:47 PM Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
Actually I can not use this trick because I don't know in advance the name of the channel.
I use them to pass signals between instruments and to keep the channels unique between several instances 
of the same instrument. I use an ever increasing counter to generate fresh names for channels. 

So the names for channels are not fixed.


вт, 7 февр. 2023 г. в 19:57, Anton Kholomiov <anton.kholomiov@gmail.com>:
Hi Joachim
Thank you for this trick. I will try it out.

вт, 7 февр. 2023 г. в 14:07, joachim heintz <jh@joachimheintz.de>:
hi anton -

this is a workaround:

chn_a("bla",3)

instr Init
   chnset(a(1),"bla")
   turnoff
endin
schedule("Init",0,1)

instr Test
   aBla = chnget:a("bla")
   printk2(k(aBla))
endin
schedule("Test",0,1)

perhaps on the long run init could be extended to do this job.

best -
        joachim



On 07/02/2023 11:44, Anton Kholomiov wrote:
> Hi, there)
>
> Is it possible to init a named channel with an initial value?
>
> I've tried to use chnset with i-rate value,
> but when later I try to write a-rate signal to it, the compiler
> complains that thisname is already used at a different rate.
>
> Is there some workaround?
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> https://github.com/csound/csound/issues
> <https://github.com/csound/csound/issues> Discussions of bugs and
> features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here