Node-red-contrib-voice2json

These nodes work wunderfull !!!
I have speech recognition working, my devices going on and off and i get a confirmation via speech that the speechtask is executing...
Last and difficult part is my wakeword. Still problems get this to work...

1 Like

Oh nice! please share your flow when you have it working!

i will, but i cant get the last part working...

i think these work
precise-collect and
precise-train -e 60 hey-bram.net hey-bram/

but these dont...
precise-listen hey-bram.net -d hey-bram/not-wake-word
another precise command also does not work: precise-listen hey-bram.net

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.COMPILER_VERSION is deprecated. Please use tf.version.COMPILER_VERSION instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.CXX11_ABI_FLAG is deprecated. Please use tf.sysconfig.CXX11_ABI_FLAG instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.ConditionalAccumulator is deprecated. Please use tf.compat.v1.ConditionalAccumulator instead.

Using TensorFlow backend.
Traceback (most recent call last):
  File "/home/pi/mycroft-precise/.venv/bin/precise-listen", line 33, in <module>
    sys.exit(load_entry_point('mycroft-precise', 'console_scripts', 'precise-listen')())
  File "/home/pi/mycroft-precise/precise/scripts/base_script.py", line 43, in run_main
    script = cls(args)
  File "/home/pi/mycroft-precise/precise/scripts/listen.py", line 58, in __init__
    self.listener = Listener(args.model, args.chunk_size)
  File "/home/pi/mycroft-precise/precise/network_runner.py", line 107, in __init__
    self.runner = runner_cls(model_name)
  File "/home/pi/mycroft-precise/precise/network_runner.py", line 85, in __init__
    self.model = load_precise_model(model_name)
  File "/home/pi/mycroft-precise/precise/model.py", line 54, in load_precise_model
    return load_keras().models.load_model(model_name)
  File "/home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/keras/models.py", line 242, in load_model
    model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

Hello,
Sorry for the late answer but I took a little Christmas brake.
I’ll write something about the training process tomorrow.
I don’t use precise-listen or collect.
For recording samples I actually use a bash script that I will post too tomorrow.
Just two quick notes today:

  • using just precise-train will give you a starting point but will not give you any great models
  • you will have to use precise-train-incremental after that with something like 50 epochs per increment of 10
  • this is where it becomes very important that you have lots and lots of short pieces of random not wake word audio (really like 10-20 hours)
  • this will take a long time on something like a pi 4, like several hours/half a day depending on how much input data there is
  • I use precise-test to test finished models or just test them with voice2json

isnt there a ready pb file with something like the current hey mycraft ready solution?

It here is a pb file for hey google or hey computer thats good enough for me...
Hey mycraft works great but my kids cant remember it..

I had it on my back log for a while now to train a new robust model for hey pips which is what my girlfriend and me are using.
If you would like to contribute some samples I could include your data in my dataset and try train a model and share it with you.
I would need:

  • 10 samples of each person
  • some five minute recordings of typical household sounds that are to expect at the points where you will have your microphone

To record the samples you can use this bash script if you have sox installed:

#!/bin/bash

declare -i n=$1
declare -i c=1

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

bold=$(tput bold)
normal=$(tput sgr0)

((p=p+1))

printf "\nThis script can record wake word samples for training of a wake word model.
       \nThe recording starts when you press return and ends automatically each time.
       \nOnce you have started a recording by pressing return say the wake word naturally
       like you would in daily use.\nLets start:"

for i in {0..9}
do
    printf "${normal}\n\nPress Enter to record number ${c} of 10 wake word recordings.\n"
    read -s -n 1 key
    if [[ $key = "" ]]; then
        sox -t alsa default -r 16000 -c 1 -b 16 -e signed-integer -L ${DIR}/hotword.${n}.wav \
        trim 0 4 vad -p 0.2 reverse vad -p 0.6 reverse
    fi
    ((n=n+1))
    ((c=c+1))
    printf "\nRecorded successfully.\n\n"
done

printf "\n\nFinished, thank you.\n"

Just save this as for example record.sh into the folder you want to record the wake words in.
Than use it like this:

bash record.sh 1

Where the first argument will be the number to start the enumeration of the 10 files that will be recorded on this run. So use a 1 On the first run and than a 11 on the next than 21 And so on or you will overwrite your previous files.
It’s important to record those samples in a quiet environment.

For recording the 5 minute pieces of random audio you can use the sox record node set to record directly to a wav file and set to stop after 300 seconds.
Make sure the recorded random audio does not contain the wake word.

Tell me if you would like to do that.

Johannes

Edit & Ps: if you should want to try training yourself here is what I do:

  • I split all the random noise audio into one minute chunks by running this command in the random folder:

for f in *.wav; do sox "$f" "split.$f" trim 0 60 : newfile : restart ; done
  • Than delete all the original long files and only keep the new noise-split files.
  • I duplicate each wake word file with added random noise from those files with this script:
#!/bin/bash

NOISEDIR=$1

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

for f in *.wav
do 
    NOISEFILE=$(find ${NOISEDIR} -type f | shuf -n 1)
    
    sox -m $f ${NOISEFILE} noise.$f trim 0 `soxi -D $f`
done
  • the Script needs to be run in the folder with the wake words and has one argument which is the path to the noise files (delete the script from the folder when your done)
  • copy about 10-20% of the wake-word files to test/wake-word
  • copy the whole wake-word folder to the precise folder (always work with a copy so that you can start over at any point)
  • do a baseline training with:
precise-train your-wake-word.net wake-word-folder/ -e 100 -s 0.5
  • this will give you a start that will listen to pretty much anything
  • the real training now happens with (this Part can take a while):
precise-train-incremental your-wake-word.net wake-word-folder/ -r path/to/noise-folder -e 50 -th 0.4 -s 0.5
  • once finished you can optionally copy the generated test not-wake-words to to the generated not-wake-words and retrain with the first command:
cp wake-word-folder/test/not-wake-word/generated/* wake-word-folder/not-wake-word/generated
  • and again:
precise-train your-wake-word.net wake-word-folder/ -e 100 -s 0.5
  • now convert to pb:
precise-convert your-wake-word.net
  • copy your-wake-word.pb, your-wake-word.pbparams and your-wake-word.pbtxt to a new folder:
mkdir your-wake-word
cp your-wake-word.pb* your-wake-word/
  • and your done and can now try the result

OK, i have the first 20 pips samples.
and have a 5min file
and have noise chunks
and have combined wav and noise chunks

before i go further..

Some questions

  1. do i have to remove all the sh scripts from wake-word folder
    so that there only remain hotword*.wav and nois.hotwords*.wav in this wake-word folder?

  2. you say: copy about 10-20% of the wake-word files to test/wake-word
    Are these the normal wake-word (hotword*) wav files or noise.wake-word combinations(noise.hotwords*) too?

  3. Does precise-train your-wake-word.net wake-word-folder/ -e 100 -s 0.5
    only use the generated wake-words (no noise file combinations) ?

  4. You said: "copy the whole wake-word folder to the precise folder (always work with a copy so that you can start over at any point)"

    i have /home/pi/mycroft-precise/wake-word. These contain
    hotword*.wav and nois.hotwords*.wav, is that ok?

  5. you said "precise-train-incremental your-wake-word.net wake-word-folder/ -r path/to/noise-folder -e 50 -th 0.4 -s 0.5"

What files are in the noise folder ?
a. the 5 minute file
b. the chunks off the 5 min file
c. the noise.hotword (these are with your description in the wake-word folder

  1. i have 40 wake-word wav files and 40 noise/wake-word files
    and did a precise-train as you described

(.venv) pi@raspberrypi:~/mycroft-precise $ precise-train hey-pips.net /home/pi/wake-word/ -e 100 -s 0.5

i get the following warnings (see output dump below)
a. no tags
b. not enough data to train

(.venv) pi@raspberrypi:~/mycroft-precise $ precise-train hey-pips.net /home/pi/wake-word/ -e 100 -s 0.5
Using TensorFlow backend.
WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.COMPILER_VERSION is deprecated. Please use tf.version.COMPILER_VERSION instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.CXX11_ABI_FLAG is deprecated. Please use tf.sysconfig.CXX11_ABI_FLAG instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.ConditionalAccumulator is deprecated. Please use tf.compat.v1.ConditionalAccumulator instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3138: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/keras/optimizers.py:757: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING: Found 80 wavs but no tags file specified!
Data: <TrainData wake_words=0 not_wake_words=0 test_wake_words=0 test_not_wake_words=0>
Loading wake-word...
Loading not-wake-word...
Loading wake-word...
Loading not-wake-word...
Inputs shape: (0, 29, 13)
Outputs shape: (0, 1)
Test inputs shape: (0, 29, 13)
Test outputs shape: (0, 1)
Not enough data to train

  1. Now wait for my wife to come home....for more wake-word samples...(for you)
    When it is ready , i wil transfer the zip to you
1 Like

I found a part of the problem!

All my recorded files with bash record.sh are 1 kb

When i do a arecord a.wav it is much longer!

(.venv) pi@raspberrypi:~/sndpvk $ arecord -l
perhaps i have to adjust de record.sh with the right settings of my sound card seed2mic ?

**** List of CAPTURE Hardware Devices ****
card 1: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0


(.venv) pi@raspberrypi:~/sndpvk $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
pulse
    PulseAudio Sound Server
default
    Playback/recording through the PulseAudio sound server
playback
capture
dmixed
array
usbstream:CARD=Headphones
    bcm2835 Headphones
    USB Stream Output
sysdefault:CARD=seeed2micvoicec
    seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Default Audio Device
dmix:CARD=seeed2micvoicec,DEV=0
    seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Direct sample mixing device
dsnoop:CARD=seeed2micvoicec,DEV=0
    seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Direct sample snooping device
hw:CARD=seeed2micvoicec,DEV=0
    seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Direct hardware device without any conversions
plughw:CARD=seeed2micvoicec,DEV=0
    seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
    Hardware device with all software conversions
usbstream:CARD=seeed2micvoicec
    seeed-2mic-voicecard
    USB Stream Output

When i do:
arecord -f cd -Dhw:1 pvk.wav aplay -Dhw:1 pvk.wav

i do have recording and playback !

Use arecord -l instead of arecord -L than adapt the sox command in the record.sh to something like:

sox -t alsa plughw:1,0 -r 16000 -c 1 -b 16 -e signed-integer -L ${DIR}/hotword.${n}.wav \
        trim 0 4 vad -p 0.2 reverse vad -p 0.6 reverse

where plughw:1,0 is corresponding to the device number of your 2 mic hat.

Are you using a desktop installation of Raspberry Pi OS?
This would also explain why precise-listen isn’t working properly as the desktop version comes with pulseaudio installed and that tends to give problems with pyaudio.

Yes

Some of both

It uses everything in your-wake-word/wake-word and the files in your-wake-word/test/wake-word for validation

I would keep a copy outside of the folder and copy it fresh to the mycroft-precise folder before a new training round. When using incremental training precise runs the model it has at that point against the wav files in the random noise folder. Every time it triggers a false positive this way it takes the chunk it triggers on and saves them to either your-wake-word/not-wake-word/generated or some of them to your-wake-word/test/not-wake-word/generated for validation.
Every ten false positives it will trigger a retraining of the model with this new data it saved. As this data is saved in the wake-word folder you don’t want it there when you start a new session. So once you finished a training session and have converted and saved a pb model to an external folder as described above you have to delete all the files concerning the wake-word from the precise folder before you start again.

The 1 minute chunks of random audio

Hope this helps, Johannes

Hi @Johannes
I am a step further, i think.
Yes i installed an image with the desktop.
I changed my record.sh and added : plughw:1,0. Now my recordings have a filesize!

I created 20 wakewords, 5min file, the chunks (script created 5 pieces) and
after the combine i had 20 extra chunk-wakeword files
The last is strange, i expected every wakeword gets 5 chunk combinations ?

Then i did a test to check if every thing works ok...
so i did a:
(.venv) pi@raspberrypi:~/mycroft-precise $ precisie-train hey-bram.net /home/pi/mycroft-precise/hey-bram/wake-word/ -e 100 -s 0.5

This is the outcome, still no result...
Perhaps, de not-wake-word must be filled for precise-train ?

Using TensorFlow backend.
WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.COMPILER_VERSION is deprecated. Please use tf.version.COMPILER_VERSION instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.CXX11_ABI_FLAG is deprecated. Please use tf.sysconfig.CXX11_ABI_FLAG instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.ConditionalAccumulator is deprecated. Please use tf.compat.v1.ConditionalAccumulator instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3138: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/keras/optimizers.py:757: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING: Found 40 wavs but no tags file specified!
Data: <TrainData wake_words=0 not_wake_words=0 test_wake_words=0 test_not_wake_words=0>
Loading wake-word...
Loading not-wake-word...
Loading wake-word...
Loading not-wake-word...
Inputs shape: (0, 29, 13)
Outputs shape: (0, 1)
Test inputs shape: (0, 29, 13)
Test outputs shape: (0, 1)
Not enough data to train

This is wrong you only need to use the path to the top level folder for the wake-word. So it should be:

(.venv) pi@raspberrypi:~/mycroft-precise $ precise-train hey-bram.net /home/pi/mycroft-precise/hey-bram/ -e 100 -s 0.5

No you get on duplicate with added random noise for each wake-word wav. This 1:1 ratio of clean to noisy wake-word samples works best for me.

You will need about 40 different of those 5 minute files with different random talking /household noises /random noises /tv noises (everything you expect in your household except the wake-word) so that you will have about 200 1 minute files in your noise folder.

Yes, it works !!!
and again a step further :slight_smile:

the next command is precise-train-incremental...
my noise files are in folder /home/pi/mycroft-precise/ruis-chunks, so i did a:

precise-train-incremental hey-bram.net /home/pi/mycroft-precise/hey-bram/ -r /home/pi/mycroft-precise/ruis-chunks/ -e 50 -th 0.4 -s 0.5

and get strange feedback...

(.venv) pi@raspberrypi:~/mycroft-precise $ precise-train-incremental hey-bram.net /home/pi/mycroft-precise/hey-bram/ -r /home/pi/mycroft-precise/ruis-chunks -e 50 -th 0.4 -s 0.5
Using TensorFlow backend.
WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.COMPILER_VERSION is deprecated. Please use tf.version.COMPILER_VERSION instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.CXX11_ABI_FLAG is deprecated. Please use tf.sysconfig.CXX11_ABI_FLAG instead.

WARNING:tensorflow:From /home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/tensorflow/__init__.py:98: The name tf.ConditionalAccumulator is deprecated. Please use tf.compat.v1.ConditionalAccumulator instead.

Loading from hey-bram.net...
Traceback (most recent call last):
  File "/home/pi/mycroft-precise/.venv/bin/precise-train-incremental", line 33, in <module>
    sys.exit(load_entry_point('mycroft-precise', 'console_scripts', 'precise-train-incremental')())
  File "/home/pi/mycroft-precise/precise/scripts/base_script.py", line 43, in run_main
    script = cls(args)
  File "/home/pi/mycroft-precise/precise/scripts/train_incremental.py", line 70, in __init__
    super().__init__(args)
  File "/home/pi/mycroft-precise/precise/scripts/train.py", line 87, in __init__
    self.model = create_model(args.model, params)
  File "/home/pi/mycroft-precise/precise/model.py", line 70, in create_model
    model = load_precise_model(model_name)
  File "/home/pi/mycroft-precise/precise/model.py", line 54, in load_precise_model
    return load_keras().models.load_model(model_name)
  File "/home/pi/mycroft-precise/.venv/lib/python3.7/site-packages/keras/models.py", line 242, in load_model
    model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

Well I just tried a fresh install and this one gives me the same error unfortunately :weary:
Somebody already reported it on github.
My old version is still working so it’s a newly introduced bug :frowning:
I still have the old version fortunately but I’ll hope they will fix it soon.

edit

For reference here is the issue:

first part in the installation where i was errorless :slight_smile:
I am gonna make your HE PIPS wav-files this evening. Get two guest, so 6 times 10 wav files....
After that i need your email, i will transfer the zip to you with wetransfer

1 Like

Hello,
I just stumbled upon a solution for the precise problem in a thread on the Rhasspy forum.
If you go to the precise folder and than open the setup.py script and look for the requirements and than change the line containing h5py to h5py<3.0.0 it will work. Just change that line and than run the setup.sh script again. It will now install a previous version of h5py and you won’t get the decode error anymore.

hi Johannes, Thanks for the tip! I wil try it this weekend. Was a bit busy, new job...

1 Like

I did a precise-train-incremental hey-bram.net /home/pi/mycroft-precise/hey-bram/ -r /home/pi/mycroft-precise/ruis-chunks/ -e 50 -th 0.4 -s 0.5

I think it worked,
i got files on
/home/pi/mycroft-precise/hey-bram/test/not-wake-word/generated

and did

a. cp /home/pi/mycroft-precise/hey-bram/test/not-wake-word/generated/* /home/pi/mycroft-precise/hey-bram/not-wake-word/generated
b. precise-convert hey-bram.net

c. i had on /home/pi/mycroft-precise/hey-bram and renamed that to _org
d. i made a fresh /home/pi/mycroft-precise/hey-bram
e. cp /home/pi/mycroft-precise/hey-bram.pb
/home/pi/mycroft-precise/hey-bram/

f. So what now, @JGKK?
a. think i must make a change in the kaldi profile in node-red to use hey-bram.pb ? where can i find how to do that, i tried myself but does not work...

by adding this to my kaldi profile in node-red? does not work...?

"wake": {
  "system": "precise",
  "precise": {
    "model": "hey-bram.pb",
    "sensitivity": 0.5,
    "trigger_level": 3,
    "chunk_size": 2048
  }
}

name: "nl_kaldi-cgn"
version: "1.1"

language:
name: "dutch"
code: "nl"

text-to-speech:
espeak:
voice: "nl"

speech-to-text:
acoustic-model-type: "kaldi"
kaldi:
model-type: "nnet3"

wake: {
system: "precise",
precise: {
model: "hey-bram.pb",
sensitivity: 0.5,
trigger_level: 3,
chunk_size: 2048
}
}

training:
acoustic-model-type: "kaldi"
kaldi:
model-type: "nnet3"
large-files:
- !env "{profile_dir}/base_dictionary.txt" - !env "{profile_dir}/base_language_model.txt"
- !env "{profile_dir}/base_language_model.fst" - !env "{profile_dir}/g2p.fst"
- !env "{profile_dir}/acoustic_model/model/final.mdl" - !env "{profile_dir}/acoustic_model/model/graph/HCLG.fst"

I think, i got it working! endly !

Only thing i must improbe is that it reacts to offten on non-wakewords amd i get this log:

Logging:
wake-word detetected but ignoring as as audio is already beeing forwarded or listening paused

Question how can i make the wakeword better? so that it does not respond to other commands?

For others:
This is the part to add to the profile for kaldi

wake-word:
sensitivity: 0.5

precise:
# Path to precise-engine executable.
# Use $PATH if empty.
engine-executable: ""
model-file: !env "/home/pi/mycroft-precise/hey-bram/hey-bram.pb"

Sorry just saw it. You can drop the !env and just use the path :+1:t2:

  • add more random audio to train against
  • decrease the noise you add to the duplicates by adding a -v argument to the noise script that decreases the level of the noise in relation to the wake word:
#!/bin/bash

NOISEDIR=$1

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

for f in *.wav
do 
    NOISEFILE=$(find ${NOISEDIR} -type f | shuf -n 1)
    
    sox -m $f -v 0.5 ${NOISEFILE} noise.$f trim 0 `soxi -D $f`
done
  • decrease the -th or -s value in the training, not sure which one was responsible for overal sensitivity
  • add more wake word samples

this is because it triggers the wakeword on you speaking your commands. So record exactly this, you speaking commands and ad those recordings to the random audio for training.

When everything is working i will publish my procedure and flows and scripts.

At the end i made a folder /home/pi/mycroft-precise/hey-bram-exec
and placed the created hey-bram.pb* in it.

Can i delete below files from the precise folder
( i have a backup on home/pi for:

  • 5minfiles
  • wakewords
  • chunked files (small fragments from 5 min files)

I like to delete
Hey-bram* (log, net/epoch/pb*/trained*) on /home/pi/mycroft-precise
( i copied hey-bram.pb* in the executionfolder that is used by node-red)