Skip to content

tpl-spot-select

This template allows you to dynamically select which of the two embedded wake word models to run.

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

Expected task types:

tpl-spot-select-1.4.0.snsr

Operation

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

    start --> fetch
    fetch --> audio
    audio -->|slot == 0| start0
    audio -->|slot == 1| 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 to the recognizer specified by slot.
  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

^adapt-started, ^adapted, ^new-user, ^result, ^result-partial, ^sample-count

none

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

->audio-pcm, audio-stream-from, audio-stream-to, delete-user, rename-user

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

phrasespot

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

Notes

Use slot to select either the spotter in slot 0 or slot 1.

Use this template to reduce the model size when an application uses variants of the same recognizer in different contexts. This reduces the overall model size and RAM requirements as identical objects are shared between the slots.

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 1.operating-point to read or change the operating-point of the second spotter.

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);

Examples

% cd ~/Sensory/TrulyNaturalSDK/7.6.1

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

# repeat "hello blue genie" and "voice genie"
% bin/snsr-eval -t vg-hbg-select.snsr -s slot=0
  3480   4140 voicegenie
  9945  10545 voicegenie
^C

# repeat "hello blue genie" and "voice genie"
% bin/snsr-eval -t vg-hbg-select.snsr -s slot=1
  1635   2460 hello blue genie
  6210   6870 hello blue genie
^C