Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to speed up music playing in real-time in android without changing the pitch?

Tags:

android

audio

I need to be able to play an MP3 file at difference speeds without it affecting the pitch (or changing the pitch after speeding up, whatever), Also, this transition needs to be as seamless as possible.

Obviously there are apps that do this so it is possible, but it seems not to be possible with the MediaPlayer API, and the SoundPool API can only change both pitch and rate (unless I am missing something).

Any idea on how to achieve this? Any API / 3rd party libraries that could help?

Thanks.

like image 749
Gal Avatar asked Feb 15 '13 10:02

Gal


1 Answers

There is a general technique called Time Scale Modification that can do this. Here's a tool available that I haven't evaluated: http://sourceforge.net/projects/mffmtimescale/.

If you zoom in on a time line of audio, it looks a lot like an old heartbeat monitor--a wiggly patterns of peaks and valleys. For vowels the pattern is quasi-stationary, which roughly means it's repetitive, like a healthy heartbeat pulse. A single ahhhh vowel sound may repeat its pattern 3-7 times in normal speech. A TSM algorithm deletes some of those repetitions, and needs to use a filter to introduce artifacts by clipping/joining imperfect repetitions. Empty spaces can be reduced as well, but care needs to be taken to not delete all empty space--in English the word "football" actually has a gap between "foot" and "ball" (say it slowly out loud). TSM can also do the reverse, pumping in empty space at the rights spots or adding pitch period repetitions to vowels. This all adds up to something fairly complex and somewhat language dependent that requires a lot of tuning--which for most applications means you won't want to develop your own.

like image 165
jimm101 Avatar answered Nov 18 '22 19:11

jimm101