Hello Gene and thank you for your response.
Gene Heskett ha scritto:
On Thursday 06 November 2008, OrazioPirataDelloSpazio
(Lorenzo) wrote:
Hi all,
I need to use a microphone input as a trigger. In other words my idea is
to connect a switch to the microphone input. In this way, when the
switch is turned on it generates a spike in the captured track.
I would like to create a program that trigger an event every spike it
receives.
1st, the switch needs to switch a voltage, otherwise there is nothing to
record.
I was thinking the same but even if the switch always open produces no
signal, and the always closed produces no signal, when the switch is
closing it does produce a signal!
Here you can find two wave files:
https://svn.ninux.org/ninuxdeveloping/browser/webradio
trig.wav -> caputed when I trigger the switch
notrig.wav -> the switch is always open
As you can see there is some spikes in the first. If I open with
audacity, I can see the volume level that raise when I closed the switch
(about 5 or 6 times in the wav file).
So I cast every couple of bytes in a int16_t as you suggest, and make
the program trigger after a given threshold is overwhelmed.
So I write a simple program that when the captured sample overwhelm a
given threshold, it triggers. The code is here:
https://svn.ninux.org/ninuxdeveloping/browser/webradio/trigmic.c
When I fix the treshold to 180, it does work properly, even if sometimes
it exchange a "white noise" sample for my trigger.
Lorenzo