Python convert wav to mp3

I've looked at pymedia (discontinued), pyglet(great but no converter in there) and audiotools(command line cd ripping), and none seem suitable.

In Python 2.7 , how do you do

convert(wavFileLocation, 'mp3')

If there is no python way, how would you do it in a manner which python can invoke? (e.g. Call a Cross platform command line tool... if exists return (name, pythonCodeForInvocation) )


  • using lame (command line), you can encode wav to mp3 like this:

    $ lame --preset insane /path/to/file.wav

    which would create:


    in Python, you could use subprocess to call it:

    wav = 'myfile.wav'
    cmd = 'lame --preset insane %s' % wav, shell=True)