Author |
Message |
Acoustic Interloper
Joined: Jul 07, 2007 Posts: 2067 Location: Berks County, PA
Audio files: 89
|
Posted: Wed Jul 18, 2007 9:11 am Post subject:
Slowing the playback rate on a real-time audio stream? Subject description: Can ChucK duplicate two incrementally desynced tapes in real time? |
|
|
Basically, I'd like to run a simple experiment emulating Steve Reich's and others' use of two tape recorders playing back sampled rate audio on one channel and slightly slowed audio on another, except that rather than capturing a full stream to a file, I'd like to do it on a live, incoming audio stream. Obviously you couldn't speed up the stream. And obviously you'd be doing a lot of buffering, presumably to disk at some point.
If you were dealing with an existing file, this would be the .rate parameter on WvIn. WvIn's doc says 'It also serves as a base class for "realtime" streaming subclasses.' Is there a subclass that'll do rate reduction like this for real-time streams?
Also, a desynced tape would do pitch reduction. It would be nice to have flavors of real-time slowing tempo both with & without pitch reduction.
Thanks in advance. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Wed Jul 18, 2007 9:50 am Post subject:
|
|
|
I think the most obvious and straightforward solution would be using LiSa. LiSa (Live Sampling) is new and not in the manual yet but it has excelent and in-depth documentation is several example files that come with the download.
As for the pitch corection; you could use a granular strategy using LiSa with several voices but it might also be enough to simply play a single voice at a slower rate and compensate using the pitch-shift Ugen that's in the STK. That one is covered in the manual and quite simple to use.
Code-wise this needn't be hard but obviously for longer pieces you'd need to alocate a large buffer which will cost RAM. On modern systems that shouldn't be a issue but you never know what happens if you push ChucK to extremes in a certain direction for the first time; I'm not sure exactly how long you plan your piece to be. You might be able to get away with a looped buffer but then you need to deal with the (fast) write pointer at some point overtaking the (slow) read pointer.
Anyway, sounds quite feasable to me, even in realtime using the soundcard input and live controll. _________________ Kassen |
|
Back to top
|
|
|
kijjaz
Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Thu Jul 19, 2007 5:57 pm Post subject:
|
|
|
Hmmm.. I'll try something like that soon.. with DelayA perhaps.
But it might need quite a big initial maximum delay.
Take care. |
|
Back to top
|
|
|
Acoustic Interloper
Joined: Jul 07, 2007 Posts: 2067 Location: Berks County, PA
Audio files: 89
|
Posted: Thu Jul 19, 2007 6:12 pm Post subject:
|
|
|
I was wondering whether I could even get away with opening a file twice within ChucK, initially for writing (empty) and then also for reading at a lower .rate, and incrementally write a copy of the input stream to the file for stretching.
What I really need is a way to stretch *my* time. If I could expand my time without slowing my coding frequency, I could work on this. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Fri Jul 20, 2007 4:42 am Post subject:
|
|
|
Acoustic Interloper wrote: | I was wondering whether I could even get away with opening a file twice within ChucK, initially for writing (empty) and then also for reading at a lower .rate, and incrementally write a copy of the input stream to the file for stretching. |
Hmmmm. I don't think that right now the file in-out is going to allow that. The only difference between the strategy I sugested (or Kijjaz's delay) is realy that one deals with a buffer in ram and the other uses a file.
At the moment files will need to be closed before anything can be done with them and on top of that I seem to remember there are some bugs there.
Quote: | What I really need is a way to stretch *my* time. If I could expand my time without slowing my coding frequency, I could work on this. |
:¬) _________________ Kassen |
|
Back to top
|
|
|
kijjaz
Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Sat Jul 21, 2007 2:39 am Post subject:
|
|
|
Acoustic Interloper: I was wondering whether I could even get away with opening a file twice within ChucK, initially for writing (empty) and then also for reading at a lower .rate, and incrementally write a copy of the input stream to the file for stretching.
kijjaz: Ohhh! by this, I recommend playing with LiSa first.
I did something that's quite the same with your idea with LiSa.
It's by chucking one LiSa output back into the input of the same LiSa.
and use "record" while it's playing back.
That'd give something somewhat like what you want.
THe sound quality is great also.
- - -
oh more about this.
DelayA should not work easily in this situation -_-"
better use LiSa -_-" |
|
Back to top
|
|
|
Acoustic Interloper
Joined: Jul 07, 2007 Posts: 2067 Location: Berks County, PA
Audio files: 89
|
Posted: Sat Jul 21, 2007 5:28 am Post subject:
|
|
|
kijjaz wrote: |
kijjaz: Ohhh! by this, I recommend playing with LiSa first.
I did something that's quite the same with your idea with LiSa.
It's by chucking one LiSa output back into the input of the same LiSa.
and use "record" while it's playing back.
That'd give something somewhat like what you want.
THe sound quality is great also.
|
Thanks for trying this out and letting me know! I hope to spend some time this weekend getting to know LiSa.
Take care. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
|
kijjaz
Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Sat Jul 21, 2007 6:36 am Post subject:
|
|
|
I'm also new to LiSa.. I'm not good with girls, ya know hmmm...
(practicing more on that!)
I've only been changing the LiSa in chuck's examples/special
Changing the original input..
change the sequence of chucking..
add additional .record events..
and play with the rate.
That'd start to work for your requirement. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sat Jul 21, 2007 6:47 am Post subject:
|
|
|
I tried to figure out a good way of using two copies of LiSa but there is a issue. At tome point the slow playback will lag a minute after realtime and there is realy no way around having a buffer of a minute long at that point that I can see.
On the bright side; a minute of cd quality audio in mono is only 5 MB or so and there is a limit to how long the difference between the two tracks can be and still be interesting. I think it would do to simply do it the stupid brute-force way, allocate a reasonably large buffer, admit that it will run out at some point and have a button to reset the whole thing to use at the beginning of songs.
For the pitch corection I'd simply use the pitch-shifter unless some algorithem can be concockted to do it with grains in LiSa while taking advantage of knowing what the input will be like and trying to make single plucks into single grains. _________________ Kassen |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sat Jul 21, 2007 6:52 am Post subject:
|
|
|
kijjaz wrote: | I'm also new to LiSa.. I'm not good with girls, ya know hmmm...
(practicing more on that!)
|
We're all new to LiSa, she's only been with us for a short while! LiSa is cool, not in the least because she has one of the best names of all the Ugens.
Anyway, you should be good with girls; you have the best one-liners of the whole ChucK scene!
;¬) _________________ Kassen |
|
Back to top
|
|
|
Acoustic Interloper
Joined: Jul 07, 2007 Posts: 2067 Location: Berks County, PA
Audio files: 89
|
Posted: Sat Jul 21, 2007 8:15 am Post subject:
|
|
|
Kassen wrote: |
On the bright side; a minute of cd quality audio in mono is only 5 MB or so and there is a limit to how long the difference between the two tracks can be and still be interesting. I think it would do to simply do it the stupid brute-force way, allocate a reasonably large buffer, admit that it will run out at some point and have a button to reset the whole thing to use at the beginning of songs.
|
Some of the minimalist approaches slide the slowed stream through increasing delays until you get some multiple of a 'measure' (however you measure it) where the accents line up, so that would be a good place to kill a 'verse' and start a new one. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
|
|