🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1580

Playing Sound

#1580
From: David Pasch
Date: Sun, 09 Dec 2001 17:55
34 lines
1923 bytes
Hi,
I want my application to play an audio file (e.g., wav),
so I tried the following code

    AudioInputStream stream = AudioSystem.getAudioInputStream
(soundFile);
    Clip line;
    DataLine.Info info = new DataLine.Info (Clip.class,
stream.getFormat());
    if (!AudioSystem.isLineSupported(info)) {
      // Error handling
    }
    line = (Clip) AudioSystem.getLine (info);
    line.open (stream);
    line.loop (ctTimes); 

When I used a 6MB wave file for the soundFile, I got:

    javax.sound.sampled.LineUnavailableException: 
       Failed to allocate clip data: Requested buffer too large

I doubt that my computer ran out of memory (128MB RAM and plenty space
for the swap file).
What did I wrong ?


Further my app. fails to play mp3 files. When I try, I get:

    javax.sound.sampled.UnsupportedAudioFileException:
       could not get audio input stream from input stream

Does this mean that it is not possible to play mp3 files with the
utilities from the javax.sound.sampled
package ?
Technical Details
Message-ID: <3C13A581.573AF787@gmx.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,c0a9fc7d2c73d12f,start
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-12-09 09:57:35 PST
Message-ID: <3C13A581.573AF787@gmx.net>
Date: Sun, 09 Dec 2001 18:55:13 +0100
From: David Pasch <tmp2email@gmx.net>
Reply-To: pasch@in.tum.de
X-Mailer: Mozilla 4.5 [en] (Win98; I)
X-Accept-Language: en,ja
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.api
Subject: Playing Sound
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 212.144.144.233
X-Trace: dnews 1007920492 212.144.144.233 (9 Dec 2001 09:54:52 -0800)
Lines: 34
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews