That OpenMHA link is great. It's not specific to Teensy, but it is still good work.
If you want something that is more specific to Teensy, you should look at what the Tympan folks have done (I'm a founding member). Like OpenMHA, Tympan is also aimed at Hearing Aid researchers...but unlike OpenMHA,
Tympan is a Teensy.
You can use Tympan algorithms directly in your Teensy project.
The Tympan project is about both hardware and software, but you can use just the software. While the Tympan hardware is nice (it is a Teensy 4.1 with better audio and a bunch of other extras), the Teensy audio card is much cheaper. So, if you just want to use the Tympan Library with your normal Teensy hardware, that's great!
The Tympan Audio Library is built on the Teensy Audio Library, so it won't be alien. Just like the Teensy audio library, you use it within the Arduino IDE and you compile it just like any other Teensy program. It includes lots of examples. The Tympan Library is here:
https://github.com/Tympan/Tympan_Library
Here is the noise reduction example: https://github.com/Tympan/Tympan_Li...omain/NoiseReduction_FD/NoiseReduction_FD.ino
This example calls the noise reduction processing block. The processing block ("AudioEffectNoiseReduction_FD_F32") is defined right there on another tab within the example. If you look at this example, you'll see that it does the noise reduction in the frequency domain, which means that it does an FFT -> does the noise reduction -> does an IFFT. This is a common framework for noise reduction algorithms, though there are many variations within this framework.
The core idea with this particular algorithm is that it estimates the "noise level" by keeping track of the long-term average loudness at each frequency. Having this threshold for what is "noise" and what is "signal", it can now operate on in-coming audio to reduce the noise. This algorithm declares that anything louder than the "noise level" must be good signal and is let through. But, anything that is near the noise level (or quieter) is considered bad and is attenuated. Because good/bad decision is being done for each frequency, it can really slice around the good signal to attenuate the noise.
Do be aware that the example code does assume that you're using the Tympan hardware. The core algorithm doesn't care, but the overll program assumes that the audio is coming in/out of the Tympan audio interface. If you're using the Teensy audio board instead of a Tympan, you'll need to modify the example. Specifically, you'll need to:
- Swap out (or comment out) all of lines referring to "myTympan". These are the lines that control the audio hardware, so they fill the same role as the Teensy audio library's calls to AudioControlSTGL5000.
- Comment out the lines invoking the Bluetooth (BLE) system. Unless you have a Tympan, your Teensy audio hardware has no bluetooth system.
The Tympan Library also has a couple of LMS algorithms, but these are a lot harder to work with, so I'd stick with the example showing the frequency-domain noise reduction.
Chip