Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What is a good way to convert mp3 files to speex files? I'll favor answers that give an easy solution for converting multiple files at a time and/or maintain good quality for spoken audio. Though any solution will be appreciated since I haven't found even a difficult way that works.

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

Example for processing all mp3 files in current folder to speex using wide band (input rate converted to 16KHz with best SRC available - SoX):

for f in *.mp3 ; do sox "$f" -r 16k -t wav - | speexenc -w - "${f%.*}.speex" ; done

Depending on preferences change speex option and/or SoX rate converter to appropriate setting. For spoken audio example wide band should be fine

share|improve this answer
    
I also needed to install sox (obvious) and also libsox-fmt-all (not so obvious). Though libsox-fmt-mp3 would probably have covered it in this case. –  Rob Mosher Nov 11 '11 at 12:45
1  
Yes, I presumed that SoX is present, like anywhere someone is doing something with audio, other than listening. I don't know what's the purpose of your task, but you may be interested also in OPUS (former Celt) by known developers: celt-codec.org Listening tests outperformed everything available (Vorbis aoTuV, Apple HE AAC, ...) people.xiph.org/~greg/opus/ha2011 although bitstream is not frozen yet, it's generally available to public –  zetah Nov 11 '11 at 13:34
    
It should be noted that the speex files produced by this command line will retain none of the metadata from the mp3 files. –  Christian Mar 22 at 4:54
add comment

Although Opus is a better option these days you can use FFmpeg (if configured with --enable-speex):

for f in *.mp3
  do 
  ffmpeg -i "$f" -ar 32000 -q:a 10 "${f%.mp3}.spx"
done

This produced quite reasonable audio on my setup....

share|improve this answer
add comment

You can use ffmpeg:

lame filename.mp3 filename.wav
ffmpeg -i  filename.wav filename.spx

Source: http://paramitech.com/convert-speex-file-into-mp3/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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