### How to convert some WAVe files to u-law, a-law or gsm on Linux? ###
       
       
       Many VoIP solutions (like Asterisk) are using the u-law, a-law or gsm sound format to store and play audio. To convert any wave file to one of these formats, you can use a very handy tool, called sox.
       
       Here are some examples:
        * Converting a WAVe file to u-law
         sox filein.wav -r 8000 -t ul -U -c 1 fileout.ulaw
       
        * Converting a WAVe file to a-law
         sox filein.wav -r 8000 -t al -A -c 1 fileout.alaw
       
        * Converting a WAVe file to gsm
         sox filein.wav -r 8000 -t gsm -g -c 1 fileout.gsm
       
       What does these option mean?
        filein.wav - the input file
        -r 8000 - resampling the input file to 8 KHz
        -t xx - setting output format to xx (ul, al, gsm)
        -U - setting the output encoding to U-law
        -A - setting the output encoding to A-law
        -g - setting the output encoding to gsm
        -c 1 - only one channel (mono)
        fileout.xxx - the output file
       
       Now, what if you don't have one or two such files to convert, but THOUSANDS? No problem, just use a "for" loop!
       
        for myfiles in *.wav ; do sox $myfiles -r 8000 -t ul -U -c 1 `basename $myfiles .wav`.ulaw ; done
       
       Note, that I also used basename here to write new files without their old ".wav" extensions.