[jmsl] Bug report: Transcriber
jmsl at music.columbia.edu
jmsl at music.columbia.edu
Sat Jan 19 11:31:51 EST 2008
Hi Nick,
> I noticed that the rest is properly transcribed when the first
> measure is set to 2/4
It doesn't seem to have a problem with a full measure of rests. I
would be curious as to the order the rests are added. (which is the
first rest added, and the second)
Here's a slightly tweaked version of the last file adding indices to
the notes on the 5th dimension. With either 2/4 or 4/4 the rest is
not duplicated in the final score, so there's no way to tell which
was the first rest and which one the transcriber added (after or
before?).
This makes sense, in that the transcriber doesn't preserve rests, I'm
assuming? (more for my own understanding of how things are working)
Peter McCulloch
package jmsltestsuite;
import java.util.Vector;
import com.softsynth.jmsl.JMSL;
import com.softsynth.jmsl.MusicShape;
import com.softsynth.jmsl.score.*;
import com.softsynth.jmsl.score.transcribe.*;
import com.softsynth.jmsl.util.TimeSignature;
/**
* JMSL's com.softsynth.jmsl.score.transcribe package enables the
transcription
* of arbitrary MusicShape data into common music notation.
*
* This test changes tempo in measure 2 and then changes it back in
measure 3.
* So note events that would normally get transcribed as eighths are
transcribed
* as quarters, with a tempo change.
*
* @author Nick Didkovsky, (c) 2002 Nick Didkovsky, All Rights
reserved.
*/
public class TranscribeScore3 {
public static void main(String args[]) {
JMSL.clock.setAdvance(0.1);
BeatDivisionSchemeList.defaultSetup();
MusicShape source = new MusicShape(5);
source.add(1.0, 0, 0.5, 1, 1); // This rest is not properly
transcribed
source.add(1.0, 61, 0.5, 1.0, 2);
source.add(0.5, 62, 0.5, 0.5, 3);
source.add(0.5, 63, 0.5, 0.5, 4);
source.add(1.0, 64, 0.5, 1.0, 5);
source.add(1.0, 65, 0.5, 1.0, 6);
source.add(1.0, 0, 0.5, 1.0, 7); // This rest is properly transcribed
// because tempo = 60.
source.add(1.0, 65, 0.5, 1.0, 8);
source.integrate(0);
source.print();
// 2 staves, width, height
Score score = new Score(2, 1024, 800);
score.addMeasure();
score.getMeasure(0).getStaff(1).setClef(Clef.BASS_CLEF);
Transcriber transcriber = new Transcriber();
transcriber.setScore(score);
transcriber.setSourceMusicShape(source);
Vector tsVector = new Vector();
tsVector.addElement(new TempoTimeSignatureHolder(new Tempo(120),
new TimeSignature(4, 4)));
tsVector.addElement(new TempoTimeSignatureHolder(new Tempo(120),
new TimeSignature(2, 4)));
tsVector.addElement(new TempoTimeSignatureHolder(new Tempo(60), new
TimeSignature(2, 4)));
transcriber.setTempoTimeSignatures(tsVector);
try {
score.setCurrentStaffNumber(0);
transcriber.transcribe();
} catch (ElementMissedException e) {
e.printStackTrace();
System.out.println("ERROR: " + e);
System.exit(0);
} catch (SearchPathListExpansionException e) {
e.printStackTrace();
System.out.println("ERROR: " + e);
System.exit(0);
}
final ScoreFrame f = new ScoreFrame();
f.addScore(score);
score.getMeasure(0).setMeasureText("I should start with a rest");
score.getMeasure(3).setMeasureText("Transcribed correctly");
Score.setInstrumentNamesVisible(false);
Score.setStaffNumbersVisible(false);
// f.loadPrefs();
f.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
f.quit();
}
});
f.setVisible(true);
}
}
More information about the jmsl
mailing list