2

I love VLC's option of slowing down audio playback.

Now I want to take my mp3-files to a portable player and play them there. Unfortunately the player does not have a slow down option.

How can I convert mp3s so they sound like being played slowly using VLC?

I will prefer a command line tool, but will accept other free software tools for GNU/Linux.

2 Answers 2

8

I recommend using SoX like this:

sox <input> <output> tempo 0.5

This slows down <input>'s tempo by a factor of 2 and record the result to <output>.

You can add option --show-progress to display relevant information and progression percentage.

Note that if <input> is for instance normal.wav and <output> is half-tempo.ogg, SoX will detect the different audio encoding by itself (for more control on that part, read man sox).

The tempo algorithm should give similar results to VLC's scaletempo module. However you can try the alternative stretch algorithm:

sox <input> <output> stretch 2

The result is expected to be more synthetic (again, read man sox for details) and be aware that the parameter is the inverse of the one given to tempo (2 instead of 0.5 in this example).

SoX offers even more possibilities of time manipulation through speed, pitch and bend options that can be easily explored.

To install SoX using apt-get:

sudo apt-get install sox

To enable extra codecs (including MP3), add this library:

sudo apt-get install libsox-fmt-all

As a final note, I would come back to VLC since you can play your file slowed down from command line this way:

cvlc --rate 0.5 <input>

So there may be a way to ask VLC to save the result to some file, or to output audio to JACK and then use a JACK compatible recorder.

3
  • Good solution. Note: sox don't produce mp3's so I had to subsequently use lame to convert the .wav produced with sox into an .mp3.
    – Bru
    Dec 14, 2017 at 20:57
  • 1
    As explained above, it is possible to produce mp3's on Linux by enabling extra codecs. Dec 15, 2017 at 9:33
  • The results using these two methods with sox sound terrible. The tempo algorithm makes speech sound warbly and underwater. The stretch algorithm sounds extremely harsh and metallic.
    – user39248
    Mar 8, 2021 at 23:33
0

The following script does this using ffmpeg.

#!/bin/sh

# Usage:
#   slow_down.sh infile.mp3 outfile.mp3 0.75
#   Can't slow down more than by a factor of 0.5 (limitation of ffmpeg).

if [ $# -lt 3 ]; then
  echo 1>&2 "$0: not enough arguments"
  exit 2
fi

rm -f $2 temp.mp4
ffmpeg -i $1 -filter_complex "[0:a]atempo=$3[a]" -map "[a]"  -c:a aac temp.mp4
ffmpeg -i temp.mp4 -ar 48000 $2
rm -f temp.mp4

This could probably be simplified, but I wasn't able to figure out how to combine the two ffmpeg commands into one.

I found that the output of this method sounded much, much better than the results from the two algorithms provided by sox. To me it sounds about as good as the results of slowing down audio in the youtube interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.