0
在JDK8中,我似乎無法從SoftSynthesizer創建的AudioInputStream中獲取任何有用的數據。Java Gervill軟件合成器不工作
AudioSynthesizer s = new SoftSynthesizer();
AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
AudioInputStream stream = s.openStream(format, null);
s.getChannels()[0].noteOn(60, 100);
while (stream.available() >= 0) {
byte[] b = new byte[2];
stream.read(b);
System.out.println(b[0] << 8 | b[1]);
}
s.getChannels()[0].noteOff(60);
但是,println()只顯示0,沒有音頻數據從AudioInputStream傳出。 我做錯了什麼?或者Gervill自JDK 8起棄用?