Adaptive feedback cancellation problem

Hey,

I have been using a Tympan REV F and I tried to implement Adaptive Feedback Cancelation using the examples from the tympan library, but when I upload it to tympan I get this message repeatedly “AudioFeedbackCancelNFXLMS_F32: falling behind? in_block = 116830, ring block = 65096” - the in_block keeps increasing and the ring block almost always stays the same.

In the code I have implemented 8 band WDRC and noise reduction + this (started with the WDRC_8BandFIR_Stereo example). I know that mixing WDRC and AFC can be tricky, but I don’t even have it activated when I’m getting these error messages, it’s immediately after I upload the code. Btw, my CPU usage is at 41,7%, so I know that this isn’t a “ran out of time” problem.

Any ideas?

Thanks!

You’re trying the Adaptive Feedback Cancellation!! Go you!

In general, adaptive feedback cancelation is a very difficult area. I was once told that, when a hearing aid company develops some new audio processing feature (not related to feedback cancelation), they spend have to spend half their budget on re-tuning the feedback cancelation part of the system. I don’t know if that’s true; but I do know that adaptive feedback cancelation is tricky.

For your work, I’m assuming that you first tried the built-in examples without any modifications? Did those examples work for you without the warning messages? I just recompiled example 02-BasicGain_wAFC_NFXLMS.ino and it seems to work fine here on my Tympan Rev F (using the current main branch of the Tympan_Library repository in Arduino 2.3.4).

Assuming that the examples work for you, too, the problem must be in how you adapted it to add the WDRC processing. Given that you said that in_block is incrementing by that ring_block does not, I’m wondering if maybe you didn’t connect the loopback block correctly?

From the example 02-BasicGain_wAFC_NFXLMS.ino, one sees that the following classes are created:

Then, a bit further down, they’re connected:

There are two key features here. The first is that the afc is connected right after the i2s_in. The second is that afc_loopback is connected to the output of whatever processing it is that you’re doing. In this case, the only processing is gain1. For you, it’ll be a whole bunch of other classes that you’ve created. For you, whatever you’re connecting to i2s_out, that’s what you should send to afc_loopback.

The final critical bit of connection that I want to mention happens in the setup() function.

As you can see, this line of code tells the afc_loopback class that it needs to connect to afc. This is how it actually closes the loop to do the adaptive feedback cancelation.

Is your code doing these things? Can you tell? If your code is on GitHub or whatever, you could provide a link and I’d be happy to look.