package jmsltestsuite; import java.util.Vector; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.MusicShape; import com.softsynth.jmsl.score.Note; import com.softsynth.jmsl.score.Score; import com.softsynth.jmsl.score.ScoreFrame; import com.softsynth.jmsl.score.Tempo; import com.softsynth.jmsl.score.transcribe.BeatDivisionSchemeList; import com.softsynth.jmsl.score.transcribe.ElementMissedException; import com.softsynth.jmsl.score.transcribe.SearchPathListExpansionException; import com.softsynth.jmsl.score.transcribe.TempoTimeSignatureHolder; import com.softsynth.jmsl.score.transcribe.Transcriber; import com.softsynth.jmsl.score.transcribe.TranscriberListener; 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 examines minute differences in timestamp * * There was a bug that happened when the transcriber exited but there was still carriedOverMusicShape of notes * from the previous measure that should get bumped up into the next measure. * * SEE_BUG true used to show this (dyad would bnot show up). Fixed now 2012-07-23 * * * @author Nick Didkovsky, (c) 2002 Nick Didkovsky, All Rights reserved. */ public class TranscribeScore19 { static boolean SEE_BUG = true; public static void main(String args[]) { JMSL.clock.setAdvance(0.1); BeatDivisionSchemeList.defaultSetup(); MusicShape source2 = new MusicShape(4); double timeStamp = SEE_BUG ? 6.20 : 6.19; source2.add(timeStamp, 48., 82., 2.086956); // 6.20 drops notes, 6.19 preserves // notes in prev measure source2.add(timeStamp, 45., 83., 2.086956); // 2 staves, width, height Score score1 = new Score(2, 1024, 800); score1.addMeasure(); // Score score2 = new Score(1, 1024, 800); // score2.addMeasure(); Transcriber transcriber = new Transcriber(); transcriber.setExtendLastHoldTime(true); // if comment out, lose last // dyad Vector tsVector = new Vector(); tsVector.addElement(new TempoTimeSignatureHolder(new Tempo(115), new TimeSignature(4, 4))); transcriber.setTempoTimeSignatures(tsVector); try { score1.setCurrentStaffNumber(0); transcriber.setScore(score1); score1.rewind(); transcriber.setSourceMusicShape(source2); 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(score1); // f.addScore(score2); f.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { f.quit(); } }); f.setVisible(true); } }