[LAD] Audio Trigger

Joern Nettingsmeier nettings at folkwang-hochschule.de
Sun Nov 9 14:05:22 UTC 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.

one option is to rip some code from a ladspa gate plugin and use that to
create a software event.
or you could use a midi trigger and receive a midi event.

> 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?

the easiest approach is to rms the data to get loudness information, and
then generate an event if a certain threshold is reached. further
refinements could be variable attack and hold times and a bandpass to
filter out unwanted noise.
take a look at any noise gate implementation.

> 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 ?

generally, no. but you can capture at 16bit/44k1. afterwards it is a
trivial operation to resample and decimate if necessary.

jörn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/

Kurt is up in Heaven now.

More information about the Linux-audio-dev mailing list