25
$\begingroup$

L.Dutch made a worthwhile observation in an answer to a different question:

Moreover for close range shots there is almost no time to react and move the limb: for a shot fired at 20 m, with a speed of 200 m/s, you have only 0.1 s to have the limb in place to protect you (if you see the gun pointed at you) or even less if you have to react to the sound of the shot being fired (which reaches you at about 300 m/s).

Suppose our intrepid cyborg is not visually aware of the shot being fired. (Basically, it's "looking in another direction", whatever "looking" means for it.) Its first indication of the possible danger is when the leading edge of the shock wave from the bullet being fired reaches it at the speed of sound, approximately 300 m/s. If the shot is aimed at the cyborg and the bullet is either subsonic or supersonic, the shock wave is closely followed by the bullet itself, which is of course a problem; however, if the bullet is going in some other direction, then the cyborg will be able to detect the fact that a shot has been fired and remain operational.

For an alternative scenario, since lots of people have argued that the speed of the bullet is too low, you may freely choose to consider the following scenario instead: A person stands next to our intrepid cyborg, with both facing the same direction. The person fires the weapon along their mutual line of sight, such that the trajectory of the bullet takes it away from both of them. The cyborg does not visually observe the shot being fired.

Here, we aren't interested in actually dodging the bullet or really doing much of anything with the information, but rather only the processing that goes into determining the fact that a shot has been fired at all with a reasonable false positive rate (no claiming "shots fired!" when someone slams a door shut). To put this in software acceptance criteria terms, the cyborg only needs to set a single bit in a fixed memory location somewhere once a shot fired condition is detected; the time to do this particular write to memory can safely be approximated as instantaneous.

How long would the cyborg at a minimum need to, based on auditory cues alone and with a reasonable false positive rate, determine that a shot has been fired in its vicinity?

You may assume that the cyborg is able to fully process all audio input in real time, with no lag.

I have a feeling that Nyquist and Shannon are working against us here, but I don't know to what extent.

$\endgroup$
  • 56
    $\begingroup$ most firearms i know of have muzzle velocities between 380m/s and 760 m/s. At those speeds, the first thing the cyborg notices is the impact of the bullet. The sound arrives later. $\endgroup$ – Burki Apr 11 '17 at 7:21
  • 8
    $\begingroup$ @Burki my first thought: bullet arrives before sound. But the bullet may miss, or be aimed at something else, or be stopped by armour, in which case locating where it was shot from would be extremely valuable. BTW I have read about extant military hardware which can triangulate the origin of mortar or artillery fire. Locating the source of bullets may already have been solved, or if not, it is not a very big stretch. $\endgroup$ – nigel222 Apr 11 '17 at 10:14
  • 3
    $\begingroup$ Relevant: shotspotter.com an acoustic gunshot detection and location system already in use by 80 law enforcement agencies in the US. $\endgroup$ – Jörg W Mittag Apr 11 '17 at 10:18
  • 1
    $\begingroup$ @nigel222 if the bullet misses, it's velocity is irrelevant, and only the speed of sound and the distance matter. Since the referenced question was about dodging a bullet, and the velocity is given, i find it safe to assume the bullet is aimed at the cyborg in question. Yet it is only an assumption. $\endgroup$ – Burki Apr 11 '17 at 11:10
  • 5
    $\begingroup$ Note that 200 m/s is a very, very slow bullet. $\endgroup$ – Deolater Apr 11 '17 at 14:35
80
$\begingroup$

Disclosure: we (Sound Intelligence) sell this exact product.

The problem is not detecting a loud noise. That's actually quite easy. But the vast majority of loud noises aren't gunshots. Is your android going to duck every time a door is closed?

Another answer quoted 120 dB. That's at the standard measurement distance of 1 meter. Guess what? At that distance, you're dead anyway. We can safely ignore it.

So we're dealing with a gunshot 'sound that's not only attenuated by distance, but also we have reflections from the ground and walls. This will smear out the peak and make it a bit longer. It's still a pretty unique signature, especially if you are in a stationary environment. You can see how the sound decays, and compare it to the normal environment.

Other noises may be not as loud as a gunshot, but by being closer they end up at the same dB level at the microphone. Looking at the whole signature including reflections and decay, recognition becomes a lot easier.

So the practical answer is that we may need the full sound including several hundred milliseconds after the initial peak to distinguish it from perfectly normal sounds.

How much margin does that give us? Well, the bullet is traveling at about Mach 0.9, so the sounds leads by about 10%. Let's assume a shot fired from 100 meters away. That means the bullet arrives exactly 100 ms after the sounds - just enough to have a somewhat reliable detection, but not to react.

$\endgroup$
  • 9
    $\begingroup$ "... just enough to have a somewhat reliable detection, but not to react" said no cyborg salesman ever. $\endgroup$ – L0j1k Apr 12 '17 at 15:45
  • $\begingroup$ "The bullet is traveling at about Mach 0.9" Where did you get that from? The hypothetical 200m/s bullet in the question was traveling slower than mach 0.9, but such a bullet is not realistic anyway. For one, the bullet's speed is not constant, and two, if I recall correctly a bullet is likely to be going faster than mach 1 even once it reaches its target. $\endgroup$ – Loduwijk Apr 12 '17 at 18:16
  • $\begingroup$ @Aaron: Assumptions to see if it can work. Yes, bullets are usually supersonic until they hit, but there is in fact subsonic ammunition. That's still going to be high subsonic. Note that 200 m/s is Mach 0.7 or so. $\endgroup$ – MSalters Apr 13 '17 at 7:10
  • $\begingroup$ @L0j1k: it may still react fast enough for the second bullet, especially if the shooter is a human. That’s even useful if the robot itself is the target—you just need two robots… $\endgroup$ – Holger Apr 13 '17 at 11:49
  • $\begingroup$ @L0j1k: The biggest problem being of course that it fails on supersonic bullets. Fixable in-universe by explaining that since androids armies have this feature so they can avenge their fallen comrades, which leads to the use of less noisy subsonic ammo and silencers. Of course that makes the sound detection a bit harder, but hey - we're assuming real AI. Even puny AI's from early 21st century can detect gunshots. (Yes, we do train AI's for that today, although they're hybrids between self-trained and expert-trained. ) $\endgroup$ – MSalters Apr 13 '17 at 13:58
16
$\begingroup$

I think signal convolution between the sound and a prerecorded shot sound should suffice to determinate that is actually a shot (a trained human can easily separate shot from other sounds), and we admit that this computation is instantaneous. Thus, only the sound travel time must be taken into consideration.

The speed of sound at sea level and in ISA conditions (25°C, 1013.25 hPa, ...) is 340.29 m / s, thus the time to reach the cyborg "ear" is $$t = \frac{distance}{speed} = \frac{20}{340.29} = 0.058 s = 58ms$$

The main problem is that sentence

The shock wave, of course, is closely followed by the actual bullet itself.
is actually false. This is the problem when something has passed the sound barrier, the sound is behind the object. Thus, if your cyborg is shot, the bullet would reach them before any sound does. (In fact the shockwave created just on the tip of the bullet is ahead of the bullet and if you want to hear it you have to listen to the bullet tip... and you don't want to put your ear there).

$\endgroup$
  • $\begingroup$ The bullet in this example is travelling at 200 m/s. I don't know how you reach the conclusion that an object travelling at 200 m/s is moving faster than the speed of sound, whether that's 300 m/s or 340 m/s or 340.29 m/s. $\endgroup$ – a CVn Apr 11 '17 at 7:21
  • 1
    $\begingroup$ @MichaelKjörling The shockwave word led me to think that something was passing the sound barrier. But now I realize you meant deflagration probably. The calculation stays the same, the sound would be a lot more suppressed, but still audible at 20m (especially by a cyborg). $\endgroup$ – EngelOfChipolata Apr 11 '17 at 7:27
  • 10
    $\begingroup$ "I think signal convolution between the sound and a prerecorded shot sound suffice" - clearly you haven't actually tried this. It's got an astonishing low accuracy. As in, if you set the margins low enough t get a decent detection rate, you'll also detect pretty much every door closing. $\endgroup$ – MSalters Apr 11 '17 at 12:08
  • 9
    $\begingroup$ @MichaelKjörling if you are going science-based, you should first do a reality-check question about the bullet speed. Just doing a fiat on the bullet speed will waste all effort on being realistic on the sound detection. $\endgroup$ – Mindwin Apr 11 '17 at 12:29
  • 1
    $\begingroup$ @MichaelKjörling The bullet in a different question, which was cited as inspiration for this question, was travelling at 200m/s. Since 200m/s is an unrealistic estimate, we might as well ignore it unless question states otherwise. We should assume the bullet is supersonic. $\endgroup$ – Loduwijk Apr 12 '17 at 18:22
3
$\begingroup$

Let's assume the shot is fired at t=0.

The sound travel at about 340 m/s, therefore we have to rule out supersonic bullets, as they will hit the cyborg before it hears the shot.

For a subsonic shot, assuming the emitted sound spectrum is comparable with this one (source)

enter image description here

we have a peak frequency of 1 kHz, meaning that to have a complete oscillation of the pressure wave in the listening device of the cyborg we need at least 0.5 ms.

After this millisecond the cyborg has to locate the point from where the bullet is approaching. Proper triangulation would require 3 "ears" in different locations, if instead the cyborg has only 2 it will be able only to identify the line along which the bullet is travelling.

After having found the point of fire, the cyborg has to determine if the bullet is really approaching to hit, or if it was fired to another target.

$\endgroup$
  • $\begingroup$ I hope the cyborg does not need a complete oscillation of a vibration to hear it. It would be a regression since a human can hear a little under or overpressure. $\endgroup$ – EngelOfChipolata Apr 11 '17 at 6:57
  • $\begingroup$ @EngelOfChipolata I am afraid that just the pressure ramp up in the first quarter of a cycle would not be enough to generate a sound perception. Maybe half a cycle... $\endgroup$ – L.Dutch - Reinstate Monica Apr 11 '17 at 7:27
  • $\begingroup$ I don't think so, 120dB is huge, at 1kHz, most of people can hear about 20 dB SPL. So I think the cyborg can detect even less than the quarter of a period. $\endgroup$ – EngelOfChipolata Apr 11 '17 at 7:33
  • 2
    $\begingroup$ I am not talking about the pressure level (measure by the dB), but abouth the pressure variation. If you don't have half a period (pressure increase and pressure decrease) how can you discriminate the 1 kHz sound from any other pressure change with lower frequency? $\endgroup$ – L.Dutch - Reinstate Monica Apr 11 '17 at 7:45
  • 1
    $\begingroup$ You're doing harmonic analysis here on a signal that's about as non-harmonic as it gets. This is entirely meaningless. Then again, you're quoting a chemical engineering journal ?! $\endgroup$ – MSalters Apr 11 '17 at 12:14
3
$\begingroup$

To react to a sound compatible with a gunshot and assuming that it really is a shot and you're the target you can probably reckon on the dramatic increase in sound pressure being enough, but we could call it half a period of a 1 kHz wave, or 0.5 ms plus the distance divided by the speed of sound (propagation time) after the shot. The question is, is that enough to do anything, given that the bullet isn't far behind. Using metres and seconds from now on.

For a distance x and bullet speed v (assumed constant) we have a time t=0.0005 + x/340 - x/vin which to detect the sound and move out of the way.

If you imagine dropping all the way to the ground to dodge a bullet, with a cyborg that can essentially fold itself up instantaneously, you can consider that as a very first approximation to be falling half the cyborg's height -- lets say 1 metre -- based on the centre of mass. From the basic equations of motion we can find that it takes 1/sqrt(5) or 0.45 s to fall 1 metre. That would mean the reaction time is miniscule compared to the distance and difference in speeds and we can simplify, getting 340/v =1-(340*0.45)/x. For a 200m/s bullet that means a distance of around 220 m.

If your enemy always goes for headshots and you know you only need to duck the movement required drops to say 1/3 m and the time to around 0.25 s -- a distance of 120 m for your 200 m/s bullet

$\endgroup$
  • $\begingroup$ Nice thought! But the cyborg might move sideways, too, in which case he might be able co accelerate quicker than 1g, provided his grip on the ground is good enough. $\endgroup$ – Burki Apr 11 '17 at 11:24
  • $\begingroup$ @Burki or leaning on a wall with one superhuman hand -- but that's too many variables to consider here. The OP can build that in if a short range is implied by other elements of the story. $\endgroup$ – Chris H Apr 11 '17 at 11:33
  • 2
    $\begingroup$ "you can probably reckon on the dramatic increase in sound pressure being enough". Nope. There are far more sounds that have the same pattern. Quite a few percussion instruments have this characteristic. You'll get triggered all the time by music. $\endgroup$ – MSalters Apr 11 '17 at 12:09
  • 4
    $\begingroup$ @ChrisH: Annoyingly enough for us, speakers are a pretty bad way to fake gunshots. We'd like to use them to demo our product, but the problem is that a gunshot is created by creating several liters of (hot) smoke. A normal speaker can't move that much air that quickly. Now humans may say "that sounds believable to me", but human hearing is far from perfect. That's how MP3 compression can work; the computer calculates which parts are inaudible to puny humans. We can assume our android doesn't suffer from this. $\endgroup$ – MSalters Apr 11 '17 at 13:00
  • 1
    $\begingroup$ @ChrisH: Fireworks work pretty well, and are decently easy to source. Nailguns (as the name suggests) also sound like real guns. $\endgroup$ – MSalters Apr 11 '17 at 13:16
2
$\begingroup$

A couple of things to add...

  1. By definition, a supersonic bullet exceeds the speed of sound. If you are close enough, you will not hear it before it reaches your location, if it is fired in your direction. If it matters, most handgun ammunition is subsonic, while most rifle ammunition is supersonic.

    Of course, a bullet will not remain supersonic at any distance, it will slow down over time. However, a bullet meant for long-distance shooting may not slow below supersonic for 1000 meters or so. (Technically, the bullet is the projectile, and the cartridge and charge of powder are important in how fast the bullet can be pushed, but I'm blurring those distinctions.)

  2. There are two sounds associated with supersonic bullets: 1) the firing of the gun -- i.e. the powder "exploding" in the cartridge to propel the bullet down the barrel -- and 2) the shockwave from being supersonic. The shockwave follows closely behind the bullet, while the sound of the gun firing may be left farther behind. (It would not be unusual for a rifle bullet to be 2-3x the speed of sound.)

Quick Answer: Here's a really good paper on the subject. One graph in the paper indicates about 30 milliseconds for most of the audio -- muzzle blast through echoes -- to be received 9 meters from a rifle. Onto that, you'd add processing time, which I would guess would also be measured in the low milliseconds. The processing time should be fairly constant, and you could run multiple detectors -- optimized for different distances and directions of fire. The dominant times would be: a) how much of the 30 or so milliseconds your detector needs to see to make the call, and b) the distance of the gun from the cyborg -- depending on the direction of the fire.

My musings:

So it depends on the relationship of the cyborg to the bullet's path as to what it will hear. If the bullet is fired at or near the cyborg, and if the bullet it supersonic, the cyborg might first hear an impact -- though that would be hard to distinguish from other sounds -- followed by the shockwave from the bullet, followed by the "bang" of the gun, then echoes and reflections of the shockwave and the "bang".

If the bullet is subsonic, there will be no sonic crack, but if the bullet goes beyond the cyborg there may still be a fairly unique "zing" of a fast object flying by.

If the bullet is fired away from the cyborg, it will hear the "bang" first, then some of the sonic boom. And then a fair amount of reflections and echoes.

Loudness-wise, an unsurpressed rifle can be 160 dB very close by. (This is why suppressors or hearing protection are a big deal: percussive sounds like this will damage your hearing if greater than 140 dB. Remember that the dB scale is logarithmic.) Sound intensity falls off with the square of the distance, though if you're close there are probably not a lot of sounds in your city that are as loud as an unsuppressed gun, if only because of lawsuits for hearing damage.

Msalters' answer is fascinating. I imagine their product uses multiple sensors, spread out over city blocks, to triangulate the position of the shot. (Not an easy task due to reflections/echoes, etc.)

So, all that said, if you only intend for your cyborg to determine that a shot has been fired somewhere nearby, the time to detection would vary depending on whether the shot was fired towards or away from the cyborg (with supersonic bullets, at least). At an absolute minimum, if a supersonic bullet was fired at the cyborg, the shockwave would reach the cyborg in as little as 1/3 the time it would take the "bang" to propagate to the cyborg. At a maximum, the shot would be fired away from the cyborg and we'd have to wait for the "bang" at the speed of sound.

If you want to locate the shot, you would have to wait until multiple cyborgs hear the shot, and coordinate between themselves. (Or perhaps one cyborg that has a pretty long distance between its "ears", but echoes/reflections will still make it difficult.)

Actual recognition time is dominated by how much sound you need to hear to capture enough of a picture of the sound wave to try to identify it, followed by processing time. Considering you have cyborgs, I assume there is a lot of computing power, so that would add something on the order of a few milliseconds.

$\endgroup$
1
$\begingroup$

t of the sound of the shot (speed assumed as 300 m/s). It is the same as the shockwave.

To 'realize' the shot, there is a lag from when the sound is received by the sound sensor (or ear) to the processor (or brain), and the processing time deciphering and figuring out that the sound is indeed a gunshot. Both are ignored.

So, by assuming the distance is 20 m, then:

t1 = 20 / 300 = 0.067 s

That is the required time for the sound to reach the cyborg, if both input time and processing time is ignored.

$\endgroup$
0
$\begingroup$

Not only medium conditions but also type of firearm has to be taken into consideration: different firearmes produce different output spectrum at shot.

That being said the cyborg database could be filled with all the spectrum profiles of all the firearms in the world (way) OVERsampled to get for each weapon the most common one.

That being said, to identify a shot, a match should be done on the entire (as far as samplers can sample) spectrum width and not just one freq.

Now, still agreeing that we are looking for frequencies here, hence p variations and not levels, I anyway think that slightly more than a quarter period may suffice (for sure not less), that is the point where a full period, thus freq, evaluation can be made: if you know in how much time you reach the peek, you know how much the period is, 4x. This means we are looking for the lowest freq in the sampled spectrum, because its quarter period would the longest.

Of course this would require constant air pression monitoring to know where the 0 crossing is, to identify the first peek.

All this being said, because of the many variables involved, and the MANY more not mentioned (variation of base pressure before the first ramp, noise, and so forth...) I strongly doubt this would ever be possible with an impressive degree of correctness. Thus, if sometimes the cyborg would be positively identifing a shot and being able to somewhat react, the rest of the time the poor guy would just walk like a freak trying to avoid invisible bullets XD

AND all of this, in the kingdom of approximations of course

$\endgroup$
  • 2
    $\begingroup$ Heisenberg inequality: how detailed should that spectrum be? Because you need that much samples in your input. You can't get a 32000 bins spectrum out of 20000 samples. In fact, because it's a real signal, your spectrum is mirrored. You can't get 32000 real bins out of 60000 samples. $\endgroup$ – MSalters Apr 11 '17 at 13:05
  • 1
    $\begingroup$ Next issue: "the" spectrum of a gun doesn't exist. It depends on too many variables. To name but a dumb one: the combination of bullets and gun matters. The combination of gun and silencer matters. $\endgroup$ – MSalters Apr 11 '17 at 13:06
  • $\begingroup$ Well of course I'm not posing limits in samplers fequency capabilities... We should go as far as the highest frequency is asking for, oversampling at need! $\endgroup$ – Shockwaver Apr 11 '17 at 13:06
  • 1
    $\begingroup$ It's not (just) the highest frequency, it's the difference in adjacent frequencies in your spectrum. You're not going to do much with a spectrum that just contains 4 values, 10000/30000/50000/70000 Hz even though the second frequency is already much higher than humans can hear. The bins are simply too side then. $\endgroup$ – MSalters Apr 11 '17 at 13:09
  • 1
    $\begingroup$ You don't get to pick those frequencies, that's the Heisenberg inequality. Not even physics or computing, those limits are pure math. $\endgroup$ – MSalters Apr 11 '17 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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