Skip to content

Instantly share code, notes, and snippets.

@srikarg
Created March 20, 2015 23:00
Show Gist options
  • Save srikarg/7bf2862f83096a36d394 to your computer and use it in GitHub Desktop.
Save srikarg/7bf2862f83096a36d394 to your computer and use it in GitHub Desktop.
This is an example of combining a folder of songs into one mp3 file using pydub (http://pydub.com/).
import os
from glob import glob
from pydub import AudioSegment
AudioSegment.converter = '/usr/local/bin/ffmpeg'
playlist_songs = [AudioSegment.from_mp3(file) for file in glob('songs/*.mp3')]
combined = AudioSegment.empty()
for song in playlist_songs:
combined += song
combined.export('combined.mp3', format='mp3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment