psykulsk / RpiANC

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

installation #3

Closed Greben28 closed 2 years ago

Greben28 commented 3 years ago

hello, a friend of mine wants to use this to do more research on active noise control, she downloaded the repository to her pi but does not know how to install/run your program, can you help?

psykulsk commented 3 years ago

Hello :)

To compile the project, follow the instructions in the readme: https://github.com/psykulsk/RpiANC#build-and-run-commands

To actually run it on a RaspberryPi and do some active noise control, you need to build yourself a setup similar to that one https://github.com/psykulsk/RpiANC#used-hardware . You can refer to some useful links on how to wire the microphones, etc. here https://github.com/psykulsk/RpiANC#useful-links-articles-etc.

After building the setup, you have to test the audio input and outputs, make sure you know the the device names and the buffer and period sizes (refer to the ALSA guides in the links mentioned above). After you know that those devices are working properly, you can modify the constants in this file https://github.com/psykulsk/RpiANC/blob/master/Headers/constants.h to match your devices names and properties. After that, try building and running the ffANC binary.

Unfortunately there is no ready to go procedure to generate the coefficients for the FX_FILTER (https://github.com/psykulsk/RpiANC/blob/master/Headers/constants.h#L23). I used the scripts here https://github.com/psykulsk/RpiANC/blob/master/Scripts/OctaveCode/lms_offlince_sec_path_modelling.m and here https://github.com/psykulsk/RpiANC/blob/master/Scripts/OctaveCode/rls_offline_sec_path_modelling.m to do that, but those are very rough and I do not advise to use them. I would advice to search the literature and articles for terms like "FXLMS secondary path modelling" or "ANC offline secondary path modelling".

Thank you very much for being interested in this code! Please note that this is a proof of concept that, so far, has worked and given results (for constant frequency noise only) on a single setup.

shadiakiki1986 commented 3 years ago

I got the following error

image

any suggestions?

psykulsk commented 3 years ago

I think you may be missing a package with python headers. Try installing it with (ubuntu command example) sudo apt-get install python-dev

Anja501 commented 3 years ago

Hello, when I build the program I get the following warning 2021-06-14-160921_1824x984_scrot Also when I run ffANC it doesn't work. Can you help me?

psykulsk commented 3 years ago

ffANC exited on this line in your case https://github.com/psykulsk/RpiANC/blob/9390ce50d81562ffde804e1f0d736bef300e4b4e/Sources/playback.cpp#L163

That means that your playback device does not support the 32 frames per period. You need to modify this constant https://github.com/psykulsk/RpiANC/blob/9390ce50d81562ffde804e1f0d736bef300e4b4e/Headers/constants.h#L182 to the value supported by your playback device (so currently probably 444) and recompile or change/reconfigure the device.

The warning affects just a logging message so you can ignore or fix it by changing %ld to %d in the line mentioned by the compiler.