[Csnd] final duration and dynamic variation of playback speed
Date | 2012-06-27 12:10 |
From | peiman 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 |
Date | 2012-06-27 16:45 |
From | Steven Yi |
Subject | Re: [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 |
Date | 2012-06-27 17:09 |
From | peiman khosravi |
Subject | Re: [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, P On 27 June 2012 16:45, Steven Yi <stevenyi@gmail.com> wrote: Hi Peiman, |