Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Debugging Help Wanted

Date2013-01-29 15:20
From"Art Hunkins"
SubjectRe: [Csnd] Debugging Help Wanted
Thanks for the response, Victor.

Yes, I've tried:
if ktime == itime2 then
turnoff
endif

and
if ktime >= itime2 then
turnoff
endif

Both fail to turn off instrument 1.

Just for "fun" I also added "ihold" to the beginning of instrument 1 (with 
"i1 0 60" in the score). It behaved just like "i1 0 -1" as might be expected 
(generating a blank output file) - except I don't understand why those 
"solutions" don't accomplish what I'm looking for either (i.e., two 
overlapping samples with output file stopping as soon as sample two ends).

Is this maybe a bug in the turnoff opcode? The manual says:
turnoff -- this p-time statement enables an instrument to turn itself off. 
Whether of finite duration or "held", the note currently being performed by 
this instrument is immediately removed from the active note list. No other 
notes are affected.

This does not seem to be happening in my .csd.

(BTW my example can be replicated with any two *mono* samples 4-20 seconds 
long and named "1.wav" and "2.wav". If not recorded at SR=16000, change both 
"diskin" in instruments 2 and 3 to "diskin2" - *or* change the SR=16000 in 
the .csd to correspond to the sample SR. Both samples should probably be in 
the same folder as the .csd.)

Art Hunkins

----- Original Message ----- 
From: "Victor" 
To: 
Sent: Tuesday, January 29, 2013 2:58 AM
Subject: Re: [Csnd] Debugging Help Wanted


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


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"

= 


Date2013-01-29 19:18
FromAdam Puckett
SubjectRe: [Csnd] Debugging Help Wanted
turnoff won't do what you want. Use global asigs for the samples,
overlap them manually and turn them off when 2 is done. (You can use
negative p1 to turn off an instrument).

On 1/29/13, Art Hunkins  wrote:
> Thanks for the response, Victor.
>
> Yes, I've tried:
> if ktime == itime2 then
> turnoff
> endif
>
> and
> if ktime >= itime2 then
> turnoff
> endif
>
> Both fail to turn off instrument 1.
>
> Just for "fun" I also added "ihold" to the beginning of instrument 1 (with
> "i1 0 60" in the score). It behaved just like "i1 0 -1" as might be expected
>
> (generating a blank output file) - except I don't understand why those
> "solutions" don't accomplish what I'm looking for either (i.e., two
> overlapping samples with output file stopping as soon as sample two ends).
>
> Is this maybe a bug in the turnoff opcode? The manual says:
> turnoff -- this p-time statement enables an instrument to turn itself off.
> Whether of finite duration or "held", the note currently being performed by
>
> this instrument is immediately removed from the active note list. No other
> notes are affected.
>
> This does not seem to be happening in my .csd.
>
> (BTW my example can be replicated with any two *mono* samples 4-20 seconds
> long and named "1.wav" and "2.wav". If not recorded at SR=16000, change both
>
> "diskin" in instruments 2 and 3 to "diskin2" - *or* change the SR=16000 in
> the .csd to correspond to the sample SR. Both samples should probably be in
>
> the same folder as the .csd.)
>
> Art Hunkins
>
> ----- Original Message -----
> From: "Victor" 
> To: 
> Sent: Tuesday, January 29, 2013 2:58 AM
> Subject: Re: [Csnd] Debugging Help Wanted
>
>
> 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"
>>
>
>
> 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"
>
> =
>
>
>
> 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"
>
>