[jmsl] Bug report: Transcriber
jmsl at music.columbia.edu
jmsl at music.columbia.edu
Thu Jan 17 22:01:18 EST 2008
I think I've found a bug in the Transcriber with rest transcription
at the beginning of measures. This is adapted from
TranscribeScore3.java.
If the tempo is 60 bpm, then first-note rests are no problem and are
properly transcribed. If however, the tempo of the measure is
anything other than 60, the rest will be ignored (or added to the end
of the measure?) and everything will be shifted over so that the
measure begins on a note.
So, in this example, measure 1 @ 120 bpm is incorrect, but measure 4
transcribes correctly.
I'm running the most recent build of JMSL on OSX 10.4.11 with JVM 1.5.0.
thanks,
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(4);
source.add(1.0, 0, 0.5, 1); // This rest is not properly transcribed
source.add(1.0, 61, 0.5, 1.0);
source.add(0.5, 62, 0.5, 0.5);
source.add(0.5, 63, 0.5, 0.5);
source.add(1.0, 64, 0.5, 1.0);
source.add(1.0, 65, 0.5, 1.0);
source.add(1.0, 0, 0.5, 1.0); // This rest is properly transcribed
because tempo = 60.
source.add(1.0, 65, 0.5, 1.0);
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