I am trying to automate the recording of when, and how long for a certain audio "Alarm" goes off. This alarm is located about 30 feet from our house and the alarm can be going off for anywhere from 2 mins to 30+ mins.
I need to use my PC (which is on 24-7) and its microphone (which i can point towards the source of the sound) to take a note of when and for how long the alarm sound is operating. I was thinking of using some speech recognition program for this but am unsure if this would work for the "Wa Wa Wa" of an alarm and not speech as is intended in these applications.
I'm a VB programmer by trade so probably would be able to build something to do this if I just knew where to begin. . .
it would be sort of like a motion dector security system but being triggered by a specific sound instead of motion on a camera (the sound in question is on a very short repeating loop)
does anyone have some usefull pointers on how something like this could be achieved?
I'd just use something like CoolEdit and record for twelve or twenty four hours. If you start at 12AM then you'd have a good map of exactly when it went off - you'd just read off the time tick marks. With modern large hard disk drives, you can record quite a bit of audio on a PC.
We did a similar thing when we were concerned that the dog was barking in the crate when we were out. You get a mostly flat audio file with a few small bumps. It's very easy to zoom in on the little "bumps" that will show in the audio file. I am sure a wa-wa siren has a pretty distinct looking signature.
If you're looking for proof you can take to court, you might have to get a little more sophisticated.
DragonDictate can be set up to run macros based on word recognition. I assume it could be set up to recognize your warble as a "command word" and then excute a Word macro that adds a date/time stamp to a text file. I've never tried it though. My experiment trying to decode dog barks was pretty poor, if that's worth anything. I do have DragonDictate running in the other room and I do have a warbling piezo siren . . .
Even if it could be made to do that, I think it would be pretty worthless for evidentiary purposes, though because someone could claim those were car horns or geese honking. I assume this has got some element of a dispute to it.
I'd still vote for CoolEdit (or any number of WAV or MP3 recording programs) set so that a day's worth of sound could be archived to CDRW. Your evidence would be far more solid since you could print out the CoolEdit wave files showing the unique shape of the sound (I am assuming a warble alarm will make a very noticeably uniform set of sine waves) with the time markers at the bottom of the readout showing exactly when they occurred.
You can also add control sounds, like your car horn honking in your driveway, to illustrate the relative loudness of the siren.
I'd imagine you should be able to get sound level data from the audio input software API. If you're writing an app it'd seem practical to keep a buffer running in a loop, monitor a given audio level and then sample for a frequency should the level exceed the threshold. As in, don't bother recording if the sound isn't from the device you're trying to monitor (dog barking, passing police car, kids playing ball, etc). VB.Net should make it pretty straightfoward to get to the various APIs.
The ca. 1999 Savoy Cyberhouse home automation software that I use has a function module called "Listen" that can be trained to detect and respond via rule sets to arbitrary environmental sounds such as alarm, clothes dryer, furnace blower, etc for which it is trained. Alas, the software was years ahead of its time and is no longer available.
There are many other efforts past and ongoing for both arbitrary sounds and specifically alarm sounds using a variety of techniques.
"Incorporating Contextual Audio for an Actively Anxious Smart Home" Simon Moncrieft et al
The term "active anxiously" captures much.
"Detecting Alarm Sounds" D.P. Ellis
This is what you are trying to do, but please read what I write below on the importance of a high-quality signal (close by, directional microphone).
Here's SOLAR (Sound Object Localization and Retrieval in Complex Audio Environments) the purpose of which is to " to detect and identify sound objects, such as car horns or dog barks, in audio " that includes C source code and some instructions.
I used to use something called "Audio Signal v 1.1"
In general, needed steps are:
A#1) Signal acquisition. Both for monitoring and obtaining an initial example so that you can "train" the software. A highly directional and very close by microphone is key to success in your "from the wild" scenario. This in itself might be the major challenge. I can't emphasize this enough. Most folks greatly underestimate the importance of microphone placement. Whatever you were planning to do can probably be improved -- do so!
2) Signal conditioning. If it is an alarm, it will have one or two frequencies that predominate. It might help to set up two parametric equalizers with a narrow ("notch') bandpass (one per stereo channel?) to reject everything except the frequency/ies of interest. An alarm warble tone may have two principal frequencies. You may want to remix to mono or leave separate so as to be able to logically AND the recognition. But sometimes the characteristic signal will be in the overtones and distortion (or a combination of the fundamentals and overtones), so this may be counterproductive. Depends in large part on how much background and extraneous noise there is (See A#1 above).
3)Training. You will want an example of he sound captured with the same equipment a you plan to use for monitoring with which to train the software.
5) Recording. Easily done these days directly to a digital file.
6) Detection. This is where the software is used. As previously remarked by others, this can be assisted by manual review/inspection of the sound file.
Should be " actively anxious ". Excellent paper in general with respect to home automation. Fodder for useful HomeSeer/CQS add-ins that shows how much the software side of HA lags the hardware (IMO/E).
(Activehome.com and Smarthome.com are already registered domains, but Anxious Home.com and Actively.com are wide open ... ;-)
Here's a related resource with matlab code to process spectrum analyzer output to identify distinctive sinusoidal (eg burglar alarm) waveforms.
It could also be that the owner finally tuned up his alarm system and eliminated the falsing that I assume you've been hearing. If it was a relatively new sound, that would be a good assumption. No one wants a falsing alarm and it's got to be louder (and therefore more of a bother) to the owner than it is to you, whom I assume to be a neighbor.
After not going off all weekend it proceeded to go off at 9PM last night up until at least 12PM when we went to bed, I've recorded it all and'll have to take a look at the results tonight.
The alarm in question isn't a neighbours but it's an emergency vehicle road crossing alarm that is supposed to stop the traffic to allow the fire engine to cross the 4 lane road, it seems they went out on a call last night and forgot to turn it off after they had used it. The police turned up at the end and, although they couldn't switch it off, they had to signal the people through, prehaps others had complained.
(I did hear alot of road rage type arguments and car horns caused by the broken alarm, hopefully the mic would have picked that up too)
Crikey! Don't they have a timer on that thing that automatically shuts off after giving them enough time to cross the road?
We don't have systems like that in that US (AFAIK) although we do have some equally problematic train crossing gates. The New York Time did a series recently about how poorly maintained "grade" crossings are and how many people have been killed because of stuck relays and burned out bulbs. Some of the freight railroads apparently maintain the grade crossings only after they've already killed or maimed someone.
Good luck in getting that unit fixed so that it doesn't go off. Sorry that I assumed it was you neighbor's alarm since I've never encountered a device like you've described for roadway crossings.