I am using the Bass/Treble equalizer code in my own project, but for some reason, when I use the bass/treble code, especially, the most recent
update, I am getting a lot of noise in the resulting audio. It is not just clipping, but severe noise. I think I am using the code properly.
I am trying to use the code and adapting it to C#.
The problem is not with the Bass and Treble effect.
If you zoom in close on the audio sample processed by you C# code you will see that there are discontinuities in the waveform.
My guess is that your code is processing in blocks of 160 samples but not correctly preserving the old sample value from one block to the next.
I don’t know C# so I’ll be no help with your code, but hopefully that gives you a clue.
I finally got a chance to revisit this issue within our code-base and figured out the problem. However, it only occurs in our scenario
since we are playing back audio as we are changing the the bass/treble gains.
Within the bass/treble code, there is a call to compute the coefficients for bass/treble which is done in the NewTrackPass1 method.
I realized that this call is done before processing the audio, and in audacity, you perform the bass/treble effect in the entire wave file
as oppose to being able to adjust it on the fly. So, this is done once.
In my case, NAudio processes playback (in my case), in 320 byte chucks. So, every time NAudio performs a read of the audio, I would
be initializing the coefficients and performing bass/treble effect whenever NAudio performs a “read”. I have since changed the logic
to only initialize the coefficients whenever there is a change. There is only slight static when I am in the process of changing the audio,
but when there are no dB changes, the audio playback doesn’t exhibit the static in the sample WAVE file I have provided.
This is a huge improvement over what was previously in the code.
If there is anyone that needs some clarification, please let me know.