Mic threshold trigger

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I would like to create a simple trigger from a microphone input, using alsa.
For example I would like that every time I short-circuit a jack inserted 
in the "mic hole", my program say "Hello World".
I would like that this application will be lightweight (I don't need 
audio quality, just a trigger!) and that cohexists with other apps that 
should keep using the output of the same sound card.

My idea was to simply code a raw "snd_pcm_readi" call and after compare 
each sample of the captured block with a threshold. For instance, if the 
90% of sample are above the given threshold, the trigger must act.

Of course it doesn't work :-)

I plug a simple jack in the mic, and open or short-circuit the poles. In 
the captured block, I can find only samples between 0xFFE0 and 0xFFFF 
(and some sporadic 0x0000).

Any hits? Thanks

Lorenzo

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux