I am trying to play javafx usinf wav files on my raspbery pi using the java sound library and code below, I get an error message following
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian not supported.
After googleing, I found that
the big-endian audio format is not supported by the raspberry pi sound card driver, and I need to change the getAudioFormat () function to request the little-endian format:
boolean bigEndian = false;
ok so far i realized i need the following
private AudioFormat getAudioFormat() { float sampleRate = 8000.0F; int sampleInbits = 16; int channels = 1; boolean signed = true; boolean bigEndian = false; return new AudioFormat(sampleRate, sampleInbits, channels, signed, bigEndian); }
but where I call getAudioFormat()
from the following code.
URL url = this.getClass().getClassLoader().getResource("Audio/athan1.wav"); Clip clip = AudioSystem.getClip(); AudioInputStream ais = AudioSystem.getAudioInputStream( url );
source share