Results 1 to 3 of 3
  1. #1
    dane1193 is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default Large Wave Files

    I am trying to add a large (1 minute) wav file to a game I am making for my computer class. Any idea how to do this? The following code plays my other wav files, so I know it works, but fails to play the large one that I want.
    public static class ALYouAndMe implements ActionListener{
    public final void actionPerformed(ActionEvent e) {
    YAM++;
    if(YAM%2==1){
    AudioPlayer MGPStart = AudioPlayer.player;
    AudioStream BGMStart;
    AudioData MDStart;
    AudioDataStream loopStart = null;

    try{

    BGMStart= new AudioStream(new FileInputStream("youandme.wav"));
    MDStart= BGMStart.getData();
    loopStart= new AudioDataStream(MDStart);
    }catch(IOException error){}

    MGPStart.start(loopStart);



    }

    }}

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    What are AudioPlayer, AudioStream etc? Perhaps their documentation suggests limitations (either file size or otherwise).

    What happens when you try the static Applet method, newAudioClip()? It's a weird place for such a method, but it exists.

    I have no idea whether it plays .wav files, or if it objects to large files (is one minute large?) but it's where I would start.

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    fwiw the following is playing a 4min wav file as I type

    Java Code:
    import java.applet.Applet;
    import java.applet.AudioClip;
    import java.io.File;
    
    class Calc {
        public static void main(String[] args) throws Exception {
    		AudioClip clip = Applet.newAudioClip(new File("test.wav").toURI().toURL());
    		clip.loop();
    		// Ctrl-C to exit...
        }
    }
    Last edited by pbrockway2; 02-19-2011 at 12:06 AM.

Similar Threads

  1. Copying large files efficiently
    By bayan in forum New To Java
    Replies: 2
    Last Post: 10-27-2010, 06:01 PM
  2. Replies: 4
    Last Post: 02-26-2010, 04:18 AM
  3. Compare 2 large files
    By bezudar in forum Advanced Java
    Replies: 3
    Last Post: 11-23-2008, 03:18 AM
  4. OutofMemory while downloading large files through FTP
    By deb_santanu in forum Advanced Java
    Replies: 0
    Last Post: 11-13-2008, 02:04 PM
  5. Need to find large files and folder on the PC. What app needed?
    By Cleaner007 in forum Reviews / Advertising
    Replies: 1
    Last Post: 09-30-2008, 08:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •