psykulsk / RpiANC

Active Noise Control on Raspberry Pi
MIT License
116 stars 20 forks source link

Playback underruns and capture overruns #7

Closed johens closed 1 year ago

johens commented 1 year ago

Hi psykulsk,

Thank you for your build! I was trying to implement your build in an Raspberry Pi 4B+ to try my hands on the RPi ANC for the 64bit Raspberry Pi OS (w Desktop). I can successfully build this on the Pi 4B+. While trying to run ./ffANC in the build directory, I am getting playback underruns and capture overruns on my playback/capture device. Is there a way around this?

psykulsk commented 1 year ago

Hello johens, thanks for you interest in this project.

To get rid of underruns and overruns, you may have to modify those values https://github.com/psykulsk/RpiANC/blob/master/Headers/constants.h#L182-L185 and recompile. Playback underrun and capture overrun suggests that the process does not read input samples fast enough and does not write them fast enough to the output after processing. You can try to run the record_noise.cpp that does not do any processing and see if you see the same issues there. If yes, you may have to modify the consant values linked above. If no, then it seems like the processing is too slow.

When I was working on this project I was using additional flags when executing that binary to give that process the highest priority. I also used linux real time kernel with real time priority for that process (although I'm not sure how much difference it made exactly).

Hopefully that helps!

johens commented 1 year ago

Thank you for your suggestion! I will try that :)