notes
None
chromatic_notes
Takes a note and returns every note between that note and it's octave
e.g.
chromatic_notes(Note.A, direction="down")
[Note.A, Note.Ab, Note.G, Note.Gb, Note.F, Note.E, Note.Eb, Note.D, Note.Db, Note.C, Note.B, Note.Bb]
Args:
note:
The note to start from.
direction:
Can either transpose up or down in pitch. acceptable values are
"u", "up", "above", "d", "down" or "below" in any case.
Returns:
A list of notes.
Raises:
ValueError:
If the direction string is not recognized.
notes_to_string
Takes a list of notes and returns a string of note names.
e.g. [Note.C, Note.B, Note.D] -> "C, B, D"
Args:
note_list:
The list of notes to be converted to a string.
Returns:
The string of note names.
transpose
Takes a note and transposes (changes) it into a different note lower or
higher in pitch.
e.g. C tranposed a Major 3rd becomes E
Args:
note:
The note to be transposed.
interval:
The interval to transpose the note.
direction:
Can either transpose up or down in pitch. acceptable values are
"u", "up", "above", "d", "down" or "below" in any case.
Returns:
The note after being transposed.
Raises:
ValueError:
If the direction string is not recognized.
Note
Represents a musical note. Derived from the Enum class.
NOTE: Can't have sharps (#) in variable names
Attributes:
note attributes:
12 class attributes representing note enumerations. Starting at 'middle C'.
Methods:
items(cls):
A class method to return the enums as a list.
all(cls):
An alias for items(), returning the enums as a list.
from_index(cls, index):
A class method to return a enumeration based upon an index.
random(cls):
A class method that returns a random note.
to_sharp(self):
Returns a string of a flat note as a sharp.
previous(self):
Returns the note below.
next(self):
Returns the note above.
transpose(self, interval, direction="u"):
Returns a Note transposed by an interval in either direction.
chromatics(self, direction="u"):
Returns a list of all notes from the note to the octave in either direction.
__str__(self):
Returns the name of the note.
__repr__(self):
Returns the Enum name.
Note.items
A class method that returns a list of the note enumerations.
e.g. [Note.C, Note.Db, ... ]
Args:
None.
Returns:
A list of notes.
Note.all
A class method that returns a list of the note enumerations.
e.g. [Note.C, Note.Db, ... ]
Args:
None.
Returns:
A list of notes.
Note.from_index
A class method that returns a note based upon it's enumeration
value (positive or negative). Positive indices are counted from
the start and negative indices are counted from the end.
e.g. from_index(3) -> Note.Eb
from_index(-3) -> Note.A
Args:
index:
The index of the value to be retrieved. Can be positive or
negative.
Returns:
A Note.
Note.random
A class method that returns a random note.
e.g. Note.Ab
Args:
None.
Returns:
A Note.
Note.to_sharp
Returns the enharmonic sharp equivalent of the note, or the note's name
if it does not use a flat.
e.g. Note.Eb.to_sharp() -> 'D#'
Returns:
A string representing a note.
Note.previous
Returns the previous note
e.g. Note.Eb.previous() -> Note.D
Args:
None.
Returns:
A note.
Note.next
Returns the next note
e.g. Note.Eb.next() -> Note.E
Args:
None.
Returns:
A note.
Note.transpose
Transposes (changes) this note into a different note lower or higher
in pitch.
Note.C.transpose(Interval.M3)
C tranposed a Major 3rd becomes E
Args:
interval:
The interval to transpose the note.
direction:
Can either transpose up or down in pitch. acceptable values are
"u", "up", "above", "d", "down" or "below" in any case.
Returns:
The note after being transposed.
Raises:
ValueError:
If the direction string is not recognized.
Note.chromatics
Returns every note between this note and it's octave
e.g.
Note.A.chromatics(direction="down")
[Note.A, Note.Ab, Note.G, Note.Gb, Note.F, Note.E, Note.Eb, Note.D, Note.Db, Note.C, Note.B, Note.Bb]
Args:
direction:
Can either transpose up or down in pitch. acceptable values are
"u", "up", "above", "d", "down" or "below" in any case.
Returns:
A list of notes.
Raises:
ValueError:
If the direction string is not recognized.
Note.__str__
Returns a string representing the note name.
e.g. str(Note.Ab) -> 'Ab'
Args:
None.
Returns:
A string representing a note's name.
Note.__repr__
Returns a string representing the note.
e.g. repr(Note.Ab) -> 'Note.Ab'
Args:
None.
Returns:
A string representing a note.