coltrane v0.0.1 Coltrane.Theory.Note
Notes are different ways to classify and relate sounds.
Link to this section Summary
Functions
iex> Note.alteration_from_notation(“##”)
2
Returns the symbol string part of a Note notation from a number
Parses the notation into a Note struct
Returns all the letters used to describe music in western music
iex> Note.name(%Note{alteration: 2, base_pitch_class: 0})
"C##"
Transposes a note by a certain interval
Link to this section Functions
Link to this function
alteration_from_notation(symbols)
iex> Note.alteration_from_notation("##")
2
iex> Note.alteration_from_notation("bb")
-2
Link to this function
alteration_from_number(alteration)
Returns the symbol string part of a Note notation from a number.
Examples:
iex> Note.alteration_from_number(-2)
"bb"
iex> Note.alteration_from_number(2)
"##"
iex> Note.alteration_from_number(0)
""
Link to this function
from_notation(notation)
Parses the notation into a Note struct
Examples
iex> Note.from_notation("C#")
%Note{alteration: 1, base_pitch_class: 0}
iex> Note.from_notation("D")
%Note{alteration: 0, base_pitch_class: 2}
iex> Note.from_notation("Ebb")
%Note{alteration: -2, base_pitch_class: 4}
Link to this function
letter(note)
Link to this function
letters()
Returns all the letters used to describe music in western music
Examples
iex> Note.letters
["C", "D", "E", "F", "G", "A", "B"]
Link to this function
name(note)
iex> Note.name(%Note{alteration: 2, base_pitch_class: 0})
"C##"
iex> Note.name(%Note{alteration: -1, base_pitch_class: 2})
"Db"
iex> Note.name(%Note{alteration: 0, base_pitch_class: 4})
"E"
iex> Note.name(%Note{alteration: 0, base_pitch_class: 1})
"C#"
iex> Note.name(%Note{alteration: 0, base_pitch_class: 6})
"F#"
Link to this function
transpose(note, interval)
Transposes a note by a certain interval
Examples:
iex> Note.transpose("C", "2M") |> Note.name
"D"
iex> Note.transpose("C", "2m") |> Note.name
"Db"
iex> Note.transpose("C", "1A") |> Note.name
"C#"
iex> Note.transpose("C#", "3M") |> Note.name
"E#"
iex> Note.transpose("C#", "1A") |> Note.name
"C##"
iex> Note.transpose("C##", "1A") |> Note.name
"C###"
iex> Note.transpose("C#", "5P") |> Note.name
"G#"
iex> Note.transpose(
...> %Note{base_pitch_class: 1, alteration: 0},
...> %Interval{letter_distance: 2, alteration: 0}
...> )
%Note{base_pitch_class: 4, alteration: 1}
iex> Note.transpose(
...> %Note{base_pitch_class: 3, alteration: 0},
...> %Interval{letter_distance: 0, alteration: 1}
...> )
%Note{base_pitch_class: 2, alteration: 2}