JMUSIC»Note

Note

Note

The Note class is representative of notes in standard western music notation. It contains data relevant to music note information such as pitch and rhythm value. Notes get contained in Phrase objects. Like in traditional music notation (CPN) notes get played one after the other in the order in which they are added to the Phrase.

A note is created via Note(pitch, rhythmValue), where

  • pitch is a jMusic pitch constant, or an integer between 0 and 127 (a MIDI pitch value), or a real number such as 440.0 (a frequency in Hertz); and
  • rhythmValue is a jMusic rhythm-value constant, or a real number such as 0.25 (i.e., a quarter note).

Notes can be added to a phrase like this:

phrase = Phrase(0.0)    # create a phrase that starts at the beginning of the music
note = Note(C4, HN)     # create a middle C note with 1/2 duration
phrase.addNote(note)    # add this note to a phrase
 

Rests can be defined like this:

rest = Rest(HN)         # create an 1/2 rest
phrase.addNote(rest)    # add this rest to an existing phrase
 

For more information, see the jMusic Note Java class.