Skip to content

tpl-spot-concurrent

This template runs two wake word models at the same time. It provides a convenient way to create a single wake word model that has the combined vocabulary of two other models.

tpl-spot-concurrent has task-type==phrasespot.

Expected task types:

tpl-spot-concurrent-1.5.0.snsr

Operation

flowchart TD
    start((start))
    fetch[/samples from ->audio-pcm/]
    audio(^sample-count)
    split@{ shape: f-circ }
    join@{ shape: f-circ }

    start --> fetch
    fetch --> audio
    audio --> split
    split --> start0
    split --> start1

    end0 --> join
    end1 --> join
    join ----> fetch

    subgraph slot0[**slot 0** (phrasespot)]
      start0((start))
      process0[process]
      result0(^result)
      end0((stop))
      start0 --> process0
      process0 --> end0
      process0 -->|recognize| result0
      result0 --> end0
    end

    subgraph slot1[**slot 1** (phrasespot)]
      start1((start))
      process1[process]
      result1(^result)
      end1((stop))
      start1 --> process1
      process1 --> end1
      process1 -->|recognize| result1
      result1 --> end1
    end
  1. Read audio data from ->audio-pcm.
  2. Invoke ^sample-count.
  3. Send audio samples to recognizers in slot 0 and slot 1.
  4. Invoke ^result if processing detects a vocabulary phrase.
  5. Continue processing until STREAM_END occurs on ->audio-pcm, or one of the event handlers returns a code other than OK.

Register callback handlers with setHandler only for those events you're interested in.

Settings

^result, ^sample-count

none

audio-stream, audio-stream-first, audio-stream-last

->audio-pcm, audio-stream-from, audio-stream-to

0, 1, audio-stream-size, samples-per-second

phrasespot

live-spot.c, snsr-eval.c, PhraseSpot.java, segmentSpottedAudio.java

Notes

Runs the wake word models in slot 0 and slot 1 at the same time, in the same thread.

The two recognizers are entirely independent, and can produce results that overlap in time. For production use Sensory recommends custom multi-phrase phrase wake word recognizers instead. These have improved false reject / false accept performance.

The combined model is a wake word, and can be used in any application that expects such a model without API changes.

Configuration settings and iterators are not available in the combined model. You can access these for the individual models by prefixing the setting path with the slot. For example, use 0.operating-point to read or change the operating-point of the first spotter and use 1.operating-point to read or change the operating-point of the second spotter.

Attempting to set operating-point without a slot prefix will result in an error.

% cd ~/Sensory/TrulyNaturalSDK/7.6.1

% bin/snsr-edit -o vg-hbg.snsr\
    -t model/tpl-spot-concurrent-1.5.0.snsr\
    -f 0 model/spot-voicegenie-enUS-6.5.1-m.snsr\
    -f 1 model/spot-hbg-enUS-1.4.0-m.snsr

% bin/snsr-edit \
    -t vg-hbg.snsr \
    -s operating-point=5
Setting "operating-point" not found, did you mean "0.operating-point" or "1.operating-point"?

Change individual settings at runtime by prefixing the setting name with the slot:

/* Set the operating point for spotter 0 only. */
snsrSetInt(session, SNSR_SLOT_0 SNSR_OPERATING_POINT, 7);
/* Set the operating point for spotter 0 only. */
session.setInt(Snsr.SLOT_0 + Snsr.OPERATING_POINT, 7);

You can recombine combined models and nest them to an arbitrary depth to run any number1 of wake word recognizers at the same time:

% cd ~/Sensory/TrulyNaturalSDK/7.6.1

% bin/snsr-edit -o models1-4.snsr\
    -t model/tpl-spot-concurrent-1.5.0.snsr\
    -f 0 model/tpl-spot-concurrent-1.5.0.snsr\
    -f 0.0 model-1.snsr\
    -f 0.1 model-2.snsr\
    -f 1 model/tpl-spot-concurrent-1.5.0.snsr\
    -f 1.0 model-1.snsr\
    -f 1.1 model-2.snsr

In this example, the four wake word models are located in the 0.0, 0.1, 1.0 and 1.1 slots

Examples

% cd ~/Sensory/TrulyNaturalSDK/7.6.1

% bin/snsr-edit -o vg-hbg.snsr\
    -t model/tpl-spot-concurrent-1.5.0.snsr\
    -f 0 model/spot-voicegenie-enUS-6.5.1-m.snsr\
    -f 1 model/spot-hbg-enUS-1.4.0-m.snsr

% bin/snsr-eval -t vg-hbg.snsr
  2370   2940 voicegenie
  5805   6420 voicegenie
  7740   8640 hello blue genie
 10440  11100 voicegenie
 12060  12870 hello blue genie
^C

  1. Limited only by available RAM and CPU.