From: "OrazioPirataDelloSpazio (Lorenzo)" <ziducaixao@autistici.org>
To: alsa-devel@alsa-project.org
Subject: Mic threshold trigger
Date: Wed, 05 Nov 2008 01:09:47 +0100 [thread overview]
Message-ID: <4910E44B.60103@autistici.org> (raw)
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
reply other threads:[~2008-11-05 0:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4910E44B.60103@autistici.org \
--to=ziducaixao@autistici.org \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox