This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires pydub (with ffmpeg) and Pillow | |
# | |
# Usage: python waveform.py <audio_file> | |
import sys | |
from pydub import AudioSegment | |
from PIL import Image, ImageDraw | |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!