[jmsl] JMSL/JSyn Score Demo

Nick Didkovsky drnerve at i...
Mon Jul 24 17:36:57 EDT 2000



Phil Burk wrote:

> Nick Didkovsky wrote:
> > There is a new demo of the JMSL Score package online at
> > http://www.ingress.com/~drnerve/jmsl/examples/scorejsyndemo2.html
>
> This is incredible! I love it. There are lots of nice touches in the
> editor. I like how the last note enterred is highlighted so I can just
> delete it easily. This is going to be a great tool!

Big thanks. It feels like it's coming together. Can't wait to actually get
some work done with it!

>
> It will be really fun to add custom transformations to the editor from
> Java, select a range of notes and "schlumpify" them. What would the API
> look like for getting the selected notes and tweaking them?

Had ideas for three kinds of transforms:
1) NotePropertiesTransformation (implemented now). That just runs through
the selection buffer and changes a property on each Note encountered, like
beaming flags, pitch, etc. Leaves Notes in place.

For this the API is simple: subclass NotePropertiesTransformation and define
operate()... operate() will get called from the Score menu.

You can run through what's selected with the static Score.selectionBuffer
Example below:

public class TranspositionTransformation extends
NotePropertiesTransformation {

int interval;

public TranspositionTransformation(int interval) {
this.interval = interval;
}

public void operate() {
for (Enumeration e=Score.selectionBuffer.elements(); e.hasMoreElements();
) {
Note note = (Note)e.nextElement();
if (!note.isRest()) {
// get pitch data, transpose it, and set it again
note.setPitchData(note.getPitchData()+interval);
// Use NoteFactory to recalculate staff level, accidental, and stem
direction
NoteFactory.setLevelPitch(note, note.getPitchData());
}
}
}

2) Transforms with a single selection buffer argument. Like scramble. So
you'd select, hit scramble, click somewhere and hit paste (or maybe click
paste and it would replace the selected stuff). Here I think the selection
buffer will get cloned to a safe place (like a paste buffer), where the
actual work gets done. Not sure of the API yet. But this is different from
(1) because even if the number of input notes are the same as the number
output notes, it will involve deleting the selected notes and replacing them
with a new order. Also, you might get more notes from the output than the
input (a variation generator for example), so you need a separate work
buffer.
3) Transforms with multiple selection buffer arguments. Like Larry's
mutations. Select a melody, copy to Buffer 1. Select another, copy to
Buffer 2. Select the Mutator, which does its work, sending its output
(again) to the paste buffer.

>
> Some ideas:
>
> - <SPACE> to start and stop play.

Great.

>
> - Number keys for durations. duration = 1/(2**N) OR {1=>1/1, 2=1/2,
> 4=1/4, 8=1/8, 6=1/16, 3=1/32)

Cool, but I was thinking of number keys to punch in tuplets. Maybe function
keys for duration?

>
> - Hit "." to toggle dotted.

Working on it now in fact! Thinking each dot pressed would cycle through 0,
1, 2 dots.

>
> - Display only class for just displaying a score, maybe with cursor for
> follow along.

All the panels are separate objects, so you can add them or not to a frame!
A raw displayer might look something like:
Score score = new Score(numStaffs, w, h); // previously defined int's
java.awt.Frame f = new java.awt.Frame(); // use awt Frame, not a
ScoreFrame which has menus
f.setLayout(new BorderLayout());
f.add("West", score.getControlPanel()); // controls for measure# and
zoom
// f.add("East", score.getScoreEditPanel()); // DISPLAY SCORE ONLY, no
edirt panel
f.add(score.getScoreCanvas());
f.pack();
f.setVisible(true);


I really want the play-along cursor! Trying to think about the easiest way
to do it. Easy to draw currently played note in a different color, but that
involves redrawing this huge image every time. And each note in a multiple
staff score doing that is going to be a drag! So maybe a vertical line
cursor that sort of clicks along at the rate of the denominator of the
current time signature? Then I could just have an invisible conductor track
running in parallel to all the staffs, with a line drawing instrument.
Something like that.


> - Display+Edit class for editing. Maybe uses a composite object with GUI
> object plus a mouse sensitive subclass of the ScoreDisplay class.

I'm not sure I understand this one?

>
> Question:
> I notice that if I add 7 septuplets with duration set to 16th, then the
> total duration is a quarter note. What's the easiest way to think about
> this?

This caused my brain to howl a bit. Here's the scoop.

Let's say a quarter note = 1.0
The "tuplet breaks" come every power of 2. So to calculate how much time a
complet tuplet (ex. 3) applied to a fixed duration (ex 0.25 for sixteenth
note) would take, multiply 0.25 by the highest power of 2 less than 3.
0.25 * 2 = 0.5.
This total time, is how much time a complete 16th note triplet would take.
A third of that 1/6, is the duration of one of them.

Your example:
16th note = 0.25 dur
Highest power of 2 < 7 = 4
0.25 * 4 = 1.0
So seven 16th note septuplets take 1.0 second (a quarter note).

It helps to grok this when you see that 5 tuplet, 6 tuplet, and 7 tuplet all
feel similar, but when you get to 8 something weird happens.

Sketch out something like:
tuplet groups (3 4) (5 6 7 8) (9 10 11 12 13 14 15 16)
corresponding duration groups (0.5) (1.0) (2.0)

Here's the source from Note class:

/** Calculate duration of n-tuplet, given n and its non-tuplet duration.
<br>
Algorithm: for n-tuplet, multiply the duration of the non-tuplet'ed
note by the highest power of 2 that is less than n. That gives the total
duration the tuplet is to occupy.
Finally, divide that total duration by n. <br><br>
@return tuplet duration applied to dur
*/
public static double tupletDur(int n, double dur) {
double totalDurToOccupy = Math.pow(2.0, highestPowerOfTwoLessThan(n)) *
dur;
return totalDurToOccupy / n;
}



Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://music.columbia.edu/pipermail/jmsl/attachments/20000724/a06e7d5c/attachment.htm


More information about the jmsl mailing list