Hey guys,
I’m trying to play audio files to a different sound card connected to my laptop. I attached my code below. I keep getting the following error when attempting to write to the sound card (I do this through line " zone.outputDevice(1); ")
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
** at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:513)**
** at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:121)**
** at com.jsyn.devices.javasound.JavaSoundAudioDevice$JavaSoundInputStream.start(Unknown Source)**
** at com.jsyn.engine.SynthesisEngine$EngineThread.run(Unknown Source)**
This error is caused by “zone.outputDevice(1)” as when I comment that line out, the code runs and audio plays through my laptop speakers.
The line “Sound.list()” outputs the following.
device id 0: Primary Sound Driver
max inputs : 0
max outputs: 2 (default)
device id 1: Speakers (USB PnP Sound Device)
max inputs : 0
max outputs: 2
device id 2: Speakers (Realtek(R) Audio)
max inputs : 0
max outputs: 2
device id 3: Primary Sound Capture Driver
max inputs : 2 (default)
max outputs: 0
device id 4: Microphone (USB PnP Sound Devic
max inputs : 2
max outputs: 0
device id 5: Microphone Array (Intel® Smart
max inputs : 2
max outputs: 0
device id 6: Port Speakers (USB PnP Sound Device)
max inputs : 0
max outputs: 0
device id 7: Port Speakers (Realtek(R) Audio)
max inputs : 0
max outputs: 0
device id 8: Port Microphone Array (Intel® Smart
max inputs : 0
max outputs: 0
device id 9: Port Microphone (USB PnP Sound Devic
max inputs : 0
max outputs: 0
import processing.sound.*;
Sound zone = new Sound(this);
void setup(){
frameRate(20);
size(1200, 500);
fill(255,255,255);
rect(0,0,width,height);
Sound.list();
}
void draw(){
for (int i = 0; i < 2; i++){
playTone(i);
delay(2000);
}
}
void playTone(int index){
zone.outputDevice(1);
SoundFile file = new
SoundFile(this,"welcome.wav");
file.amp(0.1);
file.play();
}
I am just trying to play audio through the alternative sound card. Could anybody with some expertise with this sound library give me a hand? I have been struggling with this for days now. Thank you!