Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: LMS for ANC with teensy audio board

  1. #1
    Junior Member
    Join Date
    May 2018
    Posts
    3

    LMS for ANC with teensy audio board

    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/ex...ation-lms.html

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

    and also with arduino : https://github.com/wespo/LMS/blob/ma...es/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

  2. #2
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    302
    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/...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-Conv...lution_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

  3. #3
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by phonoptics View Post
    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/ex...ation-lms.html

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

    and also with arduino : https://github.com/wespo/LMS/blob/ma...es/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 by arturzorzo; 06-12-2018 at 04:16 PM.

  4. #4
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Quote Originally Posted by DD4WH View Post
    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/...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-Conv...lution_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 by arturzorzo; 06-12-2018 at 03:25 PM.

  5. #5
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    302
    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

  6. #6
    Junior Member
    Join Date
    Aug 2017
    Posts
    19
    Yes Frank, ANC in headphones. Sorry about the confusion. I should have phrased it in a better way.

    Anyway, nice work.

    Artur Zorzo

  7. #7
    Senior Member
    Join Date
    Oct 2015
    Location
    Vermont, USA
    Posts
    152
    Artur,

    I looked at your papers, but have you shared your code (such as via GitHub)?

    Chip
    https://openaudio.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •