Csound Csound-dev Csound-tekno Search About

[Csnd] Named instruments and fractional instance numbers

Date2021-11-09 11:55
From"Jeanette C."
Subject[Csnd] Named instruments and fractional instance numbers
Hey hey,
I wondered what the most ellegant way is to schedule or schedulek a named 
instrument with a fractional part to denote a separate instance.

I've achieved it with an expression like this:
(nstrnum("Source") + (iIndex * .01))

It works, it's clear, but it seems a little long as part of a full schedule 
line in the score.

Is there a shorter way? A special syntax?

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

Where are you now, what have you found
Where is your heart, when I'm not around <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-11-09 15:22
Fromjohn
SubjectRe: [Csnd] Named instruments and fractional instance numbers
Depeding on our version try foo.3 as an instrumnt name


On Tue, 9 Nov 2021, Jeanette C. wrote:

> Hey hey,
> I wondered what the most ellegant way is to schedule or schedulek a named 
> instrument with a fractional part to denote a separate instance.
>
> I've achieved it with an expression like this:
> (nstrnum("Source") + (iIndex * .01))
>
> It works, it's clear, but it seems a little long as part of a full schedule 
> line in the score.
>
> Is there a shorter way? A special syntax?
>
> 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
>
> Where are you now, what have you found
> Where is your heart, when I'm not around <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

Date2021-11-09 15:28
From"Jeanette C."
SubjectRe: [Csnd] Named instruments and fractional instance numbers
Nov 9 2021, john has written:

> Depeding on our version try foo.3 as an instrumnt name
Does that work out with dynamic fractional instrument numbers? Would I have to 
sprintf it in that case?
>
>
> On Tue, 9 Nov 2021, Jeanette C. wrote:
>
>> Hey hey,
>> I wondered what the most ellegant way is to schedule or schedulek a named 
>> instrument with a fractional part to denote a separate instance.
>> 
>> I've achieved it with an expression like this:
>> (nstrnum("Source") + (iIndex * .01))
>> 
>> It works, it's clear, but it seems a little long as part of a full schedule 
>> line in the score.
>> 
>> Is there a shorter way? A special syntax?
>> 
>> 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
>> 
>> Where are you now, what have you found
>> Where is your heart, when I'm not around <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
>

-- 
  * 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

Where are you now, what have you found
Where is your heart, when I'm not around <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-11-09 15:34
Fromjohn
SubjectRe: [Csnd] Named instruments and fractional instance numbers
On Tue, 9 Nov 2021, Jeanette C. wrote:

> Nov 9 2021, john has written:
>
>> Depeding on our version try foo.3 as an instrumnt name
> Does that work out with dynamic fractional instrument numbers? Would I have 
> to sprintf it in that case?
>>

afaik it is static if it works at all

==John ff

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-11-09 19:59
Fromjoachim heintz
SubjectRe: [Csnd] Named instruments and fractional instance numbers
i was curious about this and wrote some test code:



-o dac


sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

instr Call
  schedule "Test.1", 0, 99, 400
  schedule "Test.2", 0, 99, 500
  schedule "Kill", 3, 1
endin

instr Kill
  turnoff2 "Test.1", 4, 0
  turnoff
endin

instr Test
  prints "Instrument is: '%s'\n", nstrstr(p1)
  aOut poscil .2, p4
  out aOut, aOut
endin



i "Call" 0 1




as far as i see, the result is:
- it works if the fractional part is inside the string, but
- turnoff2 is not able to distinguish between instances, because the 
fractional part seems not to arrive in the called instrument properly.

so i think the only clean way is to do what jeanette did.  i'd wrap it 
in a UDO, like:



-o dac


sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

opcode NamedFrac, i, Si
  Sinstr, iFrac xin
  xout nstrnum(Sinstr) + iFrac
endop

instr Call
  schedule NamedFrac("Test",.1), 0, 99, 400
  schedule NamedFrac("Test",.2), 0, 99, 500
  schedule "Kill", 3, 1
endin

instr Kill
  turnoff2 NamedFrac("Test",.1), 4, 0
  turnoff
endin

instr Test
  prints "Instrument is: '%f'\n", p1
  aOut poscil .2, p4
  out aOut, aOut
endin



i "Call" 0 1




best -
	joachim

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-11-09 20:05
Fromjohn
SubjectRe: [Csnd] Named instruments and fractional instance numbers
Likely there is a cast from YFLT to int which loses te fractional part.  I 
seem to remember noticing this but it was not my code.....

On Tue, 9 Nov 2021, joachim heintz wrote:

> i was curious about this and wrote some test code:
>
> 
> 
> -o dac
> 
> 
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> instr Call
> schedule "Test.1", 0, 99, 400
> schedule "Test.2", 0, 99, 500
> schedule "Kill", 3, 1
> endin
>
> instr Kill
> turnoff2 "Test.1", 4, 0
> turnoff
> endin
>
> instr Test
> prints "Instrument is: '%s'\n", nstrstr(p1)
> aOut poscil .2, p4
> out aOut, aOut
> endin
>
> 
> 
> i "Call" 0 1
> 
> 
>
>
> as far as i see, the result is:
> - it works if the fractional part is inside the string, but
> - turnoff2 is not able to distinguish between instances, because the 
> fractional part seems not to arrive in the called instrument properly.
>
> so i think the only clean way is to do what jeanette did.  i'd wrap it in a 
> UDO, like:
>
> 
> 
> -o dac
> 
> 
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> opcode NamedFrac, i, Si
> Sinstr, iFrac xin
> xout nstrnum(Sinstr) + iFrac
> endop
>
> instr Call
> schedule NamedFrac("Test",.1), 0, 99, 400
> schedule NamedFrac("Test",.2), 0, 99, 500
> schedule "Kill", 3, 1
> endin
>
> instr Kill
> turnoff2 NamedFrac("Test",.1), 4, 0
> turnoff
> endin
>
> instr Test
> prints "Instrument is: '%f'\n", p1
> aOut poscil .2, p4
> out aOut, aOut
> endin
>
> 
> 
> i "Call" 0 1
> 
> 
>
>
> best -
> 	joachim
>
> 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