Skip to content

Instantly share code, notes, and snippets.

@rah003
Created December 8, 2019 15:02
Show Gist options
  • Save rah003/ed136ecda2985b5d8a6dc3691201e9a2 to your computer and use it in GitHub Desktop.
Save rah003/ed136ecda2985b5d8a6dc3691201e9a2 to your computer and use it in GitHub Desktop.
import os
from pydub import AudioSegment
# main body
folder_path = "audio-samples"
for filename in os.listdir(folder_path):
sound = AudioSegment.from_wav(os.path.join(folder_path,filename))
sound = sound.set_channels(1)
sound.export(os.path.join(folder_path+ "-mono","mono_"+filename), format="wav", bitrate="16k")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment