| hi art -
thanks; i think i understood now. so what you want to do, in pseudo-code:
1) to get the length of two samples
2) to start the first sample immediately
3) to start the second sample one second after the first one has finished.
in csound code this would be:
1)
ilen1 filelen "1.wav"
ilen2 filelen "2.wav"
2)
event_i "i", 2, 0, ilen1
3)
event_i "i", 3, ilen1-1, ilen2
so you can call instr 1 for a very short time (say 0.1 seconds) and the
overall duration should be the fine.
can you try? if this does not work, i am happy to assist you further.
best -
joachim
Am 30.01.2013 04:04, schrieb Art Hunkins:
> Joachim,
>
> My .csd is at the very end of this email.
>
> Note: This is delayed playback, not a real-time performance.
>
> Sample 1 is written out first (to distill.wav), and just before it ends,
> sample 2 is written out (to the same file); thus the samples overlap.
> They do not start at the same time; yes, they overlap at a "*relatively*
> fixed time" so to speak - the second starts one second before the end of
> the first. The output is a mixdown of the two mono samples to a single
> track. *The recording needs to end when the second sample completes.*
>
> The problem is that instr 1, which controls when instrs 2 and 3 begin
> (each plays one sample), does not know prior to its initialization, how
> long to play. It needs to play no longer than the conclusion of sample
> 2, or it adds silence to the end of the recording.
>
> I hope that explanation is clearer. Thanks for your interest.
>
> Art Hunkins
>
> ----- Original Message ----- From: "joachim heintz"
> To:
> Sent: Tuesday, January 29, 2013 6:02 PM
> Subject: Re: [Csnd] Debugging Help Wanted
>
>
>> art -
>> i am pretty sure that there is a simple solution for what you want to do.
>> my problem is that from your description:
>> "It is mixing two mono samples; the second slightly overlaps the first."
>> i cannot get a clear image of the situation.
>> some questions:
>> - do they start at the same time?
>> - or at any different, but fixed time?
>> - or does sample 2 start at any time in a real-time situation?
>> - do you want to record sample 1 until sample 2 begins, or do you want
>> to record both until one of them ends?
>> sorry if this is due to my poor understanding, but if you don't mind,
>> explain again.
>> best -
>> joachim
>>
>>
>> Am 29.01.2013 23:33, schrieb Art Hunkins:
>>> 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"
>>>
>>>
>>
>>
>> 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"
>
>
|