3

I spend a lot of time taking pictures with a usb camera attached to a microscope. Thing is... I need to manipulate the plaque with my two hands, so moving one hand from the microscope to the computer to take a screenshot (space bar) is really difficult. Question is... Is there an app that hears my voice and takes pictures? I was thinking ... maybe a personal voice assistant is the way to go... but maybe an application (like gnome-cheese or something) already does the job....

My question is a bit like this one (Detect simple voice commands). I have to say 'cheese' or 'photo' or 'whatever' and that's gonna be the input for whatever program can take screenshots... I've been searching around and found this https://voice2json.org/. Somewhere it says that

It can be used to:

Add voice commands to existing applications or Unix-style workflows

I do not know if this is overkill or very simple.

Ps. I am using Fedora 35

Thanks

  • You could also use a USB foot switch or something like that. I like the voice idea better, myself, but I thought I'd toss that out there as a possible alternative. Sample product (this one needs Windows for programming, but then works on anything): https://www.amazon.com/dp/B00CK1BKZQ/ – Ben Scott May 04 '22 at 15:33
  • it would definitely also help if you could tell us what operating system (distribution) you use.. "readily available" seems to be what you're looking for, but what is readily available differs between the systems covered by this site! – Marcus Müller May 04 '22 at 15:45
  • 1
    @Cbhihe note that this would not be welcome on [softwarerecs.se] since they have very strict rules about question requirements. In any case, software recommendations are also on topic here. – terdon May 04 '22 at 17:24

1 Answers1

4

Haven't seen anything ready-made.

Kind of a bummer there's no voice-activated magic switch to execute commands!

So: Install GNU Radio (3.10 or 3.9 should work), download this flowgraph file, open it in "GNU Radio Companion":

Audio Detector

click on "Run->Generate", note down the "Generating '/path/to/file/audio_detector.py".

From here on you have a program that detects loud noise and can run a program when it does! You can run it:

/path/to/file/audio_detector.py -c script_that_takes_a_single_picture

(use -T 2.0 to set a cooldown of 2s, and -l 0.1 to set the loudness detection threshold lower.)

You'll need a script that takes a picture. If you don't have one: install streamer (it's in the xawtv package for your linux distro, probably!), and build a script, e.g. in /home/murpho/script.sh:

#!/bin/sh
filename=`date '+%Y-%m-%d %H:%M:%S.%N.jpeg'`
streamer -o "$filename"
#          |output file|
# more options:
#    -c /dev/video0 
#       |VLC video device|   
#    -s 1980x720
#       |Image size in pixels|
# see "streamer -h" for more info

Use that as command to execute on sound:

/path/to/file/audio_detector.py -c "sh -c /home/murpho/script.sh"