JMUSIC.Score History

Hide minor edits - Show changes to output

Added lines 1-27:

The Score class is used to hold score data. Score data includes is primarily made up of a list of Part objects. Commonly, score data is algorithmically generated. Alternatively, score data can be read from a standard MIDI file and written to a standard MIDI file. The following demonstrates all three possibilities:

(:source lang=python tabwidth=3 -trim :)

score = Score("Concerto for Solo Clarinet") # create an empty score

# read the MIDI file into score
Read.midi(score, "concerto.mid");

# now, add one more note into score
note = Note(C4, HN) # create a middle C note with 1/2 duration

phrase = Phrase(0.0) # create a phrase that starts at the beginning of the music
phrase.addNote(note) # add this note to a phrase

inst = Part("Clarinet") # create a new part
inst.addPhrase(phrase) # add the generated phrase into it

score.addPart(inst) # add the part to the score

# now, write the expanded score as a new MIDI file to disk
Write.midi(score, "concerto2.mid")

For more information, see the [[ | jMusic Score Java class]].