aragats

Daemon

Reaction score: 701
Messages: 1,618

I'm trying to find a way to monitor microphone input to catch a particular "event". In other words, something principally similar to a motion detector - to execute a command upon an event.

Currently I'm using a simple ffmpeg command to record the sound card input into a file:
ffmpeg -f oss -i /dev/dsp1.0 -vn -c libvorbis -f ogg $FILE

However, it's not a convenient way, I'd prefer to analyze it in real time.

Any ideas?
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

I would say including DTMF. But since there are DTMF decoders available (e.g. multimon), I would rather implement an overshoot detector, then pass the signal to another program.
 

shepper

Aspiring Daemon

Reaction score: 324
Messages: 874

However, it's not a convenient way, I'd prefer to analyze it in real time.

I think that is the other key question; how to you want to analyze it? Volume? Tonal Frequency? Interval?
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

My first idea was to set a level, and when the signal exceed it, generate an event.
 

Juha Nurmela

Well-Known Member

Reaction score: 121
Messages: 401

You mean a squelch? Crude one is not complicated, following plays line-in to line-out, but snips hissy silent parts.

Juha
 

Attachments

  • aloop_sql.c.txt
    2.5 KB · Views: 307
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

Thanks, Juha! That's a good starting point! It works fine!
 

Juha Nurmela

Well-Known Member

Reaction score: 121
Messages: 401

It's really really really nice that /dev/dsp allows multiple unrelated readers per device.

Juha
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

I've found a fork of multimon ― multimon-ng:
https://github.com/EliasOenal/multimon-ng

which supports FreeBSD, although some minor tweaks are necessary to compile. It works pretty well having different types of decoders including DTMF. It monitors /dev/dspX.Y device and prints detected symbols to stdout (or can be used to analyze a regular audio file).
 

Juha Nurmela

Well-Known Member

Reaction score: 121
Messages: 401

The .Y is not needed, new dspX clone will automatically appear as needed.

There is something on the works by the big boys, virtual_oss and cuse sound promising for unusual uses.

Juha
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

I didn't realized that dsp clones are created automatically, although it indirectly follows from your C code, Juha.
That's really cool! Thanks!
 
Top