JMSL Tutorial: JScore
Adding measures to a score
JScore allows the user to enter and edit notes by hand, but its real strength lies in its programmability,
which breaks down into two areas:
- Adding algorithmically generated notes to a score
- Transforming selected notes in a score
This tutorial demonstrates:
- How to create a new score.
- How to add it to a frame for display and editing.
- How to use JMSL's api for adding measures with user defined time signatures.
A new Score is created like so:
// 2 staves, width, height
Score score = new Score(2, 800, 400);
A score can be added to a ScoreFrame for display and editing. ScoreFrame has a powerful system of menus for score editing.
Adding a score to a ScoreFrame is done like this:
ScoreFrame scoreFrame = new ScoreFrame();
scoreFrame.addScore(score);
A blank measure with an arbitrary time signature can be added to a score with the addMeasure() method. For example:
score.addMeasure(11, 16);
score.addMeasure(4, 4);
// add a measure with random time signature
score.addMeasure(JMSLRandom.choose(3, 7), (int)Math.pow(2, JMSLRandom.choose(2, 4)));
View the complete source here.
(C) 2000 Nick Didkovsky and Phil Burk, All Rights Reserved
JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.