• ### Popular Now

• 10
• 10
• 12
• 12
• 14

#### Archived

This topic is now archived and is closed to further replies.

# [java] Java sound?? Does it even exist

This topic is 5669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Am I going crazy, or does java completely lack in the sound department? Ok, ok, I know it''s there, but I''m having one heck of a time getting to it. What I''ve got is something like this:

Applet tempApplet = new Applet();

{
AudioClip ac;
ac = Applet.getSound(getCodeBase(),soundName+".wav");
return ac;
}

public void playSound(AudioClip ac)
{
ac.Play();
}

If I do this or something similar, I get it to compile and run fine, execpt no sound, or if I use slightly different methods, I get an incorect format error. Basically I''m looking for either some tuts or someone to tell me howw to chage the format. By the way I have looked and the javagaming tutorials for this, but I just want something as simple as possible and easy to understand. THanks a ton.

##### Share on other sites
No, Java does have sound capabilities. I''ve never worked with them myself. My partner actually put together some voice recognition code in Java that accessed a database upon verbal command. It was pretty cool, but it wasn''t easy. Keep trying. In the meantime, this post I''m making will bump this question back up to the top for you.

Looking for an honest video game publisher? Visit www.gamethoughts.com

##### Share on other sites
I think the sound has to be in .au format. I am not 100% sure about that, but that is the way it has always worked for me. I could never get .wav sounds to play either, but if I converted them to .au they would play. GoldWave is a good free program that can convert wav to au. Good luck!

##### Share on other sites
If you had visited Google and searched for Java Sound you would have found this was the first result.

##### Share on other sites
quote:
Sun''s reference implementation for the Java Sound API, also known as the Java Sound engine, is a 64 channel audio rendering and MIDI controlled sound synthesis engine which offers reliable, high quality sound on all JavaTM 2 Platforms. This implementation also supports a set of high-quality General MIDI sound banks.

Nice try, oh wise one, but I don''t think that is what he is looking for, since he mentioned WAV and not MIDI.

##### Share on other sites
quote:
Original post by Mr Bakbugawk
Nice try, oh wise one, but I don''t think that is what he is looking for, since he mentioned WAV and not MIDI.

Forgive me good sir, but I assumed that the javax.sound.sampled API would do the trick. Thankfully you''re here to point out my ignorance.

##### Share on other sites
[quote
Nice try, oh wise one, but I don''t think that is what he is looking for, since he mentioned WAV and not MIDI.

What wayfarerX was doing is encouraging Jonbca to use the excellent search facilities that are made available to people (such as google). It helps him/her help him/herself.

On the other hand, you do need to read what''s been posted, not just glance at the first line, and make your own conclusions. In fact, it does say audio playback and recording on the first line and what you quoted wasn''t the first line.

Hope I didn''t come across as being too confrontational.

##### Share on other sites
Since you''re using it in an applet, odds are you''re trying it out under IE, which supports only .AU sound files. It is possible to play .WAV and .MID on the JRE 1.3 (and later), but not on the previous versions (I only use those two sound types on independent programs, since IE has a share of around 90%... at least on the people who visit my sites).

Pedro Amaro (http://pedroamaro.pt.vu)

##### Share on other sites
quote:
Original post by Viro
[quote
What wayfarerX was doing is encouraging Jonbca to use the excellent search facilities that are made available to people (such as google). It helps him/her help him/herself.
Forums, Books and Newspapers are also made available to people...why can''t some people let others try to obtain the information needed in the way they want it? Maybe you like google, maybe he doesn''t. Why don''t we close the forums or simply implement an algorithm that parses the post for some words and then makes an automated reply "use google, type "xxx yyy zzz"...?!?

##### Share on other sites
quote:
Original post by EgonOlsen
Forums, Books and Newspapers are also made available to people...why can't some people let others try to obtain the information needed in the way they want it? Maybe you like google, maybe he doesn't. Why don't we close the forums or simply implement an algorithm that parses the post for some words and then makes an automated reply "use google, type "xxx yyy zzz"...?!?

Information is available on the internet. Load of it even. If you took a look at WayfarerX's post, he posted the direct link to what was asked, and pointed to google, because that's probably where he got the link from. He didn't play the poster down.

As for the original post, he's looking for some tuts, which he clearly got. I know it probably sounds rude and elitist, but you should make an effort to search for stuff, before asking.

EDIT: Found another site using Yahoo that may be off use. JAvasound resources

[edited by - Viro on October 18, 2002 4:10:56 AM]