parker.notes

notes.is_valid_note(note)

Determine if a note is valid from a given string representation.

notes.note_from_frequency(freq)

Return the closest note given a frequency value in Hz

This uses the forumula f = f0 * (a ** n)

f0 - the reference frequency, which is A4 at 440 Hz a - the twelth root of 2, or 2 ** (1/12) n - the number of half steps between notes

Here we want the value of n, or the integer value of half steps distance from the reference note.

n = log(f / f0) / log(a)

This does not take into account out of tune notes. In the future it might make sense to return the cents above or below the note.

class parker.notes.Accidental(acc='')[source]
alter
name
set_augment()[source]
set_diminish()[source]
set_from_num(alter)[source]
set_from_str(acc)[source]
class parker.notes.Note(note=None, use_sharps=True)[source]

Representation of a single note.

accidentals
all_transpositions()

Create all available named transpositions

augment()
augmented_eleventh_down()
augmented_eleventh_up()
augmented_ninth_down()
augmented_ninth_up()
base_name
clone()
compound_augmented_fourth_down()
compound_augmented_fourth_up()
compound_augmented_second_down()
compound_augmented_second_up()
compound_major_second_down()
compound_major_second_up()
compound_major_sixth_down()
compound_major_sixth_up()
compound_major_third_down()
compound_major_third_up()
compound_minor_second_down()
compound_minor_second_up()
compound_minor_sixth_down()
compound_minor_sixth_up()
compound_minor_third_down()
compound_minor_third_up()
compound_perfect_fourth_down()
compound_perfect_fourth_up()
diminish()
generalize()[source]

Return the note without the octave component.

Example:
C4 -> C Cbb4 -> Cbb C###4 -> C###
get_frequency(ndigits=None)[source]

Return the frequency of the note.

This uses the forumula f = f0 * (a ** n)

f0 - the reference frequency, which is A4 at 440 Hz a - the twelth root of 2, or 2 ** (1/12) n - the number of half steps between notes

Should rounding be required you can set the number of digits to round to in the method.

Reference:
major_eleventh_down()
major_eleventh_up()
major_fifth_down()
major_fifth_up()
major_fourth_down()
major_fourth_up()
major_ninth_down()
major_ninth_up()
major_second_down()
major_second_up()
major_seventh_down()
major_seventh_up()
major_sixth_down()
major_sixth_up()
major_tenth_down()
major_tenth_up()
major_third_down()
major_third_up()
major_thirteenth_down()
major_thirteenth_up()
minor_fifth_down()
minor_fifth_up()
minor_ninth_down()
minor_ninth_up()
minor_second_down()
minor_second_up()
minor_seventh_down()
minor_seventh_up()
minor_sixth_down()
minor_sixth_up()
minor_tenth_down()
minor_tenth_up()
minor_third_down()
minor_third_up()
minor_thirteenth_down()
minor_thirteenth_up()
normalize(use_sharps=None)[source]

Return the note normalized and without the octave component. Set use_sharps to control the output.

Example:
C4 -> C Cbb4 -> Bb Cbb4 -> A# (use_sharps=True) C###4 -> D# C###4 => Eb (use_sharps=False)
octave
octave_down()
octave_up()
perfect_fifth_down()
perfect_fifth_up()
perfect_fourth_down()
perfect_fourth_up()
set_augment()[source]
set_diminish()[source]
set_transpose(amount)[source]

Modify the note by a given number of semitones.

In some instances the letters ‘t’ or ‘A’ may be used to designate a change of 10 pitch classes. Similarly ‘e’ or ‘B’ may be used to designate a change of 11 pitch classes.

References:
transpose(amount)
transpose_list(lst)
class parker.notes.NotesParser[source]

Parse notes of any type into a list of notes. Valid notes are: Note, NoteGroup, int, str, list, tuple, set.

static parse(notes)[source]
class parker.notes.NoteGroupBase[source]

Representation of a set of notes to be played at the same time. An example of a NoteGroup would be a chord (1, 3, 5) played on a piano.

The base class does not let you add notes.

all_transpositions()

Create all available named transpositions

augment()
augmented_eleventh_down()
augmented_eleventh_up()
augmented_ninth_down()
augmented_ninth_up()
clone()
compound_augmented_fourth_down()
compound_augmented_fourth_up()
compound_augmented_second_down()
compound_augmented_second_up()
compound_major_second_down()
compound_major_second_up()
compound_major_sixth_down()
compound_major_sixth_up()
compound_major_third_down()
compound_major_third_up()
compound_minor_second_down()
compound_minor_second_up()
compound_minor_sixth_down()
compound_minor_sixth_up()
compound_minor_third_down()
compound_minor_third_up()
compound_perfect_fourth_down()
compound_perfect_fourth_up()
diminish()
get_notes()[source]
highest_note()
lowest_note()
major_eleventh_down()
major_eleventh_up()
major_fifth_down()
major_fifth_up()
major_fourth_down()
major_fourth_up()
major_ninth_down()
major_ninth_up()
major_second_down()
major_second_up()
major_seventh_down()
major_seventh_up()
major_sixth_down()
major_sixth_up()
major_tenth_down()
major_tenth_up()
major_third_down()
major_third_up()
major_thirteenth_down()
major_thirteenth_up()
minor_fifth_down()
minor_fifth_up()
minor_ninth_down()
minor_ninth_up()
minor_second_down()
minor_second_up()
minor_seventh_down()
minor_seventh_up()
minor_sixth_down()
minor_sixth_up()
minor_tenth_down()
minor_tenth_up()
minor_third_down()
minor_third_up()
minor_thirteenth_down()
minor_thirteenth_up()
notes = []
octave_down()
octave_up()
perfect_fifth_down()
perfect_fifth_up()
perfect_fourth_down()
perfect_fourth_up()
root = None
set_augment()[source]
set_diminish()[source]
set_transpose(amount)[source]
transpose(amount)
transpose_list(lst)
walk(func)
class parker.notes.NoteGroup(notes=None)[source]

A mutable set of notes to be played at the same time.

add(notes)[source]
append(item)[source]