EasyMIDI.Note

class EasyMIDI.Note(name, octave=4, duration=0.25, volume=100)

The Note class contains musical notes and their properties, like octave, duration and volume.

Initializes a Note object.

Parameters:
  • name (str) – The name of the note (ex. C).
  • octave (int) – The octave of the note (1-7).
  • duration (float or int) – The duration of the note (ex. 1/4 is quarter note).
  • volume (int) – The volume of the note (0 to 100)
__init__(name, octave=4, duration=0.25, volume=100)

Initializes a Note object.

Parameters:
  • name (str) – The name of the note (ex. C).
  • octave (int) – The octave of the note (1-7).
  • duration (float or int) – The duration of the note (ex. 1/4 is quarter note).
  • volume (int) – The volume of the note (0 to 100)

Methods

__init__(name[, octave, duration, volume]) Initializes a Note object.
getDuration() Returns the duration of the note.
getName() Returns the name of the note.
getOctave() Returns the octave of the note.
getVolume() Returns the volume of the note.
setDuration(duration) Sets the duration of the note to duration.
setName(name) Sets the name of the note to name.
setOctave(octave) Sets the octave of the note to octave.
setVolume(volume) Sets the volume of the note to volume.
getDuration()

Returns the duration of the note.

Returns:Current duration (ex. 1/4).
Return type:float or int
getName()

Returns the name of the note.

Returns:Current name (ex. C).
Return type:str
getOctave()

Returns the octave of the note.

Returns:Current octave (ex. 4).
Return type:int
getVolume()

Returns the volume of the note.

Returns:Current volume (ex. 80).
Return type:int
setDuration(duration)

Sets the duration of the note to duration.

Parameters:duration (float or int) – The new duration (ex. 1/4).
setName(name)

Sets the name of the note to name.

Parameters:name (str) – The new name (ex. C).
setOctave(octave)

Sets the octave of the note to octave. :param octave: The new octave (1-7). :type octave: int

setVolume(volume)

Sets the volume of the note to volume.

Parameters:volume (int) – The new volume (0-100).