|
import jm.JMC;
|
The usual suspects are imported. The CPN display and the Play class is in the jm.util package.
public class CPNInput implements JMC{
|
The class is declared and a main method is written to call the constructor.
The constructor does all the work in this class, first declaring a Score, Part and Phrase then packing one inside the other as required by the jMusic data structure. The notation window is displayed using the phrase just declared.
Play.midi() is used to playback the score (which contains the part which contains the phrase which contains the notes added by the user!). The 'false' parameter specifies that the System.exit(0) command should NOT be called once the score has finished playing. (Whenever the System.exit(0) command is called the entire program exits, no matter where the call was made from.)
To save a phrase to disk select "Save as MIDI..." from the CPN menu. You will be prompted for a name and location for the MIDI file. That MIDI file can them be imported into a future jMusic program as part of a composition.
When you get confident, try
writing a jMusic composition program that incorporates both
notation input and saving as in this class, along side code
that reads MIDI files and creates a piece with them.
|
|
|
|
|
|