ok, so i have lots of audio in my program that only plays once, and that all just works fine and perfect

This is what i do to play music

try
        {
            InputStream a = new FileInputStream ("Sounds-Music/MainTheme.wav");
            theme = new AudioStream (a);          
          
        }
        catch (java.io.IOException z)  //catching the exception
        {
        }
        // Play audio.
        AudioPlayer.player.start (theme);

now im trying to make a ContinuousAudioDataStream. This is my code, it compiles fine, but
doesant play any sound?, what am i missing?

try
        {
            InputStream a = new FileInputStream ("Sounds-Music/MainTheme.wav");
            theme = new AudioStream (a);          

            AudioData themestream = theme.getData ();
            // Create ContinuousAudioDataStream.
            ContinuousAudioDataStream THEME = new ContinuousAudioDataStream (themestream);
            // Play audio.
            AudioPlayer.player.start (THEME);
        }
        catch (java.io.IOException z)  //catching the exception
        {
        }

When debugging never NEVER NEVER have an empty catch block! There are many reasons why the code in your try block may fail, and for most of them you will get an Exception that describes exactly what went wrong, and exactly where in the code.
change

catch (java.io.IOException z) //catching the IO exception
{ // Pretend it didn't happen. Ignore the error message. Discard the debug info
}

to

catch (Exception z) //catching any exception, checked or unchecked
{ 
   z.printStackTrace(); // display the error message and all debugging info.
}

When debugging never NEVER NEVER have an empty catch block! There are many reasons why the code in your try block may fail, and for most of them you will get an Exception that describes exactly what went wrong, and exactly where in the code.
change

catch (java.io.IOException z) //catching the IO exception
{ // Pretend it didn't happen. Ignore the error message. Discard the debug info
}

to

catch (Exception z) //catching any exception, checked or unchecked
{ 
   z.printStackTrace(); // display the error message and all debugging info.
}

ok, thanks for that, i really just totally forgot, really stupid, but now i get this error from the stcktrace or whatever

java.io.IOException: could not create AudioData object
at sun.audio.AudioStream.getData(Unknown Source)

What does this mean

Sorry, I have expertise in java Audio - but at least you have a message now! ;)
J

Sorry, I have expertise in java Audio - but at least you have a message now! ;)
J

ok, well hopefully someone else does
thanks

Aaarrgghh - just noticed the missing word in my post. What I should have said, of course, is Sorry, I have no expertise in java Audio

Aaarrgghh - just noticed the missing word in my post. What I should have said, of course, is Sorry, I have no expertise in java Audio

haha, just seen that

haha, just seen that

ok, so i was using wav file format and i converted it to mp3, and now i get this error

java.io.IOException: could not create audio stream from input stream

ok, so i have lots of audio in my program that only plays once, and that all just works fine and perfect

This is what i do to play music

try
        {
            InputStream a = new FileInputStream ("Sounds-Music/MainTheme.wav");
            theme = new AudioStream (a);          
          
        }
        catch (java.io.IOException z)  //catching the exception
        {
        }
        // Play audio.
        AudioPlayer.player.start (theme);

now im trying to make a ContinuousAudioDataStream. This is my code, it compiles fine, but
doesant play any sound?, what am i missing?

try
        {
            InputStream a = new FileInputStream ("Sounds-Music/MainTheme.wav");
            theme = new AudioStream (a);          

            AudioData themestream = theme.getData ();
            // Create ContinuousAudioDataStream.
            ContinuousAudioDataStream THEME = new ContinuousAudioDataStream (themestream);
            // Play audio.
            AudioPlayer.player.start (THEME);
        }
        catch (java.io.IOException z)  //catching the exception
        {
        }

hey i thought these two links may be of help? :http://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java and http://stackoverflow.com/questions/2416935/how-to-play-wav-files-with-java

ok, i figured it out, if the sound file im trying to play is over 1 mb, it doesant work, if its under 1 mb it does work.

anyone have any ideas on how to compress a 2minute and 18 sec song to under 1 mb, right now it is 1.05 mb

what format?

what format?

wav format

see here:http://www.wavpack.com/ and here:http://www.blazemp.com/compress_wav_files.htm dont know how well they work, but Google showed them highest ranked free software for wav compression?

perfect, the program blaze media pro works amazing, alot you can do. alittle complicated at first, but just fool around with it alittle and becomes a great program to use. I managed to compress my wav file to under 750kb, and this is a 2 minute and 18 sec song, I cant notice any quality loss, thanks alot. loops perfectly now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.