Csound Csound-dev Csound-tekno Search About

[Csnd] final duration and dynamic variation of playback speed

Date2012-06-27 12:10
Frompeiman khosravi
Subject[Csnd] final duration and dynamic variation of playback speed
Hello,

I have an instrument that detects the length of an input soundfile and activates a playback instrument for that duration. The duration is scaled if I change the speed of the playback. But how do I calculate the final duration if the playback rate is varying over time according to a pre given bpf?

Thanks
Peiman

Date2012-06-27 16:45
FromSteven Yi
SubjectRe: [Csnd] final duration and dynamic variation of playback speed
Hi Peiman,

This is a bit tricky.  When tempo changes, calculating requires an
integral.  I have code for this in blue for general tempo changes
here:

http://bluemusic.git.sourceforge.net/git/gitweb.cgi?p=bluemusic/blue;a=blob;f=blue-core/src/blue/noteProcessor/TempoMapper.java;h=fba52d92b089a0e2471f0daf6567eb385e030189;hb=HEAD

which is based on code that Istvan posted here April 13, 2006.

Another option besides pre-calculating the duration is to start the
instrument with a held note (negative p3) and let it turn itself off
once the read pointer hits the end of the table.  If you just need to
turn off when the stored soundfile is done performing, this is a
viable option.  If you need the duration for other purposes, i.e. you
are using that to calculate further triggering of instruments in a
score generator, then you'll probably have to pre-calculate the
duration or make everything trigger the next dependent instrument
instance.

At least, that's what comes to mind; perhaps there are other solutions. :)

steven

p.s. - if you can post an example CSD that uses one of the wave files
from the manual, I can probably help with writing a UDO that could
calculate the duration from a bpf. It'd likely take in a bpf table,
then the total duration of the wave, use that dur as a beat and map
beat to time.

On Wed, Jun 27, 2012 at 7:10 AM, peiman khosravi
 wrote:
> Hello,
>
> I have an instrument that detects the length of an input soundfile and
> activates a playback instrument for that duration. The duration is scaled if
> I change the speed of the playback. But how do I calculate the final
> duration if the playback rate is varying over time according to a pre given
> bpf?
>
> Thanks
> Peiman

Date2012-06-27 17:09
Frompeiman khosravi
SubjectRe: [Csnd] final duration and dynamic variation of playback speed
Thanks Steven,

I'm using diskin2 to playback the sounds but I suppose I could load it in a table instead and then simply detect the end of the file table. This makes me think, maybe it would be useful to have a 'diskin3' opcode with a k-rate output that becomes non-zero when the file reaches the end (in the non-wraparound mode).

Best,



On 27 June 2012 16:45, Steven Yi <stevenyi@gmail.com> wrote:
Hi Peiman,

This is a bit tricky.  When tempo changes, calculating requires an
integral.  I have code for this in blue for general tempo changes
here:

http://bluemusic.git.sourceforge.net/git/gitweb.cgi?p=bluemusic/blue;a=blob;f=blue-core/src/blue/noteProcessor/TempoMapper.java;h=fba52d92b089a0e2471f0daf6567eb385e030189;hb=HEAD

which is based on code that Istvan posted here April 13, 2006.

Another option besides pre-calculating the duration is to start the
instrument with a held note (negative p3) and let it turn itself off
once the read pointer hits the end of the table.  If you just need to
turn off when the stored soundfile is done performing, this is a
viable option.  If you need the duration for other purposes, i.e. you
are using that to calculate further triggering of instruments in a
score generator, then you'll probably have to pre-calculate the
duration or make everything trigger the next dependent instrument
instance.

At least, that's what comes to mind; perhaps there are other solutions. :)

steven

p.s. - if you can post an example CSD that uses one of the wave files
from the manual, I can probably help with writing a UDO that could
calculate the duration from a bpf. It'd likely take in a bpf table,
then the total duration of the wave, use that dur as a beat and map
beat to time.

On Wed, Jun 27, 2012 at 7:10 AM, peiman khosravi
<peimankhosravi@gmail.com> wrote:
> Hello,
>
> I have an instrument that detects the length of an input soundfile and
> activates a playback instrument for that duration. The duration is scaled if
> I change the speed of the playback. But how do I calculate the final
> duration if the playback rate is varying over time according to a pre given
> bpf?
>
> Thanks
> Peiman


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"