Skip to content

Instantly share code, notes, and snippets.

@diewland
Last active February 5, 2023 10:37
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diewland/bff7e7a07035747df0d3a8b6c464e75c to your computer and use it in GitHub Desktop.
Save diewland/bff7e7a07035747df0d3a8b6c464e75c to your computer and use it in GitHub Desktop.
convert wav to flac from python
from os.path import splitext
from pydub import AudioSegment
def wav2flac(wav_path):
flac_path = "%s.flac" % splitext(wav_path)[0]
song = AudioSegment.from_wav(wav_path)
song.export(flac_path, format = "flac")
if __name__ == "__main__":
import sys
wav2flac(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment