Log in

Building My Own ESP32 Voice Assistant – Part 6: "Hello Bex", Training My Own Wake Word

B By Bisonar Team · 11 min · 2026-10-31

Building My Own ESP32 Voice Assistant – Part 6: "Hello Bex", Training My Own Wake Word

This is part 6 of an ongoing series in which I build my own ESP32 voice assistant. I add new parts as the components arrive and the project moves forward.

Türkçe versiyonu

At the end of Part 5 I found out that Jarvis struggled with my accent. Lowering the detection threshold from 97% to 90% mostly fixed it. But something kept bothering me: why use a word that someone else picked, trained on other people's voices?

In this part I give my assistant its own name. To do that, I train my own wake word model from scratch.

Ready-made words, and why they were not enough

ESPHome's on-device wake word system, microWakeWord, comes with four pre-trained models:

  • Okay Nabu: Home Assistant's official wake word
  • Hey Jarvis: The one I was using
  • Hey Mycroft:
  • Alexa: If you have a real Alexa at home, both wake up

All of them are English, and all of them were trained on English pronunciation. My home, in Home Assistant, is called Beks Smart Home. The assistant had to be called "Beks" too.

First I thought of "Merhaba Beks"

My first idea was a fully Turkish phrase: "Merhaba Beks" ("Hello Beks" in Turkish). Four syllables, clear vowels. On paper, a good wake word.

Then I read how these models are trained and changed my mind.

A model needs thousands of "Merhaba Beks"

A wake word model answers a simple question: "Was the sound I heard in the last 1.5 seconds this word?" To learn that, it needs two kinds of examples:

  • Positive samples: the word spoken by thousands of different voices, in different tones, in different rooms.
  • Negative samples: everything that is not the word. Conversations, music, TV, kitchen noise, silence.

Since I cannot get thousands of people to say "Merhaba Beks", the positive samples have to be spoken by a computer. microWakeWord's training guide uses a text-to-speech (TTS) model called Piper for this. It can speak with the voices of hundreds of different speakers.

The catch: this model is English. Reading "Merhaba" with English letter sounds would produce something like "mur-ha-buh". The model would learn that, not my "Merhaba".

The fix was simple: switch to a phrase that sounds natural when read in English. "Hello Beks". "Hello" is already English, and "Beks" reads like the English "becks" or "bex".

Which spelling sounds like me?

The TTS model reads words as they are written, so spelling matters. I tried three spellings and had each one spoken by three different voices:

  • 1: hello beks
  • 2: hello becks
  • 3: hello bex ✅

I listened to all nine. The closest to the way I say it was "hello bex". One of the samples:

🔊 Listen to the synthetic "hello bex" sample (GitHub)

Setup: a training environment on the Mac

Instead of Google Colab, I decided to train on my own Mac (M1 Pro, 16 GB RAM). I used two open source tools:

  • microWakeWord (Kevin Ahrendt): What it does: Trains the model and converts it to run on the ESP32; License: Apache 2.0
  • piper-sample-generator (Michael Hansen): What it does: Speaks the word with hundreds of different voices; License: MIT

On the Mac I used the Apple Silicon (MPS) branch of piper-sample-generator.

Obstacles along the way

Nothing worked the first time. 😄

  1. Missing packages: the sample generator wanted numpy and webrtcvad. webrtcvad does not build on the Mac, so I installed the prebuilt webrtcvad-wheels.
  2. PyTorch's safety lock: recent PyTorch versions refuse to open downloaded model files by default, because such files can contain executable code:
      _pickle.UnpicklingError: Weights only load failed.
    

The voice model comes from the Rhasspy project's official GitHub release, so I treated it as trusted and lifted the lock for this command only:

      TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 python generate_samples.py ...

Only do this for files from a source you trust.

  1. A package version mismatch: data preparation stopped with this error on the first try:
      ImportError: To support encoding audio data, please install 'torchcodec'.
    

Since version 4, Hugging Face's datasets package reads audio with a different library, but microWakeWord was written for the older version. Pinning datasets to 3.x fixed it:

      pip install "datasets<4" soundfile librosa

This happens a lot with open source tools. Code that worked when the guide was written breaks when its dependencies move on.

  1. AudioSet has moved: the download URL of the noise dataset in the guide returned 404 Not Found. AudioSet on Hugging Face is now published as parquet files instead of .tar archives. On top of that, the files were saved with the new datasets version, which the older version I had just pinned could not read:
      ValueError: Feature type 'List' not found.
    

The fix: read the parquet file directly with pyarrow, open the FLAC audio inside with soundfile, and resample it to 16 kHz with librosa.

  1. Same library, two different APIs: for the Mac, the guide recommends a special branch of the pymicro-features library. But that branch calls the function ProcessSamples, while microWakeWord expects process_samples:
      AttributeError: 'MicroFrontend' object has no attribute 'process_samples'.
    

    Did you mean: 'ProcessSamples'?

The current version on PyPI (2.0.2) supports the Mac directly and has the right name. Installing it fixed the problem.

Five obstacles, each a few minutes of searching. Guides are correct on the day they are written. A year later, you have to find part of the way yourself.

"hello bex", 1000 times

python piper-sample-generator/generate_samples.py "hello bex" \
  --max-samples 1000 --batch-size 50 \
  --output-dir generated_samples

A few minutes later I had "hello bex" spoken by 1000 different voices. Only 29 MB in total.

Preparing for the real world: noise, echo, music

1000 studio-clean samples are not enough. In real life, when I say "Hello Bex", the TV is on, the room echoes, the dishwasher is running. The model has to see all of that too.

So before training, every sample is randomly degraded (augmentation):

  • Room echo: Source: MIT environmental impulse responses; Probability: 50%
  • Background noise: Source: Google AudioSet; Probability: 75% (together with music)
  • Background music: Source: Free Music Archive; Probability: ↑
  • Volume change: Source: ; Probability: 100%
  • Pitch shift, distortion, filters: Source: ; Probability: 10% each

For the negative side, I used the ready-made datasets prepared by microWakeWord's author: hours of speech, noisy dinner parties and ambient sound without speech.

License note: these datasets have mixed licenses. That is why a model trained with them is suitable for personal, non-commercial use only. The case design of my project is non-commercial anyway (CC BY-NC).

When the data was ready, the training folder had grown to 29 GB, 25 GB of which were negative samples. A huge pile of data for a tiny model, but the model has to recognize everything that is not "hello bex".

Training

The model uses microWakeWord's MixedNet architecture. It has only 26,049 parameters. For comparison, language models like ChatGPT have billions. It has to be this small to run continuously in the ESP32's limited memory.

I trained for 10,000 steps with the guide's settings. At each step the model sees 128 samples, and every 500 steps it is tested on data it has never seen. Training stopped one more time after it started, because the tensorboard package needed to log intermediate results was missing. I installed it and resumed from where it stopped.

On the M1 Pro the whole training took about 20 minutes, much shorter than I expected.

The intermediate results were interesting. The model learned to catch the word very quickly, but the false wake-ups went up and down from step to step:

  • 500: Recall: 97.5%; False wake-ups per hour: 12.9
  • 1,000: Recall: 99.5%; False wake-ups per hour: 23.4
  • 4,500: Recall: 97.5%; False wake-ups per hour: 1.0
  • 7,000: Recall: 99.0%; False wake-ups per hour: 40.2 😬
  • 7,500: Recall: 98.9%; False wake-ups per hour: 2.5 ← best
  • 10,000: Recall: 96.3%; False wake-ups per hour: 0.3

That is why microWakeWord does not pick the last step, but the step with the best balance. In this run, it picked step 7,500.

The final exam: the ESP32 version

To fit on the ESP32, the trained model is compressed to 8 bits (quantization). The result is a 62 KB .tflite file. This compressed model was tested once more on test data it had never seen:

  • 0.94: Miss rate: 6%; False wake-ups per hour: 0.75
  • 0.86: Miss rate: 4%; False wake-ups per hour: 0.94
  • 0.78: Miss rate: 4%; False wake-ups per hour: 1.13

The false wake-up test uses a recording of a noisy dinner party, so it is a hard scenario. I picked 0.94 as the default threshold, and updated the sensitivity options in Home Assistant to match this table:

options:
  - "Normal (%94)"      # 240/255
  - "Hassas (%86)"      # 219/255  "Sensitive"
  - "Çok hassas (%78)"  # 199/255  "Very sensitive"

Flashing it to the ESP32

ESPHome accepts your own trained model directly. Put the model file and a JSON manifest next to your YAML:

{
  "type": "micro",
  "wake_word": "Hello Bex",
  "model": "hello_bex.tflite",
  "version": 2,
  "micro": {
    "probability_cutoff": 0.94,
    "feature_step_size": 10,
    "sliding_window_size": 5,
    "tensor_arena_size": 30000,
    "minimum_esphome_version": "2024.7.0"
  }
}


micro_wake_word:
  models:
    - model: models/hello_bex.json
      id: hello_bex

When the device booted, the new word showed up in the log:

[micro_wake_word]: Probed tensor arena size: 20608 bytes
[micro_wake_word]:     - Wake Word: Hello Bex
[micro_wake_word]:       Probability cutoff: 0.94

The model uses about 20 KB of working memory on the ESP32.

The real test: "Hello Bex, hava temizleyiciyi kapat"

And then the moment came. I said it into the microphone, with my own voice and my own accent ("turn off / turn on the air purifier"):

Detected 'Hello Bex' with sliding average probability is 0.97 and max probability is 1.00
Anlaşılan komut: Hava temizleyiciyi kapat.
Home Assistant yanıtı: Hava temizleyici kapatıldı

Detected 'Hello Bex' with sliding average probability is 1.00 and max probability is 1.00
Anlaşılan komut: Hava temizleyici aç.
Home Assistant yanıtı: Hava temizleyici açıldı

I recorded it on video too. The air purifier in the living room turns on and off by voice:

Both on the first try. Compared to the stock model, the difference is very clear:

  • Average probability with my voice: "Hey Jarvis" (stock model): 0.90 – 0.96; "Hello Bex" (my model): 0.97 – 1.00
  • Default threshold: "Hey Jarvis" (stock model): 0.97; "Hello Bex" (my model): 0.94
  • Passing the threshold: "Hey Jarvis" (stock model): Usually below it; "Hello Bex" (my model): Comfortably above it
  • How many times I had to say it: "Hey Jarvis" (stock model): 2–3; "Hello Bex" (my model): 1

The interesting part: I did not use a single recording of my own voice to train the model. All samples were spoken by a computer. The difference comes from the word itself, and from choosing the spelling that matches my pronunciation.

Over the coming weeks I will watch whether Bex wakes up by mistake from the TV or during conversations, and share the results later in the series.

Code and model on GitHub

The training scripts, the trained model and a step-by-step guide are open source on GitHub:

👉 github.com/justicemilitia/bisonar-ai/tree/main/hello-bex-wake-word

If you want to train your own word, change "hello bex" in prepare_data.py and train.py. The fixes for the problems I ran into are in the scripts too.

I did not put the 29 GB of training data on GitHub. It is too big, and its licenses do not allow redistribution. The scripts download the data from its sources. After training, I deleted the data from my computer.

What I learned in this part

  • Training your own wake word is easier than you think. The hard part is fixing the broken dependencies in an outdated guide. The training itself took 20 minutes.
  • The choice of word matters as much as the model. Because the training samples come from an English voice, "Hello Bex", which reads naturally in English, worked much better than the Turkish "Merhaba Beks".
  • Playing with the spelling is how you tune the pronunciation. "beks", "becks" and "bex" are the same word, but the computer says each one differently. Listen and pick the one closest to how you say it.
  • Small model, big data. A 62 KB model with 26 thousand parameters needed 29 GB of data. Learning what the word is not takes more data than learning what it is.
  • The last step is not the best step. Results go up and down during training, so you need to pick the best intermediate model.

Next step

When the speaker and the amplifier arrive, I will hear Bex say "Hava temizleyici kapatıldı" out loud. After that, I will solder the microphone and put everything into the case.

What's next?

The project is still going: connecting the amplifier and the speaker, soldering, the LED ring and the final assembly come in the next parts.

Parts of the series

📘 The whole build is also on Instructables as a 10-step guide: DIY ESP32 Voice Assistant for Home Assistant With a Custom Wake Word


Case design: ImpatientMaker (a remix of JakeB's "Voice Assist Puck"), CC BY-NC 4.0. ESPHome code: impatientmaker/esphome-voice-assist (MIT). Wake word training: microWakeWord (Kevin Ahrendt, Apache 2.0) and piper-sample-generator (Michael Hansen, MIT). Full credits in Part 1.

AI Automationn8nBusiness
Share:
← Back to Blog