[mythtv] [PATCH] time stretch with libsoundtouch

Mark Spieth mark at dclabs.com.au
Tue Nov 2 12:01:29 UTC 2004

> Do you happen to know how much the audio can be warped with
> libsamplerate (without pitch correction) before people start to sound
> like chipmunks? (Or doing "whale" talk like in Finding Nemo.) I was
> wondering if I could get by without libsoundtouch (need to save some CPU
> cycles). I guess I'll have to do some experimenting...

sample rate conversion is something completely different to what you want.
this is used when the device in question doesnt support the sample rate of
the source stream.
if you have a 48000 samples/sec stream, then the max freq that can be
represented is half that (24kHz)
say the output device only supports 8k samps/sec, then you have to get rid
of 1 sample in 6 otherwise it cant cope in real time. but before you can do
this, you have to freq limit the signal to 4k.
upsampling is similar but different.
what you propose will always see a pitch shift. double the sampling rate of
the output device and play a file to it and it will sound fast and high
pitched by 1 octave. everything will happen at double speed. it will play
the file at twice the rate as normal. for a real time stream what you
propose, this means that the device will starve of data, or the video will
play twice as fast if linked. same for the half sample rate mode but you
will have too much data.
if you are looking for intelligibility, then you need an alternate algo such
as WSOLA among others. theres a good wiki on it. another open source project
called clear space aims to improve the quality of time scale modification
over WSOLA and similar algos.
I suggest you read up. It will give you ideas, just like it did me.

> BTW, my problem is not that I need to speed Stargate up, I need to slow
> them down to make it last longer. I'm jonesing pretty bad for a new
> episode but if I recall correctly there's no new SG-1 or Atlantis until
> January or so. :'(
yes I know but our FTA is a long way behind.
watching old ones
you can slow them down too. stretch factor of 0.8 or something like it

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 10/30/2004

More information about the mythtv-dev mailing list