I've just started using Python and am using the PyAudio
and Wave
modules to take sound from my microphone and convert it to a .wav
file.
What I'm trying to do is now convert that .wav
to a .flac
. I've seen a few ways to do this which all involve installing a converter and placing it in my environmental PATH and calling it via os.system
.
Are there any other ways to convert a .wav
to a .flac
via Python? The solution I'm looking for needs to work on both Windows and Linux.
May be you're looking for Python Audio Tools.
It seems PAT can do whatever you want.
I have not tested this solution but you can use pydub
the conversion is supported with numerous file formats (see the ffmpeg supported file formats list herehttps://ffmpeg.org/general.html#Audio-Codecs
Here is a code example using the Python library Python Audio Tools to convert a
.wav
file to a.flac
file:To install Python Audio Tools: http://audiotools.sourceforge.net/install.html
https://wiki.python.org/moin/Audio/ (mirror) attempts to list all useful Python libraries to work with audio in combination with Python.
A longer Python script to multithreadedly batch convert wav files to FLAC files, from http://magento4newbies.blogspot.com/2014/11/converting-wav-files-to-flac-with.html