views:

37

answers:

2

How can I slow down an audio file (for playback only) on Mac OS X, but preserve good quality? I tried using QTKit to slow down audio but the quality is bad.

Edit: I'm using this code:

QTMovie *audio = [[QTMovie alloc] initWithFile:mediaClipURL error:&error];
// ... (error handling)
[audio setRate:0.5];
A: 

The audio editor Audacity http://audacity.sourceforge.net/ has an effect that increases of decreases tempo without changing pitch, and is open source. So it might be good for some applicable code.

songdogtech
+1  A: 

As "songdogtech" guessed, I also suspect you want "speed adjustment without pitch bending." It's pretty straightforward to do without third-party code. You can set the QTMovieRateChangesPreservePitchAttribute attribute and just adjust the movie's rate:

QTMovie = [[QTMovie alloc] initWithURL:mediaClipURL error:nil];
if (movie)
{
    // Set preserve-pitch attribute
    [movie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieRateChangesPreservePitchAttribute];
    [movie setRate:0.5];
}
// ...

Note: The further away from 1.0 you are, the more distortion you're going to have. There's really no way around this. Samples will be repeated when going slow at the same pitch and samples will be cut very short when going fast at the same pitch. It's a fact of audio processing - the harder the effect, the more distortion you'll eventually have.

Joshua Nozzi
There may be some better time-streching effects available through third-party audio units (there's a fair industry based around doing it for samples) - but the principle still stands.
JulesLt