Skip to content

Instantly share code, notes, and snippets.

@vr000m
Created September 24, 2012 16:53
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vr000m/3776984 to your computer and use it in GitHub Desktop.
Save vr000m/3776984 to your computer and use it in GitHub Desktop.
Converting MP3 to PCM A-law

There are many ways to do this, you can use:

  • FFMpeg
  • Gstreamer
  • lame
  • MPG123
  • Sox
  • Mplayer

Here is one example: Converting sample.mp3 to 8KHz sample rate PCM/16 file.

$ mplayer -af resample=8000,channel=1 -ao pcm:waveheader:file="filename.wav" sample.mp3

Then use SOX to convert PCM/16 to PCM A-law

$ sox filname.wav -e a-law filename_alaw.wav

Now you can use filename_alaw.wav for streaming.

@kiquenet
Copy link

how-to convert mp3, m4a or aac file to wav A-Law, 8000Hz, 64kbps, mono?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment