2
\$\begingroup\$

In my apartement I have the problem that when I am in my bedroom I can hear the neighbours in their bedroom exactly above me talking. Luckily I can not hear what they are saying but still pretty annoying.

First I thought that the sound travels directly trough my roof, but now I am not so sure since it is made of solid concrete. Our apartements are connected via 2 ventilation pipes that goes trough the concrete. My theory now is that the sound travels trough these pipes and trough my bedroom door.

I am looking to test this theory with some simple electronic equipment. I was thinking maybe a microphone outside my bedroom dor and one inside. By comparing timing and sound strength I should be able to tell if the sound travels trough the door or trough the roof. I have a raspberry pi zero and an arduino kit that I have not used yet. Maybe I could use these. What kind of microphone should i use? I want to use something small. Would two smallish PC speakers work? Are there any small high sensitive microphones that are not too expensive that I can use with the Raspberry or Arduino? First I thought that I should have a radiocontrolled button in my bedroom turning the system on but now I am thinking maybe the system should just record continuously and when I hear the neighbours I look at watch and note the exact time. Later I playback the sound from the SD cards on the two boards and make sure it is the neighbours and not myself snoring.

Any ideas on how to do this?

Are there some prebuilt systems like sound recorder that I could use?

\$\endgroup\$
  • 1
    \$\begingroup\$ Make life easier and block off the vent holes and see what happens. Make it a temporary block though. \$\endgroup\$ – Andy aka Feb 16 '18 at 14:39
  • 1
    \$\begingroup\$ You could try recording the stereo audio using your PC and then listen to it using headphones. Your brain can then process the signals and may be able to work out the direction of the sound. \$\endgroup\$ – HandyHowie Feb 16 '18 at 14:43
  • \$\begingroup\$ @HandyHowie: yes using my laptop is a great idea. where you thinking about using two usb microphones? or just one? anyway i could analyze the data in matlab and look at both time delay and db. \$\endgroup\$ – Andy Feb 16 '18 at 19:33
3
\$\begingroup\$

This was a fun problem to solve. I'll present the schematic, and inside of the schematic there will be some text which should explain how it works. Regarding the microphone, I'm no audiophile, all I know is that audio is based on frequencies, and without a DC point they will be crossing the zero voltage point, and that's the point I can focus on.

enter image description here

Link to simulation.

  • Upper left graph : The 1 kHz source at upper left
  • Bottom left graph : The 1 kHz source at bottom left
  • Upper middle graph : Input of the upper NAND gate
  • Bottom middle graph : Input of the bottom NAND gat
  • Upper right graph : Output of the upper NAND gate
  • Bottom right graph : Output of the bottom NAND gate

In the simulation, if you click the link above, then you can double click on the 1 khz sources and change the phase.

It says "Here for simulation" pointing to two RC filters, that is because there's some weird bug in the simulator, small spikes comes from the edge trigger when nothing is triggering, which can be seen in the middle graph's. If you were to make this schematic in the real world, then you would not add those two RC filters, the output of the edge trigger should go straight into the input of the NAND.

At the output of the upper right NAND there's a switch, it's there.. for the moment when the simulator crashes and the SR-state is undefined. So you should not add a switch there in real life.

The input of the edge trigger, you might want to use 10 nF instead of 100 nF.


This is how it looks like if the bottom 1 kHz source is phase shifted -45 degrees.

enter image description here

Notice how the two right graph's just swapped place.

You as a human will not be able to tell when they are blinking, your eyes will just see the average of the PWM signal, so you will clearly see that one LED lights up much more than the other one => know the direction.


In the simulation it's just 1 kHz sine waves, but the thing is that I'm only detecting zero crossings, so it doesn't matter if it's 10 khz or 20 kHz, the zero crossings still appear. And in the real world you'll never have pure sine waves, they will be added together. But yet again, the zero crossings will still occur at the same points.

And the reason for why I am focusing on phase shift is because the time delay between the microphones makes the sine wave keep rotating until it hits the other microphone, so the phase change is closely related to the time delay. But not equal to.


If you put microphones at your ears, then you will be able to tell if the source is coming from your right hemisphere or left hemisphere. You won't be able to distinguish if the sound is coming from front, above, back or below, so you could make two of these schematics, rotated 90 degrees. Equivalent to having one ear on the left side of your head and one on the right side => you can tell left hemisphere from right hemisphere. And then another microphone below your chin and one on top of your head => you can tell if the sound is coming from above or from below => you can pinpoint to where the sound is coming from and where the sound is going to.

I used the head example because that way you can visualize it as you are reading this answer. I am not recommending you to put microphones under your chin, that's just silly.

You could also just use 3 microphones and reuse one of the microphones. Connect them in a right triangle formation with the microphones at the corner of the triangle. The microphone at the 90 degree angle would be the one to reuse.


enter image description here

I'm no artist, but I believe it will behave like this.

So what happens in between when the source is much much to the side is dependent on the frequency of the incoming sound and the placement of the microphones.

Let's not forget about sounds bouncing off the walls and other noise sources..

But alright, let's assume you got the microphones like the upper middle of my doodle.

The sound source is 10 cm away vertically from the left microphone.
The sound source is 1 kHz
The right microphone is 1 cm away from the left microphone.
The hypotenuse of this right angle triangle is \$\sqrt{10^2+1^2}=\sqrt{101}\$ cm

What is the duty cycle of the left LED? (Like how bright will it be?)

Well the wavelength of a 1 kHz sine wave moving at speed of sound (343 m/s) is \$\lambda = \frac{v}{f} = \frac{343\text{ m/s}}{1000 \text{ Hz}} = 34.3 \text{ cm}\$

So the number of periods that will fit from the source to the microphone just below it will be \$\frac{10\text{ cm}}{34.3 \text{ cm}} \approx 0.291 \text{ periods} \$

And the number of periods that will fit in the \$\sqrt{101}\$ will be \$\frac{\sqrt{101}\text{ cm}}{34.3 \text{ cm}} \approx 0.293 \text{ periods} \$

The difference is a period of 0.02, this means that the left LED be on for 98% of the time, and the right LED will be on 2% of the time.

I'll tell you how it is for other frequencies to give you a feel for it, I won't show my math for it, it will be just like above.

  • 1 kHz => Left LED = 98.5% on
  • 5 kHz => Left LED = 92.7% on
  • 10 kHz => Left LED = 85.4% on
  • 20 kHz => Left LED = 70.9% on

The source hasn't moved, but the light of the LED indicates that it does. So it is... quite frequency dependent. And as you can see in this example, the source is only ~ 6 degrees off from the right microphone.

And as this source will move around, the phases will come back and overlap and... all weird things will happen... you'll get gibberish.

So... if you want to locate the source of the sound, then you kinda need to already know where it's already coming from and then point this roughly towards it, and then this device will help you with the last few degrees.

The closer the microphones are to each other, the fewer number of audible periods you can fit between them which in turn will reduce the gibberish.

If you manage to place the microphones the wave length of a 20 kHz (1.7 cm) away from each other, then you will be able to locate everything assuming you know the frequency of the incoming sound. You can find out what the incoming frequencies are with FFT.


Good luck on your venture.

\$\endgroup\$
  • \$\begingroup\$ Thank you Harry! This looks great. So do I understand you correctly: the first arrival/ closest to source channel will light up its LED the most? So if I see the top LED lighting most of the time this means that the top receiver is the closest to the source? \$\endgroup\$ – Andy Feb 16 '18 at 19:42
  • \$\begingroup\$ @Andy It will light up the most often which your eyes will interpret as light up the most. \$\endgroup\$ – Harry Svensson Feb 16 '18 at 19:52
  • \$\begingroup\$ @Andy I added an image showing how I think it will behave. I'm not 100% sure, it's like programming a microcontroller without ever testing it. There may be bugs, or something wrong, I'm not 100% certain. - it also depends on how far away you have placed the microphones, having them next to each other with 1 mm space between them might give you other results than having them spaced apart 30 cm. - If I were to make this I would put the microphones really close. Like your nostrils. \$\endgroup\$ – Harry Svensson Feb 16 '18 at 20:28
3
\$\begingroup\$

I don't know about what microphones to use (any decent quality should do).

However, the idea is to use 2 microphones on a distance. By receiving signals from both microphones you can compare which one is receiving louder/has more delay and detect the source. You might have to move the microphones or play with distances to find the best results.

This is approximately the same as how humans hear from what direction a sound comes.

When using an Arduino you cannot record the sound, you could do with any sound recorder probably (depending on the memory to store the sound). However, you can easily log the microphone data (yes/no sound) and store that metadata on an SD card, and listen back via the voice recorder (unconnected).

\$\endgroup\$
  • 1
    \$\begingroup\$ well, pretty sure human hearing incorporates delay, not primarily volume differences. \$\endgroup\$ – Marcus Müller Feb 16 '18 at 14:27
  • \$\begingroup\$ @MarcusMüller Thanks, you are right, that might be even more important (add it in my answer, thanks) \$\endgroup\$ – Michel Keijzers Feb 16 '18 at 14:29
  • 1
    \$\begingroup\$ I didn't do nothing at all ;) have my upvote! \$\endgroup\$ – Marcus Müller Feb 16 '18 at 14:31
  • 1
    \$\begingroup\$ Here they say it's the combination of the "clues", such as amplitude, timings, loss of frequency and others. \$\endgroup\$ – Eugene Sh. Feb 16 '18 at 15:44
  • 1
    \$\begingroup\$ Yes, I looked it up after my first comment, just as an update, not to argue.. \$\endgroup\$ – Eugene Sh. Feb 16 '18 at 16:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.