[Csnd] Setting loop points in file with phasor index
Date | 2013-02-12 02:46 |
From | Andrew Ikenberry |
Subject | [Csnd] Setting loop points in file with phasor index |
Hello Csounders! I am trying to create a csd that will allow me to dynamically change the start and end points of a loop reading through an audio file. I currently have an audio file written to a table and am accessing the table with table3. The index to the table is generated by phasor.
I also have a slider that is controlling the speed of playback. What I am trying to do is have two sliders that control loop start and loop end points. I tried to do this by rescaling the signal from phasor but the only thing that changes is the pitch and not the looping points. Is there a way to scale phasor
to only read a section of the file according to my start and end points? My code is pasted below. Thanks in advance!!!!!!!!!!!!!!!!! Best, Andrew ; isize = file length in seconds ; Loop start kloopstart chnget "kloopstart" kloopstart scale kloopstart, isize, 0 ; Loop end kloopend chnget "kloopend" kloopend scale kloopend, isize, 0.01 ; Speed of playback kspeed chnget "kspeed" kspeed scale kspeed, 2, -2 ksize = kloopend-kloopstart ; Runs fine stright through entire file ;kphase = (1/isize)*kspeed ; Doesn't run correctly kphase = (1/ksize)*kspeed aline phasor kphase asig table3 aline, 1, 1 out asig |
Date | 2013-02-12 12:01 |
From | Rory Walsh |
Subject | Re: [Csnd] Setting loop points in file with phasor index |
I just covered this topic with my students. Here's the csd file we came up with, although you'll need to change a few i-rate variables to k-rates. You'll note that the phasor frequency is dependent on how much of the table we are reading. Without this it would play back at the incorrect speed resulting in unwanted changes to the frequency which I believe it what was happening in your case although I haven't studied the code. |
Date | 2013-02-12 23:32 |
From | Andrew Ikenberry |
Subject | Re: [Csnd] Setting loop points in file with phasor index |
Thanks Rory! This helped immensely. -Andrew
On Tue, Feb 12, 2013 at 7:01 AM, Rory Walsh <rorywalsh@ear.ie> wrote: I just covered this topic with my students. Here's the csd file we |