scamp_extensions.pitch package

Subpackage containing pitch-related extensions. These include abstractions for intervals and scales, as well as utilities for unit conversions.

Modules:

chord_builder

Module containing functions for voicing a chord: given a set of pitch classes and a range to place them in, these search the possible voicings and return whichever one best fits the preferences given, such as being compactly spaced or centered in the range.

scale

Module containing classes for flexibly representing musical scales.

utilities

Module containing pitch-related utility functions, such as those that convert between midi and hertz.

Public-Facing API (result of import *):

PitchInterval(cents, ratio)

Represents an interval between two pitches.

Scale(scale_type, start_pitch[, cycle])

Class representing a scale starting on a specific pitch.

ScaleType(*intervals)

A ScaleType represents the intervallic relationships in a scale without specifying a specific starting point.

bark_to_freq(b)

Converts a Bark number to its corresponding frequency in hertz.

cents_to_ratio(cents)

Given a number of cents, convert it to a corresponding frequency ratio.

freq_to_bark(f)

Converts a frequency in hertz to a (floating point) Bark number according to the psychoacoustic Bark scale (https://en.wikipedia.org/wiki/Bark_scale).

hertz_to_midi(hertz_value[, A])

Given a frequency in hertz, returns the corresponding (floating point) MIDI pitch.

map_keyboard_to_microtonal_pitches(...[, ...])

Given a list of microtonal (floating-point) MIDI pitches, finds an efficient map from keyboard-friendly (integer) pitches to the original microtonal pitches.

midi_to_hertz(midi_value[, A])

Given a MIDI pitch, returns the corresponding frequency in hertz.

ratio_to_cents(ratio)

Given a frequency ratio, convert it to a corresponding number of cents.