[LAD] Paul's Extreme Sound Stretch

Robin Gareus robin at gareus.org
Thu Sep 30 10:47:40 UTC 2010


On 09/30/10 09:40, Patrick Shirkey wrote:
> 
> On Thu, September 30, 2010 12:01 am, Louigi Verona wrote:
>> Hey guys!
>>
>> I have two questions.
>>
>> 1. How does Sound Stretch work? It is incredible the way it can produce a
>> tone which has no noticeable vibrations, just a wall of sound. How is that
>> accomplished, in layman terms if possible :)
> 
> It grabs a section of the audio and copies/multiplies it then appears to
> apply some pretty neat math to smooth it all out funnily enough using a
> selection of windows to get the best result.

Are you sure? Where did you get that info from?

Just skimming over Stretch.cpp gives me the impression that it's based
on Fourier analysis and re-sythesis.
http://en.wikipedia.org/wiki/Fourier_analysis

The process() loop looks like:
{
  apply_window();
  smp2freq(); // Fourier Analysis
  process_spectrum();
  freq2smp(); // Fourier Synth
}

In layman terms:

There's a smart French guy by the name of Joseph F. sitting inside it:
If you play him some audio: He thinks: "Hey, this is actually just a few
simple sine-waves added together (superpositioned)", he quickly
calculates their frequencies and amplitudes and asks "Now, you want to
change the duration?" easy: "I'll generate some new sine-waves with
these frequencies and amplitudes, how long did you say you want?"

(The smart thing about this French guy is that he actually speaks fluent
English - Sorry I could not resist :)

> 
>> 2. Can this program be jackified and is that a lot of work?
>>
> 
> It uses portaudio. Doesn't that have a jack output?

Yes, but its implementation is not very well done.

> Otherwise yes, he has designed it so that adding jack support would be
> fairly trivial.
> 

Indeed, to change the integrated player to output to JACK would be
trivial. It currently uses the PortAudio's StreamCallback which is very
similar to JACK's process callback.

Using it to do "live" timestreching with JACK (jack-in -> jack-out) is
AFAICT impossible because:

<details>
If you feed it N samples (or seconds) of audio you end up with M samples
(or seconds) with  M > N.

One could do a kludge:
eg. for a 1:10 time stretch with continuous output:
  - read 1 sec of audio from the input
  - ignore 9 secs of the input
but I don't think this will be useful.
</details>

best,
robin



More information about the Linux-audio-dev mailing list