A Python-based double metronome that plays different time signatures on the left and right audio channels.
- Plays two different time signatures simultaneously
- Each time signature plays on its own stereo channel (left or right)
- Visual representation of the metronome pattern
- Calculates when the pattern repeats (using LCM of time signatures)
- Audio feedback with different sounds for normal and accented beats
- True stereo output with separate left and right channels
- Clone or download this repository
- Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
./double_metronome.py LEFT_SIGNATURE RIGHT_SIGNATURE [OPTIONS]
LEFT_SIGNATURE
: Time signature for left channel (beats per measure)RIGHT_SIGNATURE
: Time signature for right channel (beats per measure)
--bpm BPM
: Tempo in beats per minute (default: 60)--duration DURATION
: Duration to play in seconds (default: 30)--accent-first
: Accent the first beat of each measure
# 4/4 on left, 3/4 on right at 80 BPM for 30 seconds with accented first beats
./double_metronome.py 4 3 --bpm 80 --duration 30 --accent-first
# 5/4 on left, 7/4 on right at 120 BPM
./double_metronome.py 5 7 --bpm 120
# 2/4 on left, 6/4 on right for 60 seconds
./double_metronome.py 2 6 --duration 60
The metronome displays a visual pattern before playing, showing exactly when each beat occurs in both time signatures. During playback, it indicates which channel is playing on each beat (LEFT, RIGHT, BOTH, or just a regular tick).
The script uses the sounddevice
and numpy
libraries to generate audio and play it through the appropriate stereo channels:
- Left time signature beats play only through the left speaker/headphone
- Right time signature beats play only through the right speaker/headphone
- When both time signatures have a beat at the same time, the sound plays through both channels
This creates a true stereo experience where you can physically hear the different time signatures separated in space.