Csound Csound-dev Csound-tekno Search About

[Csnd] pvsbuffer/pvsreadbuf for time stretching

Date2009-05-02 01:25
FromDave Seidel
Subject[Csnd] pvsbuffer/pvsreadbuf for time stretching
I found Victor's cool "Developing Spectral Processing Applications" 
presentation[1], and would like to try using pvsbuffer/pvsbufread to to 
time stretching, but I don't know how to go about it.  More 
specifically, the paper says

"With fsigs, it is possible to use a buffer to write and
then read (at different rates), to perform a (fake-)RT 
timestretching/compression[.]"

But I have no idea how to change the read rate.  Can anyone help 
explain?  I have working code similar to the following:

asig		soundin		"somefile.wav"
fsig		pvsanal		asig, 1024, 256, 1024, 0
ihand, ktime	pvsbuffer	fsig, p3
fou		pvsbufread 	ktime, ihand				
aout		pvsynth		fl

So I'm guessing changing the read rate would involve changing ktime, but 
not sure.

- Dave

[1] 
http://music.nuim.ie/music/sites/cpaneltest.nuim.ie.music/files/documents/spectral-processing2.pdf

-- 
~DaveSeidel = [
   http://mysterybear.net,
   http://daveseidel.tumblr.com,
   http://twitter.com/DaveSeidel
];


Date2009-05-02 13:38
Fromvictor
Subject[Csnd] Re: pvsbuffer/pvsreadbuf for time stretching
ktime is the current time of writing into the buffer, so you can just scale 
it:






sr= 44100
ksmps = 64
nchnls= 1

instr 1

asig diskin2  "flutec3.wav", 1,0,1
fsig pvsanal asig, 1024, 256, 1024, 1
ihandle, ktime pvsbuffer fsig, 60
f1 pvsbufread ktime*0.4, ihandle
aout pvsynth f1

    out aout
endin






f1 0 16384 10 1

i1 0 100




Or you could use your own time counter. The advantage of ktime is
that it will give you the exact position in the buffer where you've just
written a frame

Victor

----- Original Message ----- 
From: "Dave Seidel" 
To: 
Sent: Saturday, May 02, 2009 1:25 AM
Subject: [Csnd] pvsbuffer/pvsreadbuf for time stretching


>I found Victor's cool "Developing Spectral Processing Applications" 
>presentation[1], and would like to try using pvsbuffer/pvsbufread to to 
>time stretching, but I don't know how to go about it.  More specifically, 
>the paper says
>
> "With fsigs, it is possible to use a buffer to write and
> then read (at different rates), to perform a (fake-)RT 
> timestretching/compression[.]"
>
> But I have no idea how to change the read rate.  Can anyone help explain? 
> I have working code similar to the following:
>
> asig soundin "somefile.wav"
> fsig pvsanal asig, 1024, 256, 1024, 0
> ihand, ktime pvsbuffer fsig, p3
> fou pvsbufread ktime, ihand aout pvsynth fl
>
> So I'm guessing changing the read rate would involve changing ktime, but 
> not sure.
>
> - Dave
>
> [1] 
> http://music.nuim.ie/music/sites/cpaneltest.nuim.ie.music/files/documents/spectral-processing2.pdf
>
> -- 
> ~DaveSeidel = [
>   http://mysterybear.net,
>   http://daveseidel.tumblr.com,
>   http://twitter.com/DaveSeidel
> ];
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 


Date2009-05-02 13:57
FromDavid Mooney/Maxine Heller
Subject[Csnd] Re: pvsbuffer/pvsreadbuf for time stretching
Try this:

ihand     pvsbuffer    fsig,ival
ktime     line         0,ival,1
fsig2     pvsbufread   ktime,ihand

ival is the desired end length time, the stretch time (may or may not 
be p3). I don't find that this works well for complex time stretching 
(stretching different parts of the original sound at different 
rates), but for a simple stretch this works quite well.

--David

At 08:25 PM 5/1/2009, you wrote:
>I found Victor's cool "Developing Spectral Processing Applications" 
>presentation[1], and would like to try using pvsbuffer/pvsbufread to 
>to time stretching, but I don't know how to go about it.  More 
>specifically, the paper says
>
>"With fsigs, it is possible to use a buffer to write and
>then read (at different rates), to perform a (fake-)RT 
>timestretching/compression[.]"
>
>But I have no idea how to change the read rate.  Can anyone help 
>explain?  I have working code similar to the following:
>
>asig            soundin         "somefile.wav"
>fsig            pvsanal         asig, 1024, 256, 1024, 0
>ihand, ktime    pvsbuffer       fsig, p3
>fou             pvsbufread      ktime, ihand
>aout            pvsynth         fl
>
>So I'm guessing changing the read rate would involve changing ktime, 
>but not sure.
>
>- Dave
>
>[1] 
>http://music.nuim.ie/music/sites/cpaneltest.nuim.ie.music/files/documents/spectral-processing2.pdf
>
>--
>~DaveSeidel = [
>   http://mysterybear.net,
>   http://daveseidel.tumblr.com,
>   http://twitter.com/DaveSeidel
>];
>
>
>
>Send bugs reports to this list.
>To unsubscribe, send email sympa@lists.bath.ac.uk with body 
>"unsubscribe csound"

Maxine Heller: mheller@city-net.com
David Mooney: dmooney@city-net.com
www.city-net.com/~moko/ 


Date2009-05-02 13:57
FromDave Seidel
Subject[Csnd] Re: Re: pvsbuffer/pvsreadbuf for time stretching
Aha!  Thanks, Victor!

- Dave

victor wrote:
> ktime is the current time of writing into the buffer, so you can just 
> scale it:
> 
> 
> 
> 
> 
> 
> sr= 44100
> ksmps = 64
> nchnls= 1
> 
> instr 1
> 
> asig diskin2  "flutec3.wav", 1,0,1
> fsig pvsanal asig, 1024, 256, 1024, 1
> ihandle, ktime pvsbuffer fsig, 60
> f1 pvsbufread ktime*0.4, ihandle
> aout pvsynth f1
> 
>    out aout
> endin
> 
> 
> 
> 
> 
> 
> f1 0 16384 10 1
> 
> i1 0 100
> 
> 
> 
> 
> Or you could use your own time counter. The advantage of ktime is
> that it will give you the exact position in the buffer where you've just
> written a frame
> 
> Victor
> 
> ----- Original Message ----- From: "Dave Seidel" 
> To: 
> Sent: Saturday, May 02, 2009 1:25 AM
> Subject: [Csnd] pvsbuffer/pvsreadbuf for time stretching
> 
> 
>> I found Victor's cool "Developing Spectral Processing Applications" 
>> presentation[1], and would like to try using pvsbuffer/pvsbufread to 
>> to time stretching, but I don't know how to go about it.  More 
>> specifically, the paper says
>>
>> "With fsigs, it is possible to use a buffer to write and
>> then read (at different rates), to perform a (fake-)RT 
>> timestretching/compression[.]"
>>
>> But I have no idea how to change the read rate.  Can anyone help 
>> explain? I have working code similar to the following:
>>
>> asig soundin "somefile.wav"
>> fsig pvsanal asig, 1024, 256, 1024, 0
>> ihand, ktime pvsbuffer fsig, p3
>> fou pvsbufread ktime, ihand aout pvsynth fl
>>
>> So I'm guessing changing the read rate would involve changing ktime, 
>> but not sure.
>>
>> - Dave
>>
>> [1] 
>> http://music.nuim.ie/music/sites/cpaneltest.nuim.ie.music/files/documents/spectral-processing2.pdf 
>>
>>
>> -- 
>> ~DaveSeidel = [
>>   http://mysterybear.net,
>>   http://daveseidel.tumblr.com,
>>   http://twitter.com/DaveSeidel
>> ];

-- 
~DaveSeidel = [
   http://mysterybear.net,
   http://daveseidel.tumblr.com,
   http://twitter.com/DaveSeidel
];


Date2009-05-02 14:22
FromDave Seidel
Subject[Csnd] Re: Re: pvsbuffer/pvsreadbuf for time stretching
Thanks, David.  However, this produced a compilation error:

error:  illegal no of output args, line 140:
ihand   pvsbuffer       fsig, p3

Apparently (at least in Csound 5.10), it insists on using both return 
values for pvsbuffer.

Victor's suggestion of scaling the ktime value is working quite well:

ihand, ktime	pvsbuffer	fsig, p3
fsig2	pvsbufread	ktime*0.1, ihand

A combined approach also works:

ihand,ktime	pvsbuffer	fsig, p3
kfac   line        0, p3, 1
fsig2	pvsbufread	ktime*kfac, ihand				

Though in my particular case, I'm looking for a simple, unvarying 
scalar, so I'll probably stick with using a constant.  But it's great to 
understand the range of possibilities!

- Dave

David Mooney/Maxine Heller wrote:
> Try this:
> 
> ihand     pvsbuffer    fsig,ival
> ktime     line         0,ival,1
> fsig2     pvsbufread   ktime,ihand
> 
> ival is the desired end length time, the stretch time (may or may not be 
> p3). I don't find that this works well for complex time stretching 
> (stretching different parts of the original sound at different rates), 
> but for a simple stretch this works quite well.
> 
> --David
> 
> At 08:25 PM 5/1/2009, you wrote:
>> I found Victor's cool "Developing Spectral Processing Applications" 
>> presentation[1], and would like to try using pvsbuffer/pvsbufread to 
>> to time stretching, but I don't know how to go about it.  More 
>> specifically, the paper says
>>
>> "With fsigs, it is possible to use a buffer to write and
>> then read (at different rates), to perform a (fake-)RT 
>> timestretching/compression[.]"
>>
>> But I have no idea how to change the read rate.  Can anyone help 
>> explain?  I have working code similar to the following:
>>
>> asig            soundin         "somefile.wav"
>> fsig            pvsanal         asig, 1024, 256, 1024, 0
>> ihand, ktime    pvsbuffer       fsig, p3
>> fou             pvsbufread      ktime, ihand
>> aout            pvsynth         fl
>>
>> So I'm guessing changing the read rate would involve changing ktime, 
>> but not sure.
>>
>> - Dave
>>
>> [1] 
>> http://music.nuim.ie/music/sites/cpaneltest.nuim.ie.music/files/documents/spectral-processing2.pdf 
>>
>>
>> -- 
>> ~DaveSeidel = [
>>   http://mysterybear.net,
>>   http://daveseidel.tumblr.com,
>>   http://twitter.com/DaveSeidel
>> ];
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body 
>> "unsubscribe csound"
> 
> Maxine Heller: mheller@city-net.com
> David Mooney: dmooney@city-net.com
> www.city-net.com/~moko/
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound"
> 
> 

-- 
~DaveSeidel = [
   http://mysterybear.net,
   http://daveseidel.tumblr.com,
   http://twitter.com/DaveSeidel
];