Jump to content
  • Advertisement
Sign in to follow this  
whitde

sound... remove pops

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a decoder for MOD music in a sound API and it works very well... only problem is some files have distinctive pops yet when I run these same files though another player... no pops. I used mod tracker to play the music as a benchmark and found some of the samples have inbuilt pops which inturn effects the resultant mixing. By looking at the WAV file I could see the pops seem to occur where the data suddenly jumps.. or if we were talking functions... it's not continuous. The only interpolation I have at the moment is nearest neighbor and linear. I know cubic spline or catmull rom will smooth the samples but mod tracker didn't have pops when it had no interpolation on the samples. Wondering if there is a way to remove pops as I go or whether the sample data can be processed before I use it. I also experimented and tried to anti alias the final output data for left and right channels which stopped aggressive changes but was just an experiment. Basically I made the new value equal to a weighted average of the last 5 samples. I would assume that if any samples suddenly stop before they complete this would also cause a pop as most/all seem to start and end with silence.

Share this post


Link to post
Share on other sites
Advertisement
Are you making sure not to write too large/small a value to the sound card? It could be wrapping over the maximum/minimum value, causing a pop (it won't/can't clip).

If the popping is in time with MOD samples starting or stopping this would indicate that might not be the problem. Are you handling signed/unsigned sample formats correctly?

Share this post


Link to post
Share on other sites
Quote:
Original post by benryves
Are you making sure not to write too large/small a value to the sound card? It could be wrapping over the maximum/minimum value, causing a pop (it won't/can't clip).

If the popping is in time with MOD samples starting or stopping this would indicate that might not be the problem. Are you handling signed/unsigned sample formats correctly?



Too save time when testing... I render/write the entire MOD to a 44100Hz WAV file that I can look at.

The values on average are only peaking around the 60% mark so clipping should not be an issue.

The mixing...well I must admit seems too easy so maybe I'm doing something wrong.

left sample = 0
right sample = 0

For each channel
- read the value of the sample (nearest neighbor, linear or cublic interpolation) (+/-127)
- multiply by channel volume (0-64)
- create a left sample by * pan value (0 - 128)
- create a right sample by * (128 - pan value)
- add the left and right sample data to an accumulator

After the channels have been iterated through the final value for the left and right channel is added to the stream (16 bit signed value).


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!