Thursday, August 25, 2016

Figuring out my neighbors' schedules from leaking sound

All resources referenced in this post can be found here.

Unfortunately there is a fair amount of sound leakage between the apartments where I live. Mostly thuds originating from people closing doors, windows, cupboards, etc. If I stored metadata about every single thud in a database I could possibly get some interesting information from that data, such as my neighbors' schedules.

I decided to give this a try. For the recording I used a cheap stereo sound recorder (Olympus LS-12). To filter out the external sounds I had to write some code, process_recording.py. When sound passes through a wall or floor it is distorted, higher frequencies are dampened more than lower frequencies, so a lack of high frequency content is an indication that the sound may be external. The script works according to this principle, it looks at the frequency distribution and makes a decision on whether the sound originated from my neighbors or not. This worked pretty well in my environment, the false positive rate is close to 0% and the false negative rate is ~50%.

The "detect external sounds" algorithm ended up having 8 parameters that needed to be tuned. For the tuning I used a hill climbing approach. I constructed a tuning recording with 62 thuds and about an hour of environment sound. The tuning script randomly adjusted the parameters, processed the tuning recording, evaluated the result, and kept only the successful adjustments. This ran until I decided the tuning was good enough. A few days if I remember correctly. See tune.py for details.

Since I had a stereo sound recorder I thought it would be interesting to add sound angle to the metadata, to see if I could identify any sound source, so I did. The implementation uses phase correlation to get the delay between the channels and can be found in process_recording.py.

I couldn't find any tools suitable for analyzing the gathered data so I had to write some myself. The first one shows the number of thuds per hour over time, see sounds_per_hour.py for details.



As can be seen I did not chose the best time to gather data. First of all it was vacation times in Sweden, where I live, so people may be a bit less schedule bound than usually. Secondly there are some non-standard events in the period, a new neighbor moving in and repairs being done on the building.

My second analysis tool can select and show sounds according to a temporal pattern. The exact details on how it works are a bit difficult to explain but it can for example show you all weekdays combined into one diagram, or all Saturdays combined into one diagram. The implementation can be found in sound_viewer.py.

Lets start by looking at the angles for all sounds.



The banding is an expected result of the algorithm that calculates the sound angles so that can be disregarded.

A lot of action on the negative angles with a peak at -10 degrees. Unfortunately that does not point out any specific neighbor as both my neighboring apartments cover those angles.

Next lets look at how the thuds are distributed over time. Here are two diagrams showing how thuds are distributed over the day on Mondays to Fridays.


Someone gets up at 07:20 and something is happening at 11:30 and 17:00. Best times to relax are 21:00-00:00 and 02:00-10:00.

Lets look a bit closer at that 07:20 peak. Below are the angles for all the thuds that occur between 07:00-07:40 on Monday to Friday.

 


Only one neighboring apartment should be able to produce high positive angles so I'm pretty sure which apartment that is responsible for this peak.

Here are the weekend days.


The person that gets up at 07:20 sleeps in at the weekends, along with everyone else. Weekend daytime is a bit busier than during the weeks. Much of the 13:00 peak comes from a single event. I have a bit too little data for the weekend days so a single event can stand out in the diagram, but the general trends should be valid.

No comments:

Post a Comment