|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Popping and Chirping When Playing Short Sounds on WindowsGreetings,
I am currently developing a multi-platform (Windows, OS X, Linux) computer game using OpenAL to handle music and sound effects. OpenAL has been very easy to work with, and thus everything is going great with the exception of two small problems on Windows XP and Vista. I have confirmed these problems on 3 different computers: an Intel Mac Mini running Windows XP (using Boot Camp), a Dell desktop running Windows XP, and an HP laptop running Windows Vista. These problems do not happen on the same Intel Mac Mini when it is booted into OS X. The first problem is that there is popping and chirping when the 3 shortest sound effects play. These sound effects are loaded from WAV files, and all of them fade out over the length of the sound. That is, I am not using OpenAL to fade the sounds out, but that the amplitude of the sound wave decreases. One of these sounds is 0.2 seconds long. This sound has less problems than the other two. There is merely an audible pop or click when the sound finishes. The other two sounds cause a chirping effect. These sounds are shorter, being 0.86 seconds each. All of the other sound effects in the game are > 0.25 seconds in length, and do not cause any problems. I am not using any attenuation on the sounds. I have tried setting the position and velocity (to 0) of the sound and the listener explicitly, but there was no difference. Using the debugger, I have made sure that I am getting the right data, frequency, format and size from the WAV file. All I am doing is creating a source, setting the pitch and gain on it, creating a buffer, filling it with the data from the WAV file, associating the source with the buffer, and calling alSourcePlay to play the source. So far, I have tried creating a buffer, three things to fix the problem. The first is to set the gain of the source to 0 or 0.001 when the sound has finished playing. This had no effect. Next, I attempted to make the buffer a minimum of 0.5 seconds. I did this by mallocing an ALvoid array of size 0.5 * frequency * 2, memsetting it to 0, and then copying the WAV data into the start of the array. I made sure that I was passing the size of the WAV file, and not the size of the array, to memcmp. This had no affect on OS X, and it did not fix the problem on WIndows. However, I noticed that the longer I made the buffer, the worse the problem became. Finally, I tried OpenAL Soft. This eliminated the problem with the longer of the three sound effects, and made the chirping less noticeable for the other two, but did not completely solve the problem. My other problem is perhaps not a problem with OpenAL itself. I am using OpenGL to do the graphics for the game, and SDL to set up the graphics context and handle input. If the game is in Windowed mode, and the player moves the window or minimizes it, the sound cuts out. Sources played with alSourcePlay after this point will play, but anything playing before the window is moved gets cut off. Again, this is not a problem on OS X, and using OpenAL Soft did not fix the issue. I would appreciate any help in solving either of these problems. - Michael Buckley _______________________________________________ Openal mailing list Openal@... http://opensource.creative.com/mailman/listinfo/openal |
|
|
Re: Popping and Chirping When Playing Short Sounds on WindowsOn Sunday 26 April 2009 12:40:18 pm Michael Buckley wrote:
> The first problem is that there is popping and chirping when the 3 > shortest sound effects play. These sound effects are loaded from WAV > files, and all of them fade out over the length of the sound. That is, > I am not using OpenAL to fade the sounds out, but that the amplitude > of the sound wave decreases. > > One of these sounds is 0.2 seconds long. This sound has less problems > than the other two. There is merely an audible pop or click when the > sound finishes. Hi. How are the sound files loaded into memory? The only things I can think of to cause the noise is either if: It's part of the sound; either by junk at the end, or the waveform not ending "cleanly", or.. It's being loaded incorrectly; sometimes .wav files will have extra chunks after the sample data, so if care isn't taken to not read beyond the data chunk, you can inadvertently read this errant data, or.. The specified size being given to alBufferData is too large; make sure the size given is the size of the data chunk. If you can, it may help if you can provide source for a small program that shows the problem (along with the offending .wav files). _______________________________________________ Openal mailing list Openal@... http://opensource.creative.com/mailman/listinfo/openal |
|
|
|
|
|
Re: Popping and Chirping When Playing Short Sounds on WindowsOn Monday 04 May 2009 9:06:57 pm Michael Buckley wrote:
> Hi, thank you for your prompt reply. I'm sorry I have not responded > until now. In preparing some source code to respond to your message, I > found that I was calling fread once after reaching the end of the > file. I wasn't actually doing anything with the buffer I was storing > the fread in, but, so I removed it. It eliminated the chirping, but > not the popping. > > Considering that I was having some problems with fread on Windows > before, I'm going to continue investigating to see if it's not > OpenAL-related. If I can definitely rule out other possibilities, I > will reply again with some source code illustrating the problem. > Meanwhile, I have uploaded the problematic WAV files to > http://angrymen.org/wav for anyone who is curious. The waves work fine for me, using ALURE+OpenAL Soft and aplay (ALSA sound player) in Linux. Since you mentioned problems with fread on Windows, also double-check that you're calling fopen with the "rb", or equivalent, mode. If you just use "r", it will open the file in text mode which transforms \r\n sequences into \n, and can mess up the returned data. _______________________________________________ Openal mailing list Openal@... http://opensource.creative.com/mailman/listinfo/openal |
| Free embeddable forum powered by Nabble | Forum Help |