Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: clicks/pops/static when playing short tones at a high rate

$
0
0
Got this working thanks to a helpful suggestion from Mark Heath. We're now doing the following and don't have the problem of clicking/popping artifacts when playing tones at a high rate.

1) We're using the FadeInOutSampleProvider in between the SineWaveProvider and the output player object. When requested to play a tone by the application, this is used to do a 5ms fade in and then fade out after the tone.

2) After the fade-out, we no longer call Stop() on the output player object. We just let it continue playing at 0 volume and then use a timer which, if no tones are requested for a period of time (1s) then calls Stop(). If another tone is requested before this times expires, we reset the timer, etc. This way we're not starting/stopping the player at such a high rate which was another source of the clicking/popping artifacts.

Hope this helps someone else!

Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>