music.pitch_to_freq

music.pitch_to_freq(start_freq=220.0, semitones=(0, 7, 7, 4, 7, 0))[source]

Generates a list of frequencies based on a list of semitones and a starting frequency.

This function calculates a list of frequencies based on the given list of semitones and a starting frequency. Each semitone value represents the number of semitones above or below the starting frequency.

Parameters:
start_freqfloat, optional

The starting frequency in Hertz, by default 220.

semitoneslist, optional

The list of semitone offsets relative to the starting frequency, by default [0, 7, 7, 4, 7, 0].

Returns:
list

A list of frequencies calculated from the given semitones and starting frequency.

Parameters:
Return type:

list[float]

Examples

>>> pitch_to_freq()  # Default semitones [0, 7, 7, 4, 7, 0]
[220.0, 493.8833012561241, 493.8833012561241, 329.62755691286986,
 493.8833012561241, 220.0]
>>> pitch_to_freq(start_freq=440, semitones=[0, 12, 12, 12])
[440.0, 880.0, 880.0, 880.0]