From a548e4ddb8260c9fe31d3f78fbfb3949b6609ac8 Mon Sep 17 00:00:00 2001 From: Ryan Carroll Date: Fri, 10 May 2024 16:16:44 -0400 Subject: [PATCH] modernize import and update readme --- README.md | 64 ++++++++++++++++++++------------------- northcliff_spl_monitor.py | 6 ++-- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 87f1cfd..7e8ce84 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ sudo apt-get update sudo apt-get upgrade -curl -sSL https://get.pimoroni.com/enviroplus | bash +Install the [Enviro+ Python library](https://learn.pimoroni.com/article/getting-started-with-enviro-plus#installing-the-enviro-python-library) -sudo pip3 install matplotlib +sudo pip3 install matplotlib ltr559 sudo python -m pip uninstall sounddevice @@ -43,35 +43,37 @@ Follow instructions at: https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-test including “Adding Volume Control” -Use the following instead of the documented text for ~/.asoundrc: - -1. #This section makes a reference to your I2S hardware, adjust the card name -2. #to what is shown in arecord -l after card x: before the name in [] -3. #You may have to adjust channel count also but stick with default first -4. pcm.dmic_hw { -5. type hw -6. card adau7002 -7. channels 2 -8. format S32_LE -9. } -10. -11. #This is the software volume control, it links to the hardware above and after -12. #saving the .asoundrc file you can type alsamixer, press F6 to select -13. #your I2S mic then F4 to set the recording volume and arrow up and down -14. #to adjust the volume -15. #After adjusting the volume - go for 50 percent at first, you can do -16. #something like -17. #arecord -D dmic_sv -c2 -r 48000 -f S32_LE -t wav -V mono -v myfile.wav -18. pcm.dmic_sv { -19. type softvol -20. slave.pcm dmic_hw -21. control { -22. name "Master Capture Volume" -23. card adau7002 -24. } -25. min_dB -3.0 -26. max_dB 30.0 -27. } +Use the following instead of the documented text for `~/.asoundrc` + +``` +#This section makes a reference to your I2S hardware, adjust the card name +#to what is shown in arecord -l after card x: before the name in [] +#You may have to adjust channel count also but stick with default first +pcm.dmic_hw { +type hw +card adau7002 +channels 2 +format S32_LE +} + +#This is the software volume control, it links to the hardware above and after +#saving the .asoundrc file you can type alsamixer, press F6 to select +#your I2S mic then F4 to set the recording volume and arrow up and down +#to adjust the volume +#After adjusting the volume - go for 50 percent at first, you can do +#something like +#arecord -D dmic_sv -c2 -r 48000 -f S32_LE -t wav -V mono -v myfile.wav +pcm.dmic_sv { +type softvol +slave.pcm dmic_hw +control { +name "Master Capture Volume" +card adau7002 +} +min_dB -3.0 +max_dB 30.0 +} +``` ------------------------------------------------- diff --git a/northcliff_spl_monitor.py b/northcliff_spl_monitor.py index 0aaffeb..f70e2c9 100644 --- a/northcliff_spl_monitor.py +++ b/northcliff_spl_monitor.py @@ -1,4 +1,4 @@ -import ST7735 +import st7735 from PIL import Image, ImageDraw, ImageFont from fonts.ttf import RobotoMedium as UserFont import sounddevice as sd @@ -267,9 +267,9 @@ def run(self): print("Keyboard Interrupt") # Set up display -disp = ST7735.ST7735( +disp = st7735.ST7735( port=0, - cs=ST7735.BG_SPI_CS_FRONT, + cs=st7735.BG_SPI_CS_FRONT, dc=9, backlight=12, rotation=270)