From owner-freebsd-java Thu Jan 3 13:20:56 2002 Delivered-To: freebsd-java@freebsd.org Received: from pinky.us.net (pinky.us.net [216.181.215.124]) by hub.freebsd.org (Postfix) with ESMTP id 1476037B417 for ; Thu, 3 Jan 2002 13:20:33 -0800 (PST) Received: (qmail 12772 invoked from network); 3 Jan 2002 21:20:31 -0000 Received: from pinky.us.net ([216.181.215.124]) (envelope-sender ) by pinky.us.net (qmail-ldap-1.03) with SMTP for ; 3 Jan 2002 21:20:31 -0000 Date: Thu, 3 Jan 2002 16:20:29 -0500 (EST) From: Brian Skrab To: freebsd-java@freebsd.org Subject: Playing audio with Java (JDK 1.3.1)??? Message-ID: <20020103145556.G11696-100000@pinky.us.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hello, I'm attempting to play a small WAV file on my FreeBSD box, running 4.4-STABLE and jdk1.3.1. Using the method described in almost every Java sound tutorial I've found results in the application simply waiting forever. Here is the source code that I'm using: ---------------------------------------------------------------------- import java.io.*; import java.applet.*; public class SoundTest { public static void main(String[] argv) { try { File file = new File(argv[0]); AudioClip clip = Applet.newAudioClip(file.toURL()); clip.play(); } catch(Exception ex) { ex.printStackTrace(); } } } ---------------------------------------------------------------------- Running the code results in no sound, and the jvm sitting at about 12% CPU usage until I ^C it. Is there another way to play an audio clip that I should try? Is the JDK capable of playing audio clips at all? Does the WAV file have to be in any particular format? I used the example (correctly encoded) WAV file provided on Sun's JavaSound Tutorial site. Any hints, pointers, or working example code will be much appreciated. Thanks, ~brian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message