[LAD] Audio Trigger

Gene Heskett gene.heskett at verizon.net
Thu Nov 6 13:10:37 UTC 2008


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.  Most voltages (think carbon zinc 1.5 volt battery) are going to be 
too high for a mic input, but will drive it to saturation in the A-d stage.  
This could be used to advantage, but depends on the card.  If the input is DC 
coupled, then the output data should be a 16 bit signed integer, with a zero 
value when the switch is open, and full scale when it is closed.

>I succeed in capturing the mic input through a simple program that uses
>alsa driver, but I don't know how to "parse" the raw data to search for
>the spikes. Any hints?

Sure, read the data stream as signed integers and look for that point where it 
suddenly goes full scale from some value that is lose to zero.

>Second question: on a "full duplex" sound card, can I capture at 8 bit,
>mono, 22.050 bit/s , and on the same time playback at 16 bit, stereo,
>44.100 ?

The capture clocking will likely be the same as the playback, and likely will 
be a 16 bit per sample capture since 8 bit, without a lot of monkey business 
in the capture channel, is pretty poor telephone quality.  More than adequate 
for what you want to do, but probably not something the hardware can be 
talked into doing.

>Thank you!
>
>Lorenzo
>_______________________________________________
>Linux-audio-dev mailing list
>Linux-audio-dev at lists.linuxaudio.org
>http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev



-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
QOTD:
	Silence is the only virtue he has left.



More information about the Linux-audio-dev mailing list