26 December 2014

Modifying the speed (or tempo) of an mp3 file (in Linux)


My problem: I have an audio book and the guy speaks too fast. I can understand everything he says, but it's too fast to assimilate it well.

Solution: Change audio player or change the mp3 file. I am taking the second route.


After some research and testing, I found a very easy way, that works without much trouble (at least on my computer). I use Debian Linux.



This will play the file slower (0.8) or faster (1.2), but the pitch will be altered too (not nice)

# mplayer  -speed 0.8   Book.mp3


With this the pitch will be fixed

# mplayer -af scaletempo -speed 0.8   Book.mp3


And now we can save the output sound

# mplayer -af scaletempo -speed 0.8   Book.mp3   -vo null -ao pcm:file=fileout.wav


To then convert to mp3 (this will create fileout.mp3)

# lame fileout.wav     


You can concatenate both commands with

cmd1 && cmd2



In the process I believe I installed the package "tap-plugins" (in Debian).

I also tried to use rubberband, but no matter the file, I got this error.

rubberband --time 1.2 f1.mp3 f1x.mp3
Using crispness level: 5 (Crisp monophonic instrumental)
ERROR: Failed to open input file "f1.mp3": File contains data in an unknown format.


Disclaimer:
- I am not music-literate, so excuse mistakes regarding to musical concepts. But I am happy to be corrected.
- I am not mplayer expert, so if there is a better way to do this, please share it and I will update the post.


Too Cool for Internet Explorer