I am using Windows 10 and Eclipse IDE.
I have installed the Beads library for the IDE I am using.
This is the error.
Exception in thread "Thread-0" java.lang.IllegalArgumentException: Line unsupported: interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian
at java.desktop/com.sun.media.sound.PortMixer.getLine(PortMixer.java:125)
at net.beadsproject.beads.core.io.JavaSoundAudioIO.create(Unknown Source)
at net.beadsproject.beads.core.io.JavaSoundAudioIO$1.run(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:1583)
I am trying to generate a sine wave audio using a script.
The script I wrote tells me that it has the audio device and displays it’s name.
import javax.sound.sampled.AudioFormat;
import net.beadsproject.beads.core.AudioContext;
import net.beadsproject.beads.core.io.JavaSoundAudioIO;
import net.beadsproject.beads.data.Buffer;
import net.beadsproject.beads.ugens.WavePlayer;
public class AudioDevice {
public static void main(String[] args) {
//This selects the audio device.
JavaSoundAudioIO jsaio = new JavaSoundAudioIO();
jsaio.selectMixer(0);
//Creates an audio context.
AudioContext ac = new AudioContext(jsaio);
//Shows the format info such as sample rate and encoding.
ac.postAudioFormatInfo();
//Creates a sine generator for the audio device.
WavePlayer wp = new WavePlayer(ac, 440.0f, Buffer.SINE);
//The input sine wave goes into the output device which is the one I have selected.
ac.out.addInput(wp);
//Starts the audio. This is where it fails.
ac.start();
}
}
New contributor
Scuh69 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.