Skip to main content

Partition a musical duration into rhythmic phrases

Project description

Random Rhythms in Python!

Partition a musical duration into rhythmic phrases.

Usage:

  1. Determine the pool of durations to use in your rhythmic phrase:
128th to 128: .03125 .0625 .125 .25 .5 1 2 4 8 16 32 64 128
# durations = [ 2**x for x in range(-5, 8) ]
16th to 16th: .25 .5 1 2 4 8 16
# durations = [ 2**x for x in range(-2, 5) ]
Triplets: .167 .333 .667 1.333 2.667
# durations = [ 2**x/3 for x in range(-1, 4) ]
Dotted: .375 .75 1.5 3 6
# durations = [ 2**x+2**x/2 for x in range(-2, 3) ]
Double dotted: .4375 .875 1.75 3.5 7
# durations = [ 2**x+2**x/2+2**x/4 for x in range(-2, 3) ]
  1. Import the class:
from random_rhythms import Rhythm
  1. Instantiate a random-rhythm object:
params = { # these are the defaults:
    time_signature: '4/4',
    measure_size: 4,
    durations: [ 1/4, 1/2, 1/3, 1, 3/2, 2 ],
    weights: [ 1, 1, 1, 1, 1, 1 ],
    groups: { 1/3: 3 },
    smallest: 1/128
}
rr = Rhythm(**params)
  1. Get a motif:
motif = rr.motif()
print(motif)

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

random_rhythms-0.1.1.tar.gz (40.5 kB view details)

Uploaded Source

Built Distribution

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

random_rhythms-0.1.1-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file random_rhythms-0.1.1.tar.gz.

File metadata

  • Download URL: random_rhythms-0.1.1.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for random_rhythms-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e05916c2e9d5613298911bf99fe847d961ec0975707e3b34c81d124bba9ae5ec
MD5 972e035ca48c1c4159ff659b7f844459
BLAKE2b-256 92ec109d5fce6f0bb4bedc79f8adb8b51324a40735a99037bdbfbeacc60baeec

See more details on using hashes here.

File details

Details for the file random_rhythms-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: random_rhythms-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for random_rhythms-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d6c6d44f4cc82de1dd834e8b864363ef30bf660bbb29e4080d9a9b7b99f69984
MD5 655fa08a50a0e07044d6cde0effabe15
BLAKE2b-256 2e8a658ada6ecf22ccda0d789e1ed5149e41c78fd3e9e695d4087e0c23c2ecd8

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