Common Practice Notation

jMusic's data structure and terminology bear a strong resemblance to standard, or common practice, music notation. So it is not surprising that there would be a way of visualising a jMusic score as CPN. Here is is. . . almost.

The current notation capability will only display a jMusic phrase &emdash;not yet a part or score, but that will come - and faster if you help code it :) As well as being another viewing option, the notation view will also allow you to enter data as notation and save the phrase as a jm or MIDI file for use by other jMusic applications.

The notation display can look like this:

Lets have a look at how to make it so.
import jm.JMC;
import jm.util.*;
public class NotateTest implements JMC {
    public static void main(String[] args) {
        Phrase phr = new Phrase();
        for(int i = 0; i< 50; i++) {
           Note n = new Note((int)(Math.random()*60 + 30), SQ * (int)(Math.random()*8 + 1));
In this code a phrase of random notes is created a displayed as notation. The important lines are the final import statement import jm.util.*; which imports the View class we use later. The last line of code uses the View class to display the phrase as CPN, View.notate(phr);. The notate() method has two forms, the one shown takes a phrase as an argument, the other takes a phrase and two int's which specify the location of the notation window. e.g. View.notate(phr, 20, 100);

To enter notation click the cursor at the end of the phrase, or between notes to insert a note. Notes can be dragged to change their attributes. Dragging up and down will change the note's pitch. Dragging left and right will change the note's rhythmic value. Larger note values are to the right. Dragging past the semi quaver (16th note) to the left reveals a 'delete' option. Releasing the mouse when the word 'delete' is visible will remove that note from the phrase. Dragging further left will change the note into a rest, with increasing rhythmic values further to the left.

The key signature and time signature can also be changed by dragging the cursor up or down in the relevant positions at the beginning of the stave.

As well as mouse editing functions, there is a CPN menu with additional functions, and keyboard short cuts.

New - opens an additional notation window with an empty phrase in it.

Open jMusic file - reads in a jm file and displays the first phrase of the first part.

Open MIDI file - reads in a MIDI file and displays the first phrase in the first track.

Close - ends the notation session.

Play - plays back the phrase. Pressing the spacebar is a short cut. Only works if QuickTime Java is installed.

Stop - ends Quicktime playback.

Delete last note - does the obvious. The 'Delete' key is a short cut.

Clear all notes - removes all notes and rests from the phrase.

Key Signature - toggles the key signature on or off.

Time signature - toggles the time signature on or off.

Save as a jm file - writes the phrase to disk as a jm file.

Save as a MIDI file - write the phrase to disk as a MIDI file.

Stave - opens a sub menu allowing you to switch do a different clef (Treble, Bass, Piano, or Grand).

Quit - end program.

jMusic Tutorial Index