sincerely_manny
sincerely_manny

Reputation: 21

Triggering script or external programm on Julius speech recognition

I'm trying to use Julius on ubuntu. After a couple of hours I've finally made it to work.

Basically, the only thing I need it to do is to trigger a script when it recognizes a certain word (ex. "computer"). And that's the main problem. What's the best way to do it?

Also it seems like I can't manage to run Julius in a "quiet" mode

$ julius -quiet -input mic -C julian.jconf 2>/dev/null 

still outputs too much information:

                   ..........
          reject short input = off

----------------------- System Information end -----------------------

    *************************************************************
    * NOTICE: The first input may not be recognized, since      *
    *         no initial CMN parameter is available on startup. *
    * for MFCC01*
    *************************************************************

Stat: capture audio at 16000Hz

Stat: adin_alsa: latency set to 32 msec (chunk = 512 bytes)

Error: adin_alsa: unable to get pcm info from card control

Warning: adin_alsa: skip output of detailed audio device info

STAT: AD-in thread created

Warning: strip: sample 0-27 has zero value, stripped

pass1_best: DOWarning: strip: sample 192-444 has zero value, stripped

pass1_best: DO PLAY

sentence1: DO PLAY

pass1_best:

sentence1: DO PLAY

pass1_best:Warning: strip: sample 406-436 has zero value, stripped

 ....

and so on.

Any suggestions?

Upvotes: 1

Views: 764

Answers (1)

Colin Beckingham
Colin Beckingham

Reputation: 525

Normally we will be calling Julius from a script, reading the output of Julius into a variable where we can hide everything and extract only what is required using substrings and slicing. In this way you can build what is referred to as a "dialog manager" using whatever application suits your purposes such as PHP, Julia, Python and so on, taking action depending on what Julius thinks it heard from a switch or if .. then .. else structure.

A simple way to do this is using an infinite loop which only exits on a command such as "COMPUTER QUIT" or similar.

The julius option -nostrip is helpful if you get lots of nostrip warnings.

Once you have some experience with julius it is really helpful to run julius in server mode (described in the documentation [multiple links available at https://github.com/julius-speech/julius ] along with a sample application), which allows you to control julius more efficiently without having to reload between recognition events. In addition julius will send responses in XML format so that you can reliably read the output with a tested XML reader inside the dialog manager.

Upvotes: 1

Related Questions