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.
how-to convert mp3, m4a or aac file to wav A-Law, 8000Hz, 64kbps, mono?