Note that there are some explanatory texts on larger screens.

plurals
  1. POGiven an audio stream, find when a door slams (sound pressure level calculation?)
    text
    copied!<p>Not unlike a clap detector ("Clap on! <em>clap clap</em> Clap off! <em>clap clap</em> Clap on, clap off, the Clapper! <em>clap clap</em> ") I need to detect when a door closes. This is in a vehicle, which is easier than a room or household door:</p> <p>Listen: <a href="http://ubasics.com/so/van_driver_door_closing.wav" rel="nofollow noreferrer">http://ubasics.com/so/van_driver_door_closing.wav</a></p> <p>Look:<br> <a href="http://flickr.com/photos/adavis/3241829861/" rel="nofollow noreferrer"> <img src="https://farm4.static.flickr.com/3491/3241829861_4b8311e8ca.jpg" alt="image of waveform shows steady line, then sudden disruption, settling down to steady line"> </a></p> <p>It's sampling at 16bits 4khz, and I'd like to avoid lots of processing or storage of samples.</p> <p>When you look at it in audacity or another waveform tool it's quite distinctive, and almost always clips due to the increase in sound pressure in the vehicle - even when the windows and other doors are open:</p> <p>Listen: <a href="http://ubasics.com/so/van_driverdoorclosing_slidingdoorsopen_windowsopen_engineon.wav" rel="nofollow noreferrer">http://ubasics.com/so/van_driverdoorclosing_slidingdoorsopen_windowsopen_engineon.wav</a></p> <p>Look:<br> <a href="http://flickr.com/photos/adavis/3241829885/" rel="nofollow noreferrer"> <img src="https://farm4.static.flickr.com/3517/3241829885_6bc30b6ef1.jpg" alt="alt text"> </a></p> <p>I expect there's a relatively simple algorithm that would take readings at 4kHz, 8 bits, and keep track of the 'steady state'. When the algorithm detects a significant increase in the sound level it would mark the spot.</p> <ul> <li>What are your thoughts? </li> <li>How would you detect this event?</li> <li>Are there code examples of sound pressure level calculations that might help?</li> <li>Can I get away with less frequent sampling (1kHz or even slower?)</li> </ul> <p><strong>Update:</strong> Playing with Octave (open source numerical analysis - similar to Matlab) and seeing if the root mean square will give me what I need (which results in something very similar to the SPL)</p> <p><strong>Update2:</strong> Computing the RMS finds the door close easily in the simple case:<br> <a href="http://flickr.com/photos/adavis/3242677587/" rel="nofollow noreferrer"> <img src="https://farm4.static.flickr.com/3518/3242677587_e6c7b0df18_m.jpg" alt="alt text"> </a> <a href="http://flickr.com/photos/adavis/3243509994/" rel="nofollow noreferrer"> <img src="https://farm4.static.flickr.com/3405/3243509994_7f0eb52d21_m.jpg" alt="alt text"> </a><br> Now I just need to look at the difficult cases (radio on, heat/air on high, etc). The CFAR looks really interesting - I know I'm going to have to use an adaptive algorithm, and CFAR certainly fits the bill.</p> <p>-Adam</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload