aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Hey! Dont ne One know About Java SOUND???!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Hey! Dont ne One know About Java SOUND???!!" Watch "Hey! Dont ne One know About Java SOUND???!!" New topic
Author

Hey! Dont ne One know About Java SOUND???!!

gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi!
Well I am trying to use Java Sound or Applet.AudioClip to play a wave or midi file..
This is my third post and yet no one has replied to the same..
I wonder if we still have those ranch hands, Bartenders and sheriffs who are still green horns on Java Sound.
Well here is some enlightenment for ya all..

The Above Code is supposed to play the Audio clip that I present .. but it doesnot. nor does it gimme any runtime/compiletime errors..
I ve been wondering why this is happenning..
well those who know please answer.. and those who dont cud @least thank me for enlightening them
Regds
Gautham Kasinath


"In the country of the blind, the one eyed man is the King"
Gautham Kasinath CV at : http://www.geocities.com/gkasinath
Stanley George
Ranch Hand

Joined: Dec 09, 2000
Posts: 55
hi gautham
if all you want is to play the audioclip, i would recommend that
you use JMF. of course u can use JavaSound, but JMF makes things
simpler..
here's a sample code :
player = Manager.createPlayer(new URL("file://foo.wav"));
player.start ();
that's it!!!
hope this helps.
NageswaraRao Karra
Ranch Hand

Joined: Nov 12, 2000
Posts: 34
hello!
only *.au files can be played with yr.code.
i tried many times with other files but with no output.if you play any .au files it will work.some of them are in jdk demo directory.
for other files i think there is no support with the packages you imported.may be javax.sound.* may be helpful to you.
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi!
Well cud you gimme a complete code please b coz I m new to JMF and I cudnt understand which class s' instance u r creating player as..
Regds
Gautham Kasinath
Stanley George
Ranch Hand

Joined: Dec 09, 2000
Posts: 55
first u have to download JMF 2.1 from java.sun.com/
install jmf on ur machine
then run the foll code..
import javax.media.*;
import javax.media.rtp.*;
import java.net.*;
public class RTPPlayer implements ControllerListener {
Player player;
public RTPPlayer() {
try {
URL url = new URL("file://foo.wav.gsm");
player = Manager.createPlayer(url);
player.addControllerListener(this);
player.start ();
} catch (Exception e) {
}
}// RTPPlayer
public void controllerUpdate( ControllerEvent evt) {
}

public static void main (String args[]) {
RTPPlayer rtpPlayer = new RTPPlayer();
System.out.println ("starting to play...");
}
}
this is just a rough code..but will serve
the purpose.
you have to stop the player using player.stop();
otherwise it continues to run in the background.
happy coding
[This message has been edited by Stanley George (edited February 20, 2001).]
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi!
Eureka!!
Mr. Georges' code Worked..
Hey I didnt see about my code working.. did it reallY.. because it did not work with me..
Anyway Mr. george or others cud you help me out with some streaming audio playing??
Actually I would like to have a link where theres tutorials on the Javax.sound extension of JMF.
Thanks a lot everybody for helping me hear the first sounds through a code.
Regds
Gautham Kasinath
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
I think what's happening is that your app is exiting before the audio gets a chance to actually play. Try using Thread.sleep after invoking play and see what happens.
Originally posted by gautham kasinath:
[B]

[/B]
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi!
I tried the Thread.sleep() at the code but that is not working.
I am not sure why..
Anyway the last post gave me an insight into how to play a clip using the javax.sound.* and that really worked.. ]
Thanks anyway
Please let me know what may be the problem.
Regds
Gautham Kasinath
Stanley George
Ranch Hand

Joined: Dec 09, 2000
Posts: 55
hi gautham
glad to know that u r happy. i wish some 1 would help me out too.
even i am having some problems with straming media.
but its rather simple to start with.
and to tell u something, JMF uses JavaSound for its functionality
if u want some examples u could start with the user-guide of JMF
some really neat examples are listed there.
JMF-RTP could be the section you are looking out for..
happy coding.
and hey! call me stanley. lets all be friends
[This message has been edited by Stanley George (edited February 21, 2001).]
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi! Stanley!!
Well I guess I will look around the JMF for more on streams.. and as soon as I hit some ting I shall cry out to ya!!
well sure less be friendz, well my full name is posted on the ranch gautham kasinath and I just passed out with a bachelors in Computer science and Engg. in India. I ve round a years exp. in Java and more specifically 7 months in real time Java based software dev. I also am a lover of C and C++, I ve exp in ASP as well..
my mail id is : gkasinath@hotmail.com and I check my mails every 1/2 hr..
I shall be online on yahoo messenger as gkasinath
Please feel free to contact me in either of these ways, nd please let me know about u r self..
Regds
Gautham Kasinath
Stanley George
Ranch Hand

Joined: Dec 09, 2000
Posts: 55
hi gautham
u can mail me at stanley_t@usa.net
my yahoo messenger handle is indigoneptune
i'm interesed in real time java too...
glad to know that we share similar interests.

gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi! Stanley!!
well I just added u to my list..
well actually i m interested not only in real time Java but every ting under the SUN..

anyway have you found a solution on streamed audio?? well I did go thru some materials on the JMF but I cudnt quite understand it.. I shall give it a few more parses and get bak to you.
regds
Gautham Kasinath
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hey! Dont ne One know About Java SOUND???!!