| Did you try this?
if ktime == time2
turnoff
endif
On 29 Jan 2013, at 03:16, Art Hunkins wrote:
> Please help debug the following simple .csd.
>
> It is mixing two mono samples; the second slightly overlaps the first.
>
> I want the "control" instrument 1 to stop running as soon as the second sample is initiated, so that the output file (distill.wav) will end at the end of sample too. I am unable to stop it appropriately (see the end of instrument 1).
>
> Making a score event for instrument one of "i1 0 60" runs the output file a full minute (way too long for my samples); obviously i1 is not stopped as I'd like.
>
> With i1 0 -1 (which should be a held note), the recording never starts.
>
> Thanks for any help.
>
> Art Hunkins
>
>
>
>
>
> -o distill.wav -m0d -b512 -B2048
>
>
>
>
>
> sr = 16000
> ksmps = 100
> nchnls = 1
>
> instr 1
>
> ktime times
> itime1 init 0
> ilen1 filelen "1.wav"
> ilen2 filelen "2.wav"
> ktrig2 trigger ktime, itime1, 0
> schedkwhen ktrig2, 0, 0, 2, 0, ilen1
> itime2 = ilen1 - 1
> ktrig3 trigger ktime, itime2, 0
> schedkwhen ktrig3, 0, 0, 3, 0, ilen2
>
> ; this is the problem line; it does not cause instrument 1 (itself) to stop
> ; (nor can anything else I've come up with)
> schedkwhen ktrig3, 0, 0, -1, 0, 0
>
> endin
>
> instr 2
>
> kamp linseg 0, .5, 1, p3 - 2, 1, 1.5, 0
> aout diskin "1.wav", 1
> out aout * kamp
>
> endin
>
> instr 3
>
> kamp linseg 0, .5, 1, p3 - 2, 1, 1.5, 0
> aout diskin "2.wav", 1
> out aout * kamp
>
> endin
>
>
>
>
>
> ; with the following line, the file always records for a full minute
> ; (will not be stopped early by last schedkwhen in instrument 1)
> i1 0 60
> ; with the following substituted, *nothing* records
> ; (should be a held note, halted by last schedkwhen in instrument 1)
> ;i1 0 -1
>
> e
>
>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
|