Just a few quick toughts, did not have time to test. I don't think your code is particularly nasty, but it would be possible to use a flag instead of a counter to make it a little less nasty. kFlag init 0 if kFlag > 0 goto end ;do the "call once" code here kFlag = 1 end: I use this technique routinely for things that needs to be called only once. In your example, I wonder if you could also call the instrument with a duration of zero. I seem to recall that a duration of zero will do only an init pass and no k-passes. Maybe outvalue (or something else in your instrument) needs at least one k-pass to operate correctly, and that is the reason why your first version did not work. For you first code version, does it help to move the turnoff statement to the last line, after outvalue ? Oeyvind 2007/8/15, Greg Thompson : > > This does what I want it to do. Although its pretty nasty. > > > instr 101 > kcounter init 0 > > Sfname strget p4 > > Spathback sprintf "%d/len", p5 > Spathbackchan sprintf "%d/channels", p5 > > ichannels filenchnls Sfname > > > > > iftno ftgen p5, 0, 0, 1, Sfname, 0, 0, 1 > > if kcounter >= 0 kgoto done > > > outvalue Spathback, ftlen(iftno) > outvalue Spathbackchan, ichannels > > kcounter = kcounter + 1 > > > done: > > > endin > > greg > > > On Aug 15, 2007, at 2:57 PM, Greg Thompson wrote: > > The following locks up on my system. There are two solutions I've found to > overcoming the problem. > > 1 - Stagger the load times. > i101 0 1 "dr_kick4.aiff" 1 > i101 1 1 "dr_ride1.aif" 2 > i101 2 1 "dr_snare1.aif" 3 > > Problem: I want them to load as soon as possible > > 2 - Remove the turnoff opcode > > Problem: I want to use the outvalue opcode to send a message back to my > system telling me that the ftgen has completed along with some other > information about the file. How can I ensure that outvalue is only called > once? I guess I could put a if and a counter .. but that seems to be an > unnecessary hack. Am I crazy or is turnoff buggy? Suggestions welcome.. > > > > > -odac > > > sr = 44100 > kr = 4410 > nchnls = 2 > > instr 101 > > turnoff ; only allow for an init pass > > Sfname strget p4 > > iftno ftgen p5, 0, 0, 1, Sfname, 0, 0, 1 > > endin > > > > > i101 0 1 "dr_kick4.aiff" 1 > i101 0 1 "dr_ride1.aif" 2 > i101 0 1 "dr_snare1.aif" 3 > > > > > > > > > > > > > > Audio files are attached. > > greg >