Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

Why can't my audio files be read?

+16 votes
panel.playSoundFile("songs/MainThemeSong.wav");

This is what I am using to start a song that I have assigned to the title screen. It keeps saying "could not get audio input stream from input file." I was wondering why this is happening and if anyone knows how to solve this? I used the audio converter that Dr. Stonedahl suggested as well. 

asked Oct 20, 2016 in CSC 211 (F16) by Hunter Bader (100 points)

1 Answer

+2 votes
 
Best answer
I'm not sure why some files seem to work and some don't.  

Try reading this: https://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/sound.html

and then try exporting your .WAV (or .AU?) file from Audacity using different settings...  (The page above mentions " PCM; 8 or 16 bits; 8000, 11025, 22050, 44100 Hz.")

Hope you can get it to work somehow...
answered Oct 22, 2016 by Forrest Stonedahl (100 points)
selected Oct 23, 2016 by Hunter Bader
Thank you so much!!!!!! It worked!
Can you provide more information of EXACTLY what you had to do, in case your classmates run into the same problem?
I had to change the settings while converting to a WAV file with Audacity from high definition to optimal. Once I did that it worked well enough.
...