Csound Csound-dev Csound-tekno Search About

[Csnd] chnget issues

Date2019-11-01 12:46
From"Jeanette C."
Subject[Csnd] chnget issues
Hey hey,
I ran into a difficulty with chnget, but can't yet work out what the trouble 
is.

Consider this code:
...
gSnames[] init 2

instr 1 ; Put text/names in the array
   ; This will show up correctly
   gSnames[0] = "Test1"
   gSnames[1] = "Test2"
endin

instr 2 ; send audio to channels "Test1" and "Test2"
   ; This also appears to work
   a1 vco2 .3, 220, 2, .5
   a2 vco2 .3, 330, 4, .5
   chnset a1, gSnames[0]
   chnset a2, gSnames[1]
endin

instr 3 ; Gather up the audio from the channels
   a1 init 0
   aout init 0
   kIndex = 0

   ; looping through all channel names
   while (kIndex >2) do
     a1 chnget gSnames[kIndex] ; this fails
     aout += a1
     kIndex += 1
   od

   ; Output audio and clear
   outs aout, aout
   aout = 0
   a1 = 0
endin

The error message is something like:
invalid channel name
a1 chnget.a #S3

If I use the function version of chnget I get the invalid channel name and:
#i4     chnget.i        #S3

With some other - apparently - legitimate version, which I can't recreate now, 
I got something about an already existing channel.

I am now running the latest git version of Csound.

I have a strong feeling that I'm not thinking correctly about the mechanics of 
flow of this task. Can someone make a suggestion, please?

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Twitter: https://twitter.com/jeanette_c_s
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

I used to think
I had the answers to everything
But now I know
... :) <3
(Britney Spears)

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

Date2019-11-01 14:49
FromVictor Lazzarini
SubjectRe: [Csnd] chnget issues
I think the loop is no good, you need a separate instance of chnget instead of reusing it. 

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 1 Nov 2019, at 12:47, Jeanette C.  wrote:
> 
> Hey hey,
> I ran into a difficulty with chnget, but can't yet work out what the trouble is.
> 
> Consider this code:
> ...
> gSnames[] init 2
> 
> instr 1 ; Put text/names in the array
>  ; This will show up correctly
>  gSnames[0] = "Test1"
>  gSnames[1] = "Test2"
> endin
> 
> instr 2 ; send audio to channels "Test1" and "Test2"
>  ; This also appears to work
>  a1 vco2 .3, 220, 2, .5
>  a2 vco2 .3, 330, 4, .5
>  chnset a1, gSnames[0]
>  chnset a2, gSnames[1]
> endin
> 
> instr 3 ; Gather up the audio from the channels
>  a1 init 0
>  aout init 0
>  kIndex = 0
> 
>  ; looping through all channel names
>  while (kIndex >2) do
>    a1 chnget gSnames[kIndex] ; this fails
>    aout += a1
>    kIndex += 1
>  od
> 
>  ; Output audio and clear
>  outs aout, aout
>  aout = 0
>  a1 = 0
> endin
> 
> The error message is something like:
> invalid channel name
> a1 chnget.a #S3
> 
> If I use the function version of chnget I get the invalid channel name and:
> #i4     chnget.i        #S3
> 
> With some other - apparently - legitimate version, which I can't recreate now, I got something about an already existing channel.
> 
> I am now running the latest git version of Csound.
> 
> I have a strong feeling that I'm not thinking correctly about the mechanics of flow of this task. Can someone make a suggestion, please?
> 
> Best wishes,
> 
> Jeanette
> 
> -- 
> * Website: http://juliencoder.de - for summer is a state of sound
> * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
> * SoundCloud: https://soundcloud.com/jeanette_c
> * Twitter: https://twitter.com/jeanette_c_s
> * Audiobombs: https://www.audiobombs.com/users/jeanette_c
> * GitHub: https://github.com/jeanette-c
> 
> I used to think
> I had the answers to everything
> But now I know
> ... :) <3
> (Britney Spears)
> 
> 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

Date2019-11-01 16:28
Fromjohn
SubjectRe: [Csnd] chnget issues
Indeed.  chnget remembers the channel name at init time so the version in 
a loop will know only one name

On Fri, 1 Nov 2019, Victor Lazzarini wrote:

> I think the loop is no good, you need a separate instance of chnget instead of reusing it.
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 1 Nov 2019, at 12:47, Jeanette C.  wrote:
>>
>> Hey hey,
>> I ran into a difficulty with chnget, but can't yet work out what the trouble is.
>>
>> Consider this code:
>> ...
>> gSnames[] init 2
>>
>> instr 1 ; Put text/names in the array
>>  ; This will show up correctly
>>  gSnames[0] = "Test1"
>>  gSnames[1] = "Test2"
>> endin
>>
>> instr 2 ; send audio to channels "Test1" and "Test2"
>>  ; This also appears to work
>>  a1 vco2 .3, 220, 2, .5
>>  a2 vco2 .3, 330, 4, .5
>>  chnset a1, gSnames[0]
>>  chnset a2, gSnames[1]
>> endin
>>
>> instr 3 ; Gather up the audio from the channels
>>  a1 init 0
>>  aout init 0
>>  kIndex = 0
>>
>>  ; looping through all channel names
>>  while (kIndex >2) do
>>    a1 chnget gSnames[kIndex] ; this fails
>>    aout += a1
>>    kIndex += 1
>>  od
>>
>>  ; Output audio and clear
>>  outs aout, aout
>>  aout = 0
>>  a1 = 0
>> endin
>>
>> The error message is something like:
>> invalid channel name
>> a1 chnget.a #S3
>>
>> If I use the function version of chnget I get the invalid channel name and:
>> #i4     chnget.i        #S3
>>
>> With some other - apparently - legitimate version, which I can't recreate now, I got something about an already existing channel.
>>
>> I am now running the latest git version of Csound.
>>
>> I have a strong feeling that I'm not thinking correctly about the mechanics of flow of this task. Can someone make a suggestion, please?
>>
>> Best wishes,
>>
>> Jeanette
>>
>> --
>> * Website: http://juliencoder.de - for summer is a state of sound
>> * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>> * SoundCloud: https://soundcloud.com/jeanette_c
>> * Twitter: https://twitter.com/jeanette_c_s
>> * Audiobombs: https://www.audiobombs.com/users/jeanette_c
>> * GitHub: https://github.com/jeanette-c
>>
>> I used to think
>> I had the answers to everything
>> But now I know
>> ... :) <3
>> (Britney Spears)
>>
>> 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

Date2019-11-01 16:53
From"Jeanette C."
SubjectRe: [Csnd] chnget issues
Thanks both Victor and John. I thought I had gone wrong somewhere with that 
loop. I have redesigned the system now maybe even in a clearer way all 
together.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Twitter: https://twitter.com/jeanette_c_s
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

All I need is time
A moment that is mine
While I'm in between <3
(Britney Spears)

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