| >Some weeks ago I have sent this question, but at that time I wasn't really
>on the csound list.
>Therefore I repeat the question:
>
>Is it possible to start a new instance of an instrument, say i1,
>exactly after a previous line in the scorefile (same instrument i1) stops
>because of a "turnoff" statement execution?
>The first i1 statement can have a negative p3, or a "hold" statement in the
>orc-file but will
>stop after a built-in condition is met. The time is not exactly predictable,
>but I want to start the next i1 line exactly at that moment.
>So I can not give that line a good p2 parameter.
>I hope someone has an idea about this. Thank you for any help.
>
>
>Jo Scherpenisse (hoofd elektronische dienst), e-mail: scherp@koncon.nl
>Koninklijk Conservatorium, Juliana van Stolberglaan 1
>2595 CA Den Haag tel: 070-3814251 fax: 070-3853941
>
>
[I'm reposting this, because it didn't seem to go out to the csound list on
my first attempt. RP]
I think you might be better off avoiding this whole problem. A different
approach would be to use reinitialization within the instrument. In other
words, if you're now issuing a turnoff when some conditions are met within
your instrument, issue a reinit command instead. That way, you don't have to
start a new note from the score each time you turn off the previous note;
you just use one i-statement for all the notes. Since (presumably) you're
now changing some parameters (like pitch, amp, etc.) for each new note via
the p-fields in the score, you would probably need to place those parameters
in a function table, instead, and reference them by table units, e.g.,
instr 1 ;simple reinit instr
iwavefn = 1 ;oscil function number
iparms = 2 ;parameter table number
index = 0 ;index into the parameter table
reinitfromhere: ;section to be reinitialized
ipch table index,iparms ;get this pitch from table
iamp table index+1,iparms ;get this amp from table
idur table index+2,iparms ;get this dur from table
index = index+3 ;update index for next note
kgate linen iamp,.01,idur,.1
asig oscil kgate,cpspch(ipch),iwavefn
out asig
timout 0,idur,skipinit ;skip over reinit for idur secs
reinit reinitfromhere ;reinit after idur
rireturn ;end of sect to be reinitialized
;N.B., rireturn is not really needed,
;if at end of instr
skipinit:
endin
;sample score
f01 0 2048 10 1
;function with parm data: pch amp dur
f02 0 16 -2 8.00 20000 .5 ;parms in sets of 3
8.02 10000 .5
8.04 5000 .5
8.05 10000 .5
8.07 20000 2
i01 0 4 ;other parms for entire phrase here
e
...or something like that. I'm using timout to determine the note lengths,
but you could use other methods to test for when to reinit.
Good luck,
Russell Pinkston
----------------------------------
Russell F. Pinkston, D.M.A.
Associate Professor of Composition
Director, Electronic Music Studios
School of Music
The University of Texas at Austin
Austin, TX 78712
[512-471-0865]
|