Capture Sound from Mic/Headphone and trigger action at perticular frequency - audio

I am using .NET 3.5.
I need to Capture Sound from Mic/Headphone and trigger action at particular (not exact) frequency (Need to perform some action when player hits ball with stick while playing golf).
So,
1. How to capture sound from Mic/Headphone using .NET 3.5?
2. Trigger action at particular (not exact) frequency?
Any ideas?

For (2) I suggest the Goertzel algorithm, which is very simple to implement and will allow you to detect energy in a narrow range of frequencies.

Related

Recognize specific ringtone

What I want is to be able to get a signal at my raspberry pi at home when I'm not at home so I can e.g. wake up my PC. I always have an old phone lying around that I never really use. So I thought, I can call my phone, a specific mp3 ringtone plays, my raspberry pi listens and recognizes the ringtone and therefore the signal. So I can pretty much chose whatever ringtone I want (but hopefully a not too long one). But the problem is, that it should be recognizable by the raspberry and it should be distinguishable from other sounds. At best I can play random music at home and it will not get signalled until it's the specific ringtone i chose.
So I'm at the very beginning of the project and I have a lot of question. Is this even feasible? How do I listen to the ringtone? Should I use a normal microphone or could I e.g. trigger some gpio pin as long as a specific frequency is played? What kind of ringtone should I use to be as distinguishable as possible? And how to create the software to recognize the sound?
I know this is a lot and I don't expect a step by step solution. But maybe you got some hints to get me in the right direction?
If someone has a similar problem, I found a solution: First I had to choose between a mostly hardware solution and a mostly software solution. The hardware solution is to filter specific frequencies. This seems to be pretty hard using normal band-pass filters if you want narrow bands. There are also components that can do that, now I know of the NE567. But this component only reacts to one frequency and takes quite a lot of energy. To recognize a ringtone, more of these components are needes which means more power consumption. Additionally this solution is pretty unflexible.
So I went for the software solution. Now I have an Arduino Uno that gets an amplified electret microphone signal at an analog input pin. The data is collected and simultaneously analysed with an FFT algorithm. Then I check the dominant frequency if there is any and safe it in an array. Everytime a got a new data point I compare the array with the pattern of my ringtone and calculate a score for the match. If the score is big enough the ringtone is "found" and I can trigger my event.
I'm actually pretty pleased with the solution because it works quite well even with the phone some feet away from the microphone. I thought I need to put the microphone almost directly next to the phone to get good results, but I dont have to. It's still a little sensitive, because the sound volume shouldnt be too high or to low. But with the right volume settings it works with a quite big area when the phone is in the same room. It works even better with some space between microphone and phone, because the phones radiation from the call seems to disturb the circuit quite a lot. There is also the problem, that other noises block the ringtone recognition. I could compensate that with my algorithm, but I almost used up all resources of the Arduino, so I had to keep the algorithm simple. But in my case I dont have a noisy environment, so this is not a problem for me. Another pro is that my event was never triggered from another sound and it seems almost impossible that this could happen by accident.
So it is feasible and I think its actually a quite elegant solution. I also thought about a vibration detection or even directly using the vibration motor's signal but I have no control over the vibration function of that old phone. But I can chose the ringtone for every contact, so I only gave the "magic" ringtone to myself and so the event can only be triggered by myself. I only have to say, that writing the software was kind of hard with the Arduinos limitations. Because I need the data in real time I have limited time for the calculation. I had to limit the incomping data and therefore I can only listen to frequencies up to 10kHz. But the ringtone recognition is still possible and I think it was worth the effort. :)

Frequency Measurement on GNU Radio

I use an USRP on GNU Radio for AM and FM reception.
I can display the signal after demodulation thanks to QT GUI Time sink, therefore I can view the signal and know its frequency.
But I would like to measure automatically the frequency after demodulation. I want GNU Radio to give me the value of frequency signal. Is there a possibility to do that on GNU Radio?
Yes, it's possible.
You need to use one of the existing frequency detectors – there's a PLL one right there in the library! Other than that, many method of frequency detection are possible to do – and all of them can be implemented in GNU Radio, to varying degrees of ease :)

Audio signal comparison from Radar

I an working on a student project. We have a radar that gives an audio detection using headphones to indicate the type of target. Target types are (eg car/truck/man). Radar distinguishes between these targets based on doppler variation, down converts this into audible range and operator can hear it through headphone. System has provided sample audio files corresponding to each type of target(man/car/truck) to train the operator to know as to what he is hearing when live signal is fed and accordingly decide what target it is.
I intend that a software can do the job of this operator.
I want to compare live audio signal input from Radar with 7 different test audio files and want the software to tell me which file matches the input.
kindly educate me .... can these audio fingerprinting softwares do my job.
What you're trying to be done can be implemented in GNU Radio, in a lot of ways.
You could, for example, take the audio signal as input to an audio source, connect that to a set of xlating FIR filters, which you'd design using the gr_filter_design tool; you then would estimate the (potentially decimated) signal in these bands by converting the complex samples to their power (complex to Mag^2) and would then further low-pass and decimate, to then select the band with the highest energy. All this can be done in a nice graphical way in the GNU Radio Companion (gnuradio-companion), which will then generate Python code, which is used to set up the signal flow graph based on the C++ GNU Radio framework.
I recommend you read the Guided Tutorials and see where you get from there.

Using After Effects expressions to trigger an audio file

Is there a way to trigger an audio file to play in the After Effects timeline when a layer has visible content.
It's a small click sound and when the text layer IN point is reached, I simply want the click wav file to play. Any help would be appreciated.
You have to use scripts to change anything other than keyframe-able layer and effect parameters. You might be able to fake a "click" effect with an expression by triggering a momentary change in the volume of a constant noise audio layer, and using markers to trigger it.
I think using the start times of other layers is problematic because writing an expression that would check any number of layers would involve some kind of for-loop that could get complicated, and you can't easily pass values or variables among different expressions. The question with expressions in AE is always whether the solution saves you time in the long run over just doing it manually, so it depends on your needs.
The quickest way to do it would probably be to just pre-comp your sound effect and whatever layer it needs to match, so that each time the pre-comp plays, you also get the click.
try pressing period(.) After effects dosent let you listen to audio while scrubbing, due to the fact your not looking at the true frame rate. So if you click RAM Preview and play you timeline you will hear you audio files. But for your instance if you press period(.) it will override and play your audio file. I use it when placing a small accent or foley sound.

Touchscreen using sound input?

i don't really know if it is actually possible, but i believe that it can be made. How possible is it to make a program that recognizes different sound bouncing from the screen and turn it into a position that will obviously be later fed to the mouse.
I know that it sounds kind of dumb, but lately i've been noticing that a very dull, strong sound is made when touching the screen, and that sound varies when doing so at different positions. Probably the microphone "hears" differently because the screen acts as a drum with the casing. Anyways, what do you think, anyone has any experience programming with sound?
First of all most domestic touch screens work by detecting pressure based on a criss-cross mesh layer underneath the display layer.
However I have seen an example where a touch interface was interrogated onto a pane of glass, it used 4 microphones to determine the corners, when you tapped a certain part of the screen it measures the delay in the sound getting to each microphone, therefore allowing one to triangulate the touch.
This is the methodology you would use, you don't even need to set up the hardware to test it, you could throw up an interface in VB, when you click in a box it sends out a circular wave and just calculate using the times it takes to reach the 4 points where the pointer is.
EDIT
As nikie suggested, drag & drop, or any kind of gestures would be impossible using the microphone method, as the technique needs a wave of sound to detect the input.
http://computer.howstuffworks.com/question7161.htm
I don't know if this will get you far, but you can investigate the techniques used in MIDI drums for returning various nuances of play.

Resources