-1

I am new to Java and I was attempting to create a sort of audio clip player that I can play with. I have no clue why this is happening and I just though I post it on here so someone smarter can take a look

try
  {
    File snareFile = new File("Snare.WAV");
    AudioInputStream snare = AudioSystem.getAudioInputStream(snareFile.getAbsoluteFile());
    println(snare.getFormat()); 
    clip = AudioSystem.getClip();
    clip.open(snare);
  }
  catch(UnsupportedAudioFileException e)
  {
    println("unsupported audio");
  }
  catch(FileNotFoundException e)
  {
    println("try a new path");
  }
  catch(IOException e)
  {
    println("IO issue");
  }
  catch(Exception e)
  {
   println("Other issue: " + e);
  }

and the error I get is:

javax.sound.sampled.LineUnavailableException: line with format ULAW 48000.0 Hz, 8 bit, mono, 1 bytes/frame not supported.

I have tried changing the format of the audio file, and spending hours researching something I know very minimally about. Thanks in advance!

Yup
  • 1

1 Answers1

0

It turns out that U-LAW encoding is not supported and I needed to change it to PCM-UNSIGNED

Yup
  • 1