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.
I have not tested this solution but you can use pydub
from pydub import AudioSegment
song = AudioSegment.from_wav("test.wav")
song.export("testme.flac",format = "flac")
the conversion is supported with numerous file formats (see the ffmpeg supported file formats list herehttps://ffmpeg.org/general.html#Audio-Codecs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With