How to drop tempo and maintain pitch on audio?

I need to work with some basic audio manipulation, basically I need to drop the tempo and maintaining the pitch, but I’m very audio illiterate, so I wonder if you can suggest / recommend an OF addon that could help me

Any help will be much appreciated!

This is actually pretty difficult to do (as far as I know, but I’m no audio expert). There’s a classic paper here that’s good to get a basic understanding: http://yehar.com/blog/?p=197

You could take a look at something like SoundTouch http://www.surina.net/soundtouch/index.html which I played with a little bit, but didn’t really understand (mostly b/c I don’t know much about DSP). There’s some code here that you can try out, but it’s going to give you some scratchy results: http://stackoverflow.com/questions/5156192/programmatically-increase-the-pitch-of-an-array-of-audio-samples

to be honest, I would avoid doing this in C++.

You can do it easily in MaxMSP if you buy an object called elastic~. For ten pounds. It wraps the Zplane time stretcher into a real-time object. I’ve been using it recently and it works nicely.

Other alternatives - synchronise Ableton Live. You could send MIDI to do this (from openFrameworks). MaxMSP yopu can sync using OSC. So both these options essentially use another program to do sound manipulation. And that’s mainly because of what Joshua pointed out - time stretching is pretty hard.

Andrew

second to the elastic for max, easy to use and great flexibility, and cheap.

If you are ok with low-quality results and a limited range (eg 80% to 120%) then a very simple method is possible:

higher quality timestretching is actually pretty hard and requires a lot of DSP. Read up on “phase vocoders with transient detection” if you’re into it - it gives the best result and is actually the kind of algorithm used in ableton live and elastic.

Finally, another option: use DIRAC’s library. Cross platform (even iOS!), high quality, easy to use, lots of samples. The free version only allows mono tracks only and cannot change the stretching factor at runtime. The paid version ofcourse can. http://dirac.dspdimension.com/Dirac3-Technology-Home-Page/Dirac3-Technology.html

Maximilian is an open source c++ library and has a granular time/pitch stretcher:

https://github.com/micknoise/Maximilian/
https://github.com/micknoise/Maximilian/blob/master/ofxMaxim/ofxMaxim/libs/maxiGrains.h
https://github.com/micknoise/Maximilian/blob/master/ofxMaxim/ofMaximExample007OSX-Granular/src/testApp.cpp

Parag

wow, awesome find pkmital, thanks!