voice-engine / ec

Echo Canceller, part of Voice Engine project
GNU General Public License v3.0
240 stars 69 forks source link

ec_hw auto channel detection #27

Open jacopomaroli opened 1 year ago

jacopomaroli commented 1 year ago

Hey there, I added a couple of new features:

automatic channel detection: listens noise on every channel with the assumption that no audio is playing, therefore the humming from mics should be louder than a completely dead channels (there's a "bump" noise at the beginning but it gets discarded thanks to a short envelope window). I tried to make things better with this PR https://github.com/respeaker/seeed-voicecard/issues/309#issuecomment-1411115145 but I see that sometimes it doesn't work so I took out the big guns :D

multiple hw ref channels: reespeker 6 mic module has 2 loopback channels. IDK the difference between the two but I allowed the possibility to select both of them so ppl are free to experiment

speex preprocessing: residual echo cancellation from speex improves slighly the output quality for a very small increase of CPU consumption. It's pretty much free to enable so I thought to just add it. I also added some other preprocess filters but left them commented out, this way people will be free to experiment without spending too much time researching how to enable them.

aligned the code across ec and ec_hw: this way should be easier comparing them side by side and keeping them aligned

free speex echo state: it's always a good thing freeing up resources; since I added the preprocess thing and freed it, I thought to add it also for the echo state. why not :)

clang based linting: to help maintaining coding style for new contributions

============

I'm open to suggestions and improvements on this PR. Let me know if there's anything related to code, style, concepts or algorithims you'd like to change and let's talk about it!