Skip to content

Instantly share code, notes, and snippets.

@AIAnytime
Last active July 17, 2022 04:08
Show Gist options
  • Save AIAnytime/18a7ec0e9e0651c5d744f94379f00f9b to your computer and use it in GitHub Desktop.
Save AIAnytime/18a7ec0e9e0651c5d744f94379f00f9b to your computer and use it in GitHub Desktop.
Python provides a pydub module that enables you to play, split, merge, and edit WAV audio files. This is how you can use it to convert a stereo WAV file to a mono file.
from pydub import AudioSegment
mysound = AudioSegment.from_wav("stereo_infile.wav")
# set mono channel
mysound = mysound.set_channels(1)
# save the result
mysound.export("mono_outfile.wav", format="wav") It was originally published on https://www.apriorit.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment