scamp_extensions.pitch package

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



Module containing classes for flexibly representing musical scales.


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.


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


Converts a Bark number to its corresponding frequency in hertz.


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


Converts a frequency in hertz to a (floating point) Bark number according to the psychoacoustic 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.


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