Skip to main content

Glorified Metronome

Project description

python-music-drummer

Glorified Metronome

The methods of this package depend upon music21.

SYNOPSIS

from music_drummer import Drummer
from music21 import instrument

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()) # for the 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)

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

# crash and kick!
d.note('kick', duration=1/2)
d.note('crash', duration=1/2)
d.rest('snare', duration=1/2)
d.rest('hihat', duration=1/2)

# add an eighth-note phrase of 3 parts, to the score
for _ in range(4):
    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.1.13.tar.gz (55.0 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.1.13-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: music_drummer-0.1.13.tar.gz
  • Upload date:
  • Size: 55.0 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.1.13.tar.gz
Algorithm Hash digest
SHA256 eedbb5549c5a40b5aa6d1c8ba156a470bf1c503bbbed31c33afd17c91c9c42d3
MD5 08fc5a346c36c7ddb8eb641ed2a516f6
BLAKE2b-256 e343ba49335f89a05304c958fe9e05955dd614ee7e8ac9655848f67bbfd7719c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: music_drummer-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 46.5 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.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 c09f89b1f20fa958f71e35f347384ee0bb923ddd4e07a95447851001c6a334bf
MD5 6f45218206aaa2d4d130f8ad37179d4b
BLAKE2b-256 ec36030f1ace8b1629f9d9710f4ab1075c7a9144f4dbede655d4ac30158e8a11

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