dmkoelle / jfugue

Java API for Music Programming
80 stars 11 forks source link

Export to WAV #4

Open SongBase opened 9 years ago

SongBase commented 9 years ago

When I play back a WAV file created with JFugue 5.0.1 I hear a sound like all the notes played together as a chord and then silence. Here is the code I used. Am I doing something wrong?

import java.io.*; import javax.sound.midi.Sequence;

import org.jfugue.player.; import org.jfugue.pattern.; import org.jfugue.audio.*;

public class JF5Test { public static void main(String[] args) {

try
{
Player player = new Player();
player.play("C5q D5q E5q F5q G5q A5q B5q C6q");  // this works
Pattern pattern = new Pattern("C5q D5q E5q F5q G5q A5q B5q C6q");
Sequence seq = player.getSequence(pattern);
Midi2WavUtils.createWavFile(seq, new File("wavfile.wav"));
}
catch(Exception e)
{
}

} }