All of lore.kernel.org
 help / color / mirror / Atom feed
* Mic threshold trigger
@ 2008-11-05  0:09 OrazioPirataDelloSpazio (Lorenzo)
  0 siblings, 0 replies; only message in thread
From: OrazioPirataDelloSpazio (Lorenzo) @ 2008-11-05  0:09 UTC (permalink / raw)
  To: alsa-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-05  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-05  0:09 Mic threshold trigger OrazioPirataDelloSpazio (Lorenzo)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.