Skip to main content

Generate musical basslines

Project description

Music Bassline-Generator

Generate musical basslines

DESCRIPTION

This class generates randomized basslines based on named chords.

The "formula" implemented by this module is basically: "Play any notes of the chord, modal chord scale, or chord-root scale (and drop any notes replaced by extended jazz chords)."

The chords recognized by this module, are those known to music21.

The logic and music theory implemented here, can generate some possibly sour notes. This is an approximate composition tool, and not a drop-in bass player! Import rendered MIDI into a DAW and alter notes until they sound suitable.

Named chords and the keycenter use # and b for accidentals.

To constrain the notes to a chosen set of scale degrees, use the positions attribute illustrated below.

The one and only public method in this class is generate(). Which generates n MIDI pitch numbers given a named chord. If next_chord is True, we perform an intersection of the two scales, and replace the final note of the generated phrase with a note of the intersection, if there are notes in common. If the modal attribute is set, then the chosen notes will be within the mode given the keycenter setting. If it is not set (the default), notes will be chosen as if the key has changed to the current chord.

SYNOPSIS

from music_bassline_generator import Bassline

bass = Bassline(
    keycenter='C', # tonic for modal accompaniment
    modal=False, # only choose notes within the mode
    chord_notes=True, # use chord notes outside the scale
    intervals=[-3, -2, -1, 1, 2, 3], # allowed voicegen intervals
    octave=1, # lowest MIDI octave
    tonic=False, # play the first scale note to start the generated phrase
    positions=None, # allowed notes for major and minor scales
    guitar=False, # transpose notes below E1 (midi #28) up an octave
    wrap=None, # transpose notes above this ISO named note, down an octave
    verbose=False, # show progress
)

bass = Bassline()
scale = bass.scale_fn('C7b5') # 'major'
scale = bass.scale_fn('Dm7b5') # 'minor'
scale = bass.scale_fn('D#/A#') # 'major'

bass = Bassline()
notes = bass.generate('C7b5', 4)
notes = bass.generate('D/A', 4)
notes = bass.generate('D', 4, 'C/G')
notes = bass.generate('D', 1)

bass = Bassline(modal=True)
mode = bass.scale_fn('C7b5') # 'ionian'
mode = bass.scale_fn('Dm7b5') # 'dorian'
notes = bass.generate('Dm7')
notes = bass.generate('Dm7b5')

bass = Bassline(
    octave=3,
    wrap='C3',
    modal=True,
)
notes = bass.generate('C', 4)

bass = Bassline(
    chord_notes=False,
    positions={'major': [x for x in range(6)], 'minor': [x for x in range(6)]} # no 7ths!
)
notes = bass.generate('C', 4)

MUSICAL EXAMPLES

# TODO

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_bassline_generator-0.1.4.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

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

music_bassline_generator-0.1.4-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file music_bassline_generator-0.1.4.tar.gz.

File metadata

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

File hashes

Hashes for music_bassline_generator-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a416678627f1d2d423583d3f492b63324dd27008fc2073a8d1c3682a1b5c308e
MD5 2e1f13eac0a16490bcdd72348c29459b
BLAKE2b-256 50fa65953247ee11b023bbf8d255303d67e53284323002b596c76c16bccd70a5

See more details on using hashes here.

File details

Details for the file music_bassline_generator-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for music_bassline_generator-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e6471a9b13ae7990345a5b18d0191d6d4ac9c852f45c5b4b221ea9981d98b7f4
MD5 1d8db20efa5d2034629d10d7900f7e7d
BLAKE2b-256 c65e7dd2c9c98ef0c5634b741106d01af029a429bb1c4d09f5bda6e7fb5342b1

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