Csound Csound-dev Csound-tekno Search About

[Csnd] Reading String value from channel with functional syntax

Date2021-03-30 22:43
From"Jeanette C."
Subject[Csnd] Reading String value from channel with functional syntax
Hey hey,
I also have issues reading a string value from a channel.
instrt 1
   chn_S("Strings", 3)
   chnset("Hello World", "Strings")
   ...
endin

instr 2
   ...
   Sname = chnget("Strings")
endin
results in an error:
INIT ERROR in instr 2 (opcode chnget.i) line 21: channel already exists with 
incompatible type
#i0     chnget.i        "Strings"

When not using the functional form on the chnget it works.

I also tried chnget:i("Strings"), but no luck. What am I doing wrong?

Best wishes and many thanks,

Jeanette

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

Top down, on the strip
Lookin' in the mirror
I'm checkin' out my lipstick <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

Date2021-03-31 03:02
FromPete Goodeve
SubjectRe: [Csnd] Reading String value from channel with functional syntax
AttachmentsNone  

Date2021-03-31 08:37
FromTarmo Johannes
SubjectRe: [Csnd] Reading String value from channel with functional syntax
Hi!

It is good practice to always add the type after opcode in functional syntax -  you never know what is the default type -  if there are several output types for the opcode. Thus:

chnset:S("Hello World", "Strings")
   ...

chnget:S("Strings")


tarmo


Kontakt Pete Goodeve (<pete.goodeve@computer.org>) kirjutas kuupäeval K, 31. märts 2021 kell 05:02:
I get this too, again essentially cutting/[pasting your code (minus the typo "instrt"!)
Don't see anyting wrong with your syntax!

        -- Pete --

On Tue, Mar 30, 2021 at 11:43:45PM +0200, Jeanette C. wrote:
> Hey hey,
> I also have issues reading a string value from a channel.
> instrt 1
>   chn_S("Strings", 3)
>   chnset("Hello World", "Strings")
>   ...
> endin
>
> instr 2
>   ...
>   Sname = chnget("Strings")
> endin
> results in an error:
> INIT ERROR in instr 2 (opcode chnget.i) line 21: channel already exists
> with incompatible type
> #i0     chnget.i        "Strings"
>
> When not using the functional form on the chnget it works.
>
> I also tried chnget:i("Strings"), but no luck. What am I doing wrong?
>
> Best wishes and many thanks,
>
> Jeanette
>
> --
>  * Website: http://juliencoder.de - for summer is a state of sound
>  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
>  * GitHub: https://github.com/jeanette-c
>
> Top down, on the strip
> Lookin' in the mirror
> I'm checkin' out my lipstick <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

Date2021-03-31 09:10
From"Jeanette C."
SubjectRe: [Csnd] Reading String value from channel with functional syntax
Mar 31 2021, Tarmo Johannes has written:
...
> It is good practice to always add the type after opcode in functional
> syntax
...
> chnset:S("Hello World", "Strings")
>   ...
>
> chnget:S("Strings")
...
Thanks a lot. I somehow didn't know that S could be used with this
syntax. I always assume only a, k and i worked to signify the update
rate.

Best wishes,

Jeanette

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

Skip on the drinks Head to the floor
Makin' my way Past the show
My body's taken over And I want some more <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

Date2021-03-31 09:15
FromPete Goodeve
SubjectRe: [Csnd] Reading String value from channel with functional syntax
AttachmentsNone  

Date2021-03-31 09:19
FromTarmo Johannes
SubjectRe: [Csnd] Reading String value from channel with functional syntax
Hi,

Thanks, Pete, I did not check. Yes, seems that chnset  needs old syntax for strings This works:

schedule 1, 0, 1

instr 1

chn_S("Strings", 3)

chnset "Hello World", "Strings"

Sname = chnget:S("Strings")

prints Sname

endin


Kontakt Pete Goodeve (<pete.goodeve@computer.org>) kirjutas kuupäeval K, 31. märts 2021 kell 11:16:
On Wed, Mar 31, 2021 at 10:37:46AM +0300, Tarmo Johannes wrote:
> Hi!
>
> It is good practice to always add the type after opcode in functional
> syntax -  you never know what is the default type -  if there are several
> output types for the opcode. Thus:
>
> chnset:S("Hello World", "Strings")

^^^  That actually throws an error ('Unexpected ":"')...  Seems that only opcodes
that return a value can be typed that way.

        -- Pete --
>    ...
>
> chnget:S("Strings")
>
>
> tarmo
>
> Kontakt Pete Goodeve (<pete.goodeve@computer.org>) kirjutas kuupäeval K,
> 31. märts 2021 kell 05:02:
>
> > I get this too, again essentially cutting/[pasting your code (minus the
> > typo "instrt"!)
> > Don't see anyting wrong with your syntax!
> >
> >         -- Pete --
> >
> > On Tue, Mar 30, 2021 at 11:43:45PM +0200, Jeanette C. wrote:
> > > Hey hey,
> > > I also have issues reading a string value from a channel.
> > > instrt 1
> > >   chn_S("Strings", 3)
> > >   chnset("Hello World", "Strings")
> > >   ...
> > > endin
> > >
> > > instr 2
> > >   ...
> > >   Sname = chnget("Strings")
> > > endin
> > > results in an error:
> > > INIT ERROR in instr 2 (opcode chnget.i) line 21: channel already exists
> > > with incompatible type
> > > #i0     chnget.i        "Strings"
> > >
> > > When not using the functional form on the chnget it works.
> > >
> > > I also tried chnget:i("Strings"), but no luck. What am I doing wrong?
> > >
> > > Best wishes and many thanks,
> > >
> > > Jeanette
> > >
> > > --
> > >  * Website: http://juliencoder.de - for summer is a state of sound
> > >  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
> > >  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
> > >  * GitHub: https://github.com/jeanette-c
> > >
> > > Top down, on the strip
> > > Lookin' in the mirror
> > > I'm checkin' out my lipstick <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

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

Date2021-03-31 09:53
From"Jeanette C."
SubjectRe: [Csnd] Reading String value from channel with functional syntax
Mar 31 2021, Tarmo Johannes has written:
...
> chnset "Hello World", "Strings"
...
It also works as an untyped functional statement:
chnset(Sname, "Channel")
This does not produce warnings.

Best wishes,

Jeanette

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

Skip on the drinks Head to the floor
Makin' my way Past the show
My body's taken over And I want some more <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

Date2021-03-31 15:35
FromSteven Yi
SubjectRe: [Csnd] Reading String value from channel with functional syntax
To clarify:

* chnset:S() would mean "Use the version of chnset that outputs an
S-type variable" but there are no chnset opcodes that output values,
so the error is correct.
* chnget:S() would be appropriate as there are multiple chnget opcodes
and you are specifying the one that returns an S-type variable.


On Wed, Mar 31, 2021 at 4:53 AM Jeanette C.  wrote:
>
> Mar 31 2021, Tarmo Johannes has written:
> ...
> > chnset "Hello World", "Strings"
> ...
> It also works as an untyped functional statement:
> chnset(Sname, "Channel")
> This does not produce warnings.
>
> Best wishes,
>
> Jeanette
>
> --
>   * Website: http://juliencoder.de - for summer is a state of sound
>   * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>   * Audiobombs: https://www.audiobombs.com/users/jeanette_c
>   * GitHub: https://github.com/jeanette-c
>
> Skip on the drinks Head to the floor
> Makin' my way Past the show
> My body's taken over And I want some more <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