对于一些大学工作,我正在制作一个 java VST/Synthesizer。当需要更改音高时,我已经让振荡器产生声音并将频率更改为所需的值,但我希望在屏幕上有一个视觉示波器,所有选项都用于编辑声音。我怎么能这样做?以下是生成和播放 SawTooth 声音的代码,以防万一:
import com.jsyn.JSyn;
import com.jsyn.Synthesizer;
import com.jsyn.unitgen.LineOut;
import com.jsyn.unitgen.SawtoothOscillatorBL;
import com.jsyn.unitgen.UnitOscillator;
public class SawTooth {
public static Synthesizer synth = JSyn.createSynthesizer();
public static UnitOscillator osc;
public static LineOut lineout;
public static double Frequency = 261.626;
public static double Amplitude = 0.6;
public static int Voices = 1;
public static void Play() {
synth.start();
synth.add(osc = new SawtoothOscillatorBL());
synth.add(lineout = new LineOut());
osc.output.connect(0, lineout.input, 0);
osc.output.connect(0, lineout.input, 1);
osc.frequency.set(Frequency);
osc.amplitude.set(Amplitude);
lineout.start();
System.out.println("Wave Playing");
}
}
提前致谢