LMS for ANC with teensy audio board

Status
Not open for further replies.

phonoptics

New member
Hi everyone,

I am currently looking to use teensy 3.6 and sgtl5000 in order to do some acoustic noise cancelling in real time thanks to LMS filtering.

Does anyone already tried this ? I found some stuffs about the subject on matlab : https://fr.mathworks.com/help/dsp/examples/acoustic-noise-cancellation-lms.html

or labview http://www.ni.com/example/31218/en/

and also with arduino : https://github.com/wespo/LMS/blob/master/examples/PPG/PPG.ino

howver it is not clear for me how to use it in real time.

It would be great if anyone could help to drive me to the solutions.

Cheers
 
Hi!
the ARM libraries make implementation of the LMS algorithms quite easy.
There are versions for fixed point and for floating point.

https://www.keil.com/pack/doc/CMSIS/DSP/html/group__LMS__NORM.html

If your realtime signal already has a good SNR, LMS can be very effective. Also an autonotch filter using LMS is very nice to eliminate annoying carriers/single tones.

However, in low SNR situations, a spectral noise reduction using spectral weighting outperforms the LMS algorithm easily.

We implemented three algorithms for the Teensy Convolution SDR:
- LMS
- leaky LMS (taken from the excellent wdsp library)
- spectral weighting

However, you would need to make the Teensy use floating point for all real time audio queuing in order to make the spectral weighting algorithm work.

You can find code for a Teensy 3.6.-based software defined radio using all three algorithms here:

https://github.com/DD4WH/Teensy-ConvolutionSDR/blob/master/Teensy_Convolution_SDR.ino

in the code, search for:

spectral_noise_reduction
LMS_NoiseReduction
void xanr ()

You can find a WIKI explaining spectral weighting algorithms here:

https://github.com/df8oe/UHSDR/wiki/Noise-reduction

Have fun!

All the best,

Frank DD4WH
 
Hi everyone,

I am currently looking to use teensy 3.6 and sgtl5000 in order to do some acoustic noise cancelling in real time thanks to LMS filtering.

Does anyone already tried this ? I found some stuffs about the subject on matlab : https://fr.mathworks.com/help/dsp/examples/acoustic-noise-cancellation-lms.html

or labview http://www.ni.com/example/31218/en/

and also with arduino : https://github.com/wespo/LMS/blob/master/examples/PPG/PPG.ino

howver it is not clear for me how to use it in real time.

It would be great if anyone could help to drive me to the solutions.

Cheers

Hello phonoptics,

I have implemented the FXLMS algorithm in the teensy 3.6 board (active noise control in headsets aplication), and it worked really well.

You can see the codes here https://www.researchgate.net/profile/Artur_Zorzo. But I coded in a completely non-optimized manner.

Artur Zorzo
 
Last edited:
Hi!
the ARM libraries make implementation of the LMS algorithms quite easy.
There are versions for fixed point and for floating point.

https://www.keil.com/pack/doc/CMSIS/DSP/html/group__LMS__NORM.html

If your realtime signal already has a good SNR, LMS can be very effective. Also an autonotch filter using LMS is very nice to eliminate annoying carriers/single tones.

However, in low SNR situations, a spectral noise reduction using spectral weighting outperforms the LMS algorithm easily.

We implemented three algorithms for the Teensy Convolution SDR:
- LMS
- leaky LMS (taken from the excellent wdsp library)
- spectral weighting

However, you would need to make the Teensy use floating point for all real time audio queuing in order to make the spectral weighting algorithm work.

You can find code for a Teensy 3.6.-based software defined radio using all three algorithms here:

https://github.com/DD4WH/Teensy-ConvolutionSDR/blob/master/Teensy_Convolution_SDR.ino

in the code, search for:

spectral_noise_reduction
LMS_NoiseReduction
void xanr ()

You can find a WIKI explaining spectral weighting algorithms here:

https://github.com/df8oe/UHSDR/wiki/Noise-reduction

Have fun!

All the best,

Frank DD4WH

Nice work Frank :)

Have you measured the sound attenuation of the LMS_NoiseReduction in an acoustic setup?

I really don't underestand how that would work with buffers.

One of the main algorithms for active noise cancellation (FXLMS) requires an adjustment filter (secondary path estimation) to prevent the code to become unstable, and is usually something like a 10 samples adjustment. The latency of 256 samples would turn the algorithm unstable for sure no? I thought this had to be implemented sample by sample. Would you have some insights about this? Im trying to improve my system :)

And spectral weighting only works well for stacionary noises doesn't it?


Thank you.

Artur Zorzo
 
Last edited:
Hi Artur,

no measurements, I just use my ears for judgement :).

I think you are talking about a different thing than I do: you are talking about a very special noise reduction algorithm designed to eliminate narrowband noise by producing "antinoise" (like in active noise cancelling headphones). Is that right?

My application is software defined radio, your application is probably active noise cancelling for headphones? I understand, that there you need extremely low latency in order to phase out ambient noise impulses.

I would call that a noise blanker designed specifically for impulse type noise.

The (normalized) LMS noise reduction and the spectral noise reduction we implemented are NRs to reduce quasi-stationary noise. However, the specific spectral noise reduction type we use is also capable of dealing with (relatively slow) dynamic changes in the noise.

The LMS implementations I use and the spectral NR I use work with buffers, like all the audio processing on the Teensy.

Hope that helps!

Have fun with the Teensy,

Frank
 
Yes Frank, ANC in headphones. Sorry about the confusion. I should have phrased it in a better way.

Anyway, nice work.

Artur Zorzo
 
Hi DD4WH!

I've been doing a little research on Voice Activity Detection which has led me to your work with the Convolution SDR. All your work is super impressive! Do you think the VAD you have implemented is suitable for a VOX application? I'm essentially making a teensy walkie talkie and looking for a better way to switch between transmit and receive than just using an input noise/energy threshold.

Thanks!!
 
I am not sure about the requirements of a VOX application, but I think a signal level measurement should be sufficient. You will not be that far from the mic in order to make reliable communication? So I think a simple signal level threshold will do. But you can also just try the VAD from the Teensy Convolution SDR code. However it is a lot of processing for such a simple task. I have no experience myself with VOX implementation, so you just have to try it out.

All the best,

Frank DD4WH
 
Status
Not open for further replies.
Back
Top