Glorified Metronome
Project description
Music Drummer
Glorified Metronome
The methods of this package depend upon music21.
For this package (and music21 too), a duration of 1 is a
quarter-note. So, 1/2 would be an eighth-note, etc.
SYNOPSIS
from music_drummer import Drummer
# Ex 1 - basic 4/4 metronome groove:
d = Drummer()
d.set_bpm(60) # set the beats per minute
d.set_ts() # set the default time signature of 4/4
# add a 16-beat phrase for 64 measures
for _ in range(64):
d.pattern(
patterns={
'kick': '1000000010000000',
'snare': '0000100000001000',
'hihat': '1010101010101010',
},
)
d.sync_parts() # make the parts play simultaneously
d.score.show('midi') # or nothing, text, etc. see music21 docs
# Ex 2 - 5/8 groove with intro:
d = Drummer()
d.set_instrument('kick', 'kick2') # change to the electric kick
d.set_instrument('snare', 'snare2') # change to the electric snare
# print(d.instrument_map()) # full list of known instruments
d.set_bpm(99) # change the beats per minute from 120
d.set_ts('5/8') # change the time signature from 4/4
d.count_in(2) # count-in on the hi-hats for 2 measures
d.rest('kick', duration=10)
d.rest('snare', duration=10)
d.rest('cymbals', duration=10)
d.rest('toms', duration=10)
# 3 known hi-hat states: closed, open, pedal
d.note('closed', duration=1/2)
d.note('open', duration=1/2)
d.note('pedal', duration=1/2)
d.note('closed', duration=1/2)
d.rest(['snare', 'kick', 'cymbals', 'toms'], duration=2)
# 7 known cymbals:
d.note('crash1', duration=1/2)
d.note('crash2', duration=1/2)
d.note('china', duration=1/2)
d.note('splash', duration=1/2)
d.note('ride1', duration=1/2)
d.note('ride2', duration=1/2)
d.note('ridebell', duration=1/2)
d.rest(['kick', 'snare', 'hihat', 'toms'], duration=3.5)
# 6 known toms:
d.note('tom1', duration=1/3)
d.note('tom2', duration=1/3)
d.note('tom3', duration=1/3)
d.note('tom4', duration=1/3)
d.note('tom5', duration=1/3)
d.note('tom6', duration=1/3)
d.rest(['kick', 'snare', 'hihat', 'cymbals'], duration=2)
# add a eighth-note snare flam to the score
d.note('snare', duration=1/2, flam=1/16)
d.rest(['kick', 'hihat', 'cymbals', 'toms'], duration=1/2)
# add a 5-note snare roll for an eighth-note, increasing in volume
d.roll('snare', duration=1/2, subdivisions=5, crescendo=[100, 127])
d.rest(['kick', 'hihat', 'cymbals', 'toms'], duration=1/2)
# crash and kick!
d.note('kick', duration=1/2)
d.note('crash1', duration=1/2)
d.rest(['snare', 'hihat', 'toms'], duration=1/2)
# add a 4-part, 4-bar, eighth-note phrase to the score
for _ in range(8):
d.pattern(
patterns={
'kick': '1000000010',
'snare': '0000001000',
'hihat': '0111111111',
'crash1': '1000000000',
},
duration=1/2
)
d.sync_parts() # make the parts play simultaneously
d.score.show() # or text, midi, etc. see music21 docs
# or
d.score.write(filename='drums.mid')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
music_drummer-0.2.12.tar.gz
(43.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file music_drummer-0.2.12.tar.gz.
File metadata
- Download URL: music_drummer-0.2.12.tar.gz
- Upload date:
- Size: 43.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42b6ee507471f179af1f61e6a1a72b0357fdb14082789822d37291d81a20e018
|
|
| MD5 |
4c050fce94e284377ddd8fc80845ef1a
|
|
| BLAKE2b-256 |
20ae851e5867cf783a4f433d7af0ca541552f0b90e748af1e91e42358ed88104
|
File details
Details for the file music_drummer-0.2.12-py3-none-any.whl.
File metadata
- Download URL: music_drummer-0.2.12-py3-none-any.whl
- Upload date:
- Size: 29.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c2ccfc0d2a185581c0033bb0ce4d128406b7ac86eb6ca074c408a8e9a6b7db1
|
|
| MD5 |
d134ee36d9b73b4c9c284069e58a222f
|
|
| BLAKE2b-256 |
b122d0b30e9eb893ec3bb86e8d7533e33743643dc6b0af1e14d5343669b62a8a
|