Skip to content

Instantly share code, notes, and snippets.

@batoreh
Created May 25, 2017 00:48
Show Gist options
  • Save batoreh/e39ac0abf75ffee2e5696ce7afb4ec9f to your computer and use it in GitHub Desktop.
Save batoreh/e39ac0abf75ffee2e5696ce7afb4ec9f to your computer and use it in GitHub Desktop.
from os import listdir, getcwd
from pydub import AudioSegment
import re
def reverse_audio_files(audio_file):
audio = AudioSegment.from_wav(audio_file)
return audio.reverse()
cwd = getcwd()
dirlist = listdir(cwd);
wav_files = map(reverse_audio_files, filter(lambda file: file.endswith('.wav'), dirlist))
for index, audio in enumerate(wav_files):
audio.export('exported %s.mp3' % index, format="mp3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment