Skip to main content

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
d.set_instrument('crash', 'crash1') # add a crash
# 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('crash', duration=10)

# 3 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', 'crash'], duration=2)

# add a eighth-note snare flam to the score
d.note('snare', duration=1/2, flam=1/16)
d.rest(['kick', 'hihat', 'crash'], 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', 'crash'], duration=1/2)

# crash and kick!
d.note('kick', duration=1/2)
d.note('crash', duration=1/2)
d.rest(['snare', 'hihat'], 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',
            'crash': '1000000000',
        },
        duration=1/2
    )

d.sync_parts() # make the parts play simultaneously

d.score.show() # or text, midi, etc. see music21 docs

Project details


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.4.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

music_drummer-0.2.4-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file music_drummer-0.2.4.tar.gz.

File metadata

  • Download URL: music_drummer-0.2.4.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for music_drummer-0.2.4.tar.gz
Algorithm Hash digest
SHA256 2a3a7f0adf8863af9ae03da356cd004aae97401f2a172468a8b35012dc5c0b62
MD5 1941a42fc3671127e1b282e7ff80d726
BLAKE2b-256 545a71e49ab132367d8f57219fa764c9a113999ceb52a12bf3a6c107607751a0

See more details on using hashes here.

File details

Details for the file music_drummer-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: music_drummer-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for music_drummer-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1df5e7e2234bcad08d34f6aad7e27a2a909b5b60616006e67ac9022475b64c04
MD5 05be83a8b200ba02fa29647f5686209f
BLAKE2b-256 538878fe096d70a932d57fc4f2586dd30d63cca61cf6628845a9d0ea4c6b1f10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page