My daughter earned a 4th place trophy out of 100 competitors in her division at a chess tournament, far ahead of all other unrated players. As a proud parent, I wanted to get a photo and video of the trophy presentation to hear how the award was presented. Unfortunately, just before the awards, the fire alarm was triggered, causing all to evacuate the building. Good thing it happened after all the rounds of chess were played! The organizers held the awards ceremony outside (luckily it wasn’t raining), and I was able to record a video of the award. Unluckily, the alarm was still blaring a constant very loud buzzing sound, making it hard to hear the audio.
Fortunately, I read this recently: How to filter out unwanted sounds via Fourier Transform, and copied the code from there, modified the filter a little, and digitally removed the fire alarm from the audio!
What a coincidence to have the opportunity for a real world example of sound elimination by digital filtering so soon after posting that code!
Details: I started the Sound Recorder (All Programs->Accessories->Entertainment->Sound Recorder), started recording, started the movie and saved the resulting .WAV file. Then I ran the code in that post, recording the resulting half million samples into a fox cursor. A SQL Select statement showed a pattern of frequencies that repeated with a lot of energy. That was the alarm sound that needed to be eliminated.
CREATE CURSOR test (pow b)
FOR i = 1 TO ALEN(aIm)
INSERT INTO test VALUES (SQRT(aSamples[i]^2 +aIm[i]^2))
SELECT RECNO() as rnum,pow FROM test ORDER BY 2 DESC WHERE RECNO() < 524288/2 INTO CURSOR foo
Then I preceded that code with this filter, which I iteratively refined til I had good results:
FOR i = 1 TO np2/2
FOR j = 0 TO 9
nMid = 38500 - j * 3500
IF BETWEEN(i,nMid-nRange, nMid+nRange)
As you can see, the fire alarm was multiples of 3500 (about 295 Hz) in frequency, so I just filtered out multiples of 3500 with a bandwidth of 600 hz. The frequency loop goes from highest to lowest because the most energy was at the highest frequencies.
Why does the alarm have to blare for so long? It must have been going at least 15 minutes<sigh>.
This reminds me of the time when I worked at BBN, which had the dubious distinction of having to analyze 2 famous audio tapes: