1. I was creating an app the other day using sound and I noticed that when I rapidly changed the volume of the sound wave a popping sound occurred this is most likely interference and I wanted to know at what rate can I can volume to make the popping sound inaudible?

2.

3. The simple answer would be to keep the rate of change about proportional to the frequency, but that leaves out a lot of details.

4. Originally Posted by fiveworlds
I was creating an app the other day using sound and I noticed that when I rapidly changed the volume of the sound wave a popping sound occurred this is most likely interference and I wanted to know at what rate can I can volume to make the popping sound inaudible?
Its probably because the audio is read in as frames, and one volume coefficient is multiplied across an entire frame at a time, so there are audible pops between frames.

If you are programming this, you need to multiply individual samples, or at least sets of samples much smaller than the frames, by linear quantities between the volume of each frame. (make it go down in a smooth line)

5. I am programming this myself and I did notice the faster the frame rate of the game the more audible the pops which would be a change in the frequency of the running track along with the drop in the amplitude of the sound wave over time(the rate of volume change). When i get the sprite to jump etc I change the volume of the track. Now since the frequency affects the rate of the volume change I need the program to be able to calculate a reasonable average for this as an algorithm in case I want to use a different audio track or change the games frame rate while keeping my audio as clear as possible. I have seen android games that can change the frame rate as a slider and I doubt each audio clip was individually programmed for each value so it is most likely changed algorithmically.

6. Well, if you can get away with it, the easiest thing would probably be to install a "speed limit" thing that makes sure the volume doesn't jump too fast at any millisecond. So if its outputting say, 256 samples a frame, at 48000 htz audio that's 187 frames of audio a second. (probably less if its synced up with graphics frames) You need to figure out what these numbers are for your thing.

Then you would pass changes in volume to a to a thread that moves the audio level toward your desired level, but only in increments small enough not to make the noises, and only every (256/48000) seconds, (or whatever) sleeping in between and it stops when it gets to the right level. A side effect of this would be a quick change in the game in audio levels might come through as a fade over like 1/3rd of a second, when it was supposed to be near instant, but it would sound better and there'd be no pops.

7. I'm pretty sure you can get the volume to change faster than 1/3 of a second without popping. Also, while the frequency would affect what rate you would start hearing artifacts at, human hearing (and more specifically a single piece of audio) doesn't cover so wide of a range that you couldn't just guess at a decent average.

A game should be running at a fixed frame rate, so use that to your advantage. Each frame adjust the volume by a given amount towards your target volume. You'd just need to keep a target number and a counter around. (Or you could try adjusting it by a percentage of the difference if you want to avoid the counter, but that'd need some tweaking.)

8. A "sudden change in volume" is a "step function", and in frequency analysis, step functions are composed of a burst of frequencies, especially the higher frequencies. I think that you are hearing this burst of frequencies.

Have you tried ramping up/down the volume instead of using a step function? This should lessen the intensity of the pops.

Or, if your software can wait to change volume until at a "zero crossing", it might not pop. Zero crossings happen quite often, so the listener would probably not notice the wait. And this seems easier to implement than ramping.

9. Originally Posted by fiveworlds
I was creating an app the other day using sound and I noticed that when I rapidly changed the volume of the sound wave a popping sound occurred this is most likely interference and I wanted to know at what rate can I can volume to make the popping sound inaudible?
It's not "interference." As jmonroe correctly observed, this is a fundamental effect. A sudden change in volume is equivalent to multiplying a constant-amplitude signal by a "step" change in a coefficient. It is well-known from Fourier transforms that this multiplication generates an infinity of frequencies that you will hear as a pop.

The cure is to multiply by something with less spectral content than a step. A ramp is better than a step (and easy to program). A half-sine is better still. The more you stretch out the volume change, the less of a pop you'll hear.

10. Originally Posted by fiveworlds
I was creating an app the other day using sound and I noticed that when I rapidly changed the volume of the sound wave a popping sound occurred this is most likely interference and I wanted to know at what rate can I can volume to make the popping sound inaudible?
It's not "interference." As jmonroe correctly observed, this is a fundamental effect. A sudden change in volume is equivalent to multiplying a constant-amplitude signal by a "step" change in a coefficient. It is well-known from Fourier transforms that this multiplication generates an infinity of frequencies that you will hear as a pop.

The cure is to multiply by something with less spectral content than a step. A ramp is better than a step (and easy to program). A half-sine is better still. The more you stretch out the volume change, the less of a pop you'll hear.

 Bookmarks
##### Bookmarks
 Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Terms of Use Agreement