GithubHelp home page GithubHelp logo

spl-meter-with-rpi's Introduction

Raspberry Pi SPL meter

  • Sound Pressur Level meter with RPI implemented with Python.
  • Author: Seyoung Park
  • Date: 2016 Feb. 23rd

Demo

demo

Requirements

HW

  • Raspberry Pi(1 or 2)
  • Microphone (Webcam)

Docker

I made a Docker image for non-gui version.

# Run this command at the project dir
# Pull the image
docker pull shinyeyes/rpi-spl-meter:v0.1

# Enter the container
docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb shinyeyes/rpi-spl-meter:v0.1

# Run this command in the container
$HOME/miniconda/envs/spl-meter/bin/python spl_meter_text.py

GUI version

SW

  • Python 2
  • EasyProcess==0.2.2
  • numpy==1.10.4
  • PyAudio==0.2.9
  • PyVirtualDisplay==0.1.5
  • scipy==0.17.0
  • selenium==2.52.0
  • wheel==0.24.0

Filter: A-weighting

I applied A-weighting to filter to filter the stream. A-weighting results frequencies which average person can hear. For further information read: Frequency Weightings - A-Weighted, C-Weighted or Z-Weighted? For the actual programmatic implementation I borrowed the code from endolith and is saved as /spl_lib.py. A-weighting() is translated from [MATLAB script](: http://www.mathworks.com/matlabcentral/fileexchange/69).

spl-meter-with-rpi's People

Contributors

supershinyeyes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spl-meter-with-rpi's Issues

[Errno -9981] Input overflowed follow by [Errno -9988] Stream closed

Hello,
I ran in the same problem as servas089 (He solve his problem with [https://raspberrypi.stackexchange.com/questions/47045/hcitool-scan-says-no-such-device]).

First reading fine (read the dB(A) correctly) then Error Input overflowed follow by Error stackhoverflow

(1) Error recording: [Errno -9981] Input overflowed
(2) Error recording: [Errno -9988] Stream closed
(3) Error recording: [Errno -9988] Stream closed
Traceback (most recent call last):
File "/home/pi/Bureau/spl-meter-with-RPi-master/spl_meter.py", line 116, in
listen()
File "/home/pi/Bureau/spl-meter-with-RPi-master/spl_meter.py", line 91, in listen
print(" (%d) Error recording: %s" % (error_count, e))
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1356, in write
return self.shell.write(s, self.tags)
KeyboardInterrupt

The code is not tweaked, on Pi 2 B. I try a lot of Chunk and Rate number with no sucess.

There is a USB microphone plug to the Pi (the first reading varie according to the noise, so I assume the microphone is not faulty ?).

I really a # noob at Pi and programming but good in Acoustics.

I installed all the prerequisite (pyaudio, selenium, etc) but I don't know if I must take the new one or the prerequisite with theyre version number.

I am very sorry to bother you, I think it's my poor knowledge of the programming and Pi stuff that lead me to this point.

It seem that servas089 as a Pi 3, let me know if you think that I must buy a Pi 3 instead of a Pi 2.

All help will be very appreciated

Yannick

For more information there is the Python consol output:

====== RESTART: /home/pi/Bureau/spl-meter-with-RPi-master/spl_meter.py ======
Listening
A-weighted: +24.10 dB
update_max_if_new_is_larger_than_max called
max observed
(1) Error recording: [Errno -9981] Input overflowed
(2) Error recording: [Errno -9988] Stream closed
(3) Error recording: [Errno -9988] Stream closed

Traceback (most recent call last):
File "/home/pi/Bureau/spl-meter-with-RPi-master/spl_meter.py", line 116, in
listen()
File "/home/pi/Bureau/spl-meter-with-RPi-master/spl_meter.py", line 91, in listen
print(" (%d) Error recording: %s" % (error_count, e))
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1356, in write
return self.shell.write(s, self.tags)
KeyboardInterrupt

And for more information
Pi 2B
pi@raspberrypi:~ $ cat /proc/asound/cards
0 [ALSA ]: bcm2835 - bcm2835 ALSA
bcm2835 ALSA
1 [Device ]: USB-Audio - USB PnP Sound Device
C-Media Electronics Inc. USB PnP Sound Device at usb-3f980000.usb-1.5, full spe

Error recording: [Errno -9988] Stream closed

Hi, am trying to implement your project. I am almost done. One (initial) single value is displayed in the browser and written to the 2 log files. Unfortunately it directly exits the program with the following error message:

(96097) Error recording: [Errno -9988] Stream closed
(96098) Error recording: [Errno -9988] Stream closed
(96099) Error recording: [Errno -9988] Stream closed
Traceback (most recent call last):
File "spl_meter.py", line 117, in
listen()
File "spl_meter.py", line 92, in listen
print(" (%d) Error recording: %s" % (error_count, e))

Maybe this is something because of the CHUNK value. I have tried serveral values withou success, but I am also not sure how to calculate the correct and value and if it is the cause of the error.

Looking for any kind of ideas that make me the next step.

thanks
kr

Docker pull not found

Hi,

It appears the docker container is no longer hosted on Docker Hub

"Error response from daemon: manifest for shinyeyes/rpi-spl-meter:v0.1 not found"

HOW TO RUN

Hello Shin,

I have installed all the libraries you have suggested and I changed the rate but when I run spl_meter.py an error stating that init driver cannot run. please help me to solve the error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.