| Hi Art,
I haven't followed this email thread too closely, but have you thought
to rewrite p3 in instr 2 and instr 3, using filelen?
Something like:
instr 2
instr 2
Sfile = p4
ilen1 filelen Sfile
p3 = ilen1
kamp linseg 0, .5, 1, p3 - 2, 1, 1.5, 0
aout diskin Sfile, 1
out aout * kamp
endin
and possibly reusing that for both wavs. It'd mean you wouldn't have
to worry about turning off anything as the instrument would just end
at the file length. Haven't tried this, but seems like a possibility?
steven
On Tue, Jan 29, 2013 at 10:33 PM, Art Hunkins wrote:
> Victor (and Adam - thanks to both),
>
> Believe it or not, this doesn't work either.
>
> I also can't understand why my score line:
> i1 0 -1
> creates a distill.wav file that contains no samples (just a 44-byte header).
>
> I *have* found one cumbersome procedure that works:
> instrument 1, of momentary duration, determines the duration of sample one,
> subtracts 1 (or less) from it, and spawns instrument 2 with that duration.
> Instrument 2 is then the controller that instigates samples 1 and 2 (now
> instruments 3 and 4).
> No turnoffs now necessary, as the duration for the controlling instrument is
> preset appropriately.
>
> If anyone has a simpler and more straightforward solution, I'd be glad to
> hear it.
>
> Adam - Sorry, I don't quite understand what you are suggesting, with manual
> overlapping and all. Sounds like you are thinking of a completely different
> approach. If you've an example, I'd love to see it.
>
>
> Art Hunkins
>
> ----- Original Message ----- From: "Victor"
> To:
> Sent: Tuesday, January 29, 2013 2:48 PM
>
> Subject: Re: [Csnd] Debugging Help Wanted
>
>
> Another idea is to start with a negative p1 and then use turnoff2 in the
> instr that plays your soundfiles to turn instr 1 off.
>
>
>
> On 29 Jan 2013, at 19:18, Adam Puckett wrote:
>
>> 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"
>>>
>>>
>>
>>
>> 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"
>
|