i was curious about this and wrote some test code:
<CsoundSynthesizer>
<CsOptions>
-o dac
</CsOptions>
<CsInstruments>
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
</CsInstruments>
<CsScore>
i "Call" 0 1
</CsScore>
</CsoundSynthesizer>
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:
<CsoundSynthesizer>
<CsOptions>
-o dac
</CsOptions>
<CsInstruments>
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
</CsInstruments>
<CsScore>
i "Call" 0 1
</CsScore>
</CsoundSynthesizer>
best -
joachim
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here