JMUSIC.BingJava History

Hide minor edits - Show changes to output

Changed lines 1-2 from:
(:source lang=Java header="This simple jMusic program has all the elements you will need to create MIDI files. Use it to test your jMusic installation." tabwidth=3 -trim :)
to:
(:source lang=Java header="This sample program has everything you need to create MIDI files. Use it to test your jMusic installation." tabwidth=3 -trim :)
Changed lines 1-2 from:
(:source lang=Java header="This simple jMusic program has all the elements you will need to create MIDI files. Use it to test your installation of jMusic." tabwidth=3 -trim :)
to:
(:source lang=Java header="This simple jMusic program has all the elements you will need to create MIDI files. Use it to test your jMusic installation." tabwidth=3 -trim :)
Added lines 1-43:
(:source lang=Java header="This simple jMusic program has all the elements you will need to create MIDI files. Use it to test your installation of jMusic." tabwidth=3 -trim :)

//give this class access to the jMusic classes
import jm.JMC;
import jm.music.data.*;
import jm.util.*;

/**
* This is the simplest jMusic program of all.
* The eqivalent to a programming language's 'Hello World'
*/

public final class Bing implements JMC
{
public static void main(String[] args)
{

//create a middle C minim (half note)
Note n = new Note(C4, MINIM);

//create a phrase
Phrase phr = new Phrase();

//put the note inside the phrase
phr.addNote(n);

//pack the phrase into a part
Part p = new Part();
p.addPhrase(phr);

//pack the part into a score titled 'Bing'
Score s = new Score("Bing");
s.addPart(p);

//play the score as MIDI
Play.midi(s, true);

//write the score as a MIDI file to disk
Write.midi(s, "Bing.mid");
}
}

(:sourcend:)