Rhythm

This module provides objects and methods that define and deal with time events.

The submodule is divided in:

  • Key: A tonic and mode (additionally it can have a chord progresison as attribute)

  • Chord Progression: A list of chords

  • Chord: List of 2 intervals (triad chords), 3 intervals (7ths), etc.

  • Interval: List of 2 notes.

Timing

Defines and contains helper functions to deal with Time Signatures, time events, etc.

TimingConsts(value)

This Enum contains the default values for timing parameters.

NoteLengths(value)

This Enum contains Note durations in fractions of the whole note.

ms_per_tick([bpm, resolution])

This function calculates the miliseconds that correspond to one tick.

_bar_str_to_tuple([time_sig])

This function converts the time signature str to a tuple of 2 values: numerator and denominator.

ticks_per_bar([time_sig, resolution])

This function calculates the ticks that correspond to one beat and bar.

ms_per_note([note_length, bpm, resolution])

This function calculates the miliseconds that correspond to one note.

get_subdivisions(total_bars, subdivision[, ...])

This method returns the grid (vertical lines) for quantizing notes of a determined number of measures given by total_bars.

TimeSignature(time_sig)

Quantizer

Quantizes symbolic music as it is done in Logic Pro by following the steps described in:

[1] https://www.fransabsil.nl/archpdf/advquant.pdf

QuantizerConfig([delta_qr, strength, type_q])

Basic quantizer arguments.

basic_quantizer(input_notes, grid[, bpm])

advanced_quantizer(input_notes, grid, config)

This function quantizes a musa object given a grid.

get_ticks_from_subdivision(subdivisions)

Extract the grid array in ticks from a subdivision

_find_nearest(array, value)

Find de array component value closest to a given value [3, 6, 9, 12] 5 --> 6