473,394 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Playing sounds in java application

Hello I want to know why my applications stops responding for approx. 1 sec when I play sounds rapidly.

This is the method I use

private void playSound(int index)
{
//sound.stop();
sound = JApplet.newAudioClip(url[index]);
sound.play();
}



The index points to a specific URL array which keeps the location of the wav. file.
If I play sounds repeatiply say every 100ms the application stops responding for 1 sec. If I stop the previous sound with sound.stop() then itīs ok but I want the new sound to overlap the old one not to restart it.
Feb 25 '06 #1
5 5691
This is the second forum I have asked the same question without any reply. Can nobody help?
Feb 26 '06 #2
Niheel
2,460 Expert Mod 2GB
You don't want there to be a delay inbetween songs? Is this for a web-application or desktop application?
Feb 26 '06 #3
Itīs a desktop application. Im making a space-shooter game, when you click the fire button the space ship shoots laser and a laser sound is played. You can shoot very fast so when you fire the second laser the other laser-sound is already playing and the new laser sound overlaps the old one. The problem is when I fire rapidly the application stops responding for a second as if it canīt handle so many sounds at a time.
Feb 27 '06 #4
Using the sun.audio package seems to work much better, thanks for the link.
Mar 11 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Kiteman \(Canada\) | last post by:
Instead of a beep sound playing as an alarm or reminder I would like to be able to play a more interesting sound. On the web, I found and tried a sound routine that uses the SOUND.DRV but it does...
3
by: SOB-like MIDIs | last post by:
The applet for endlessly rising/falling scale (auditory illusion) on this page is fantastic! http://www.cs.ubc.ca/nest/imager/contributions/flinn/Illusions/ST/st.html How is this done?...
0
by: Put 030516 in email subj to get thru | last post by:
I'm trying to learn about Java MIDI programming. Specifically, I'm interested in playing with Java MIDI sequencers (all puns intended). I'm looking at...
2
by: beve | last post by:
Hi all, Here 's the trouble I've been dealing with for several days. I'm building a small game with JAVA and I would like to play sounds inside. Here's my code : try { testUrl = new...
1
by: Peter Schmitz | last post by:
Hi, I'm just trying to play a *.wav file, making use of the unmanaged function "sndPlaySoundA" in winmm.dll, but I still got one question: How can I avoid, that the sound file itself has to be...
1
by: Terry Olsen | last post by:
Using the following routine to play embedded wav files: Private Sub PlaySound(ByVal Sound As Int32) Select Case Sound Case 1 : My.Computer.Audio.Play(My.Resources.Sounds.GoOnline,...
1
by: glenn123 | last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre...
1
by: sandeepk84 | last post by:
Hi all... I wanted to add a functionality to my software for recording and playing sounds. Does anyone know how it can be done in java? How Sound API can be used? Even if it supports only some...
1
by: desturrr | last post by:
Hello all, I have small sized mp3 files that i can play via Java using JLayerPlayer that takes the address of mp3 files , JLayerPlayer objects can be played creating threads and starting. The...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.