Satellite1-XMOS
Fork of the Satellite1 XMOS audio firmware with 4-mic beamforming and wake word steering
What is this?
A fork of the official Satellite1 XMOS firmware, the audio processor on the Satellite1 that handles echo cancellation (AEC), interference cancellation, noise suppression (NS) and gain control (AGC) before audio reaches the ESP32-S3.
It is the companion to Satellite1-ESPHome: that fork runs on the ESP32, this one shapes what the microphones hear.
Why?
The upstream firmware only uses two of the four microphones and has no idea where the talker is. In a real living room, with a TV or a fan running, that makes wake words and commands harder to pick up. This fork uses all four mics to find the talker and aim at them.
What's different
- Four-mic front end. Five mic modes: East/West or North/South pairs, an averaged pair, an auto pair that follows the talker, and a full beamformer.
- Beamforming. In beam mode the AEC/IC stages work as a generalized sidelobe canceller. One beam points at the talker and a blocking beam hears the rest of the room, so the interference canceller removes noise without cancelling speech.
- Direction of arrival. GCC-PHAT on both mic pairs estimates where speech comes from. The direction can be read by the host and shown on the LED ring.
- Wake word steering. When ESPHome reports a wake word, the device finds where it came from and steers the beams there right away. A TV stays in the blocking beam, where it gets cancelled.
- Separate wake word channel. The right channel carries audio without the main AGC and has its own leveling, tuned for the wake word engine.
- Smaller fixes. The mic gain is applied after the AEC so loud echo isn't clipped, a 100 Hz high-pass removes rumble, the AEC uses a mono reference, and the XMOS libraries are updated to lib_voice 2.0.0.
- Host simulation. The voice pipeline can run on a computer, so beam and steering alternatives can be tested without flashing hardware.
Satellite1
The Satellite1 by FutureProofHomes is a local, privacy-first voice assistant and multisensor that integrates with Home Assistant through ESPHome. Upstream: FutureProofHomes/Satellite1-XMOS.
The body links to the other project at /projects/satellite1-esphome, but I guessed that slug. Check it matches the slug on your existing entry. The repo's license is marked "Other" on GitHub, so I left licensing out of the body.
README · synced from GitHub
Satellite1 XMOS firmware
Variants
satellite1_firmware_fixed_delay
Uses the 'Automatic Delay Estimation and Correction' pipeline of the sln_voice example repository.
satellite1_firmware_bypass
A variant which bypasses the AEC/IC/NS/AGC stages. Hence, the mic signal (after the mic front end and mic gain) is streamed to the ESP32-S3.
Audio front end
All four PDM microphones (North, South, East, West) are decimated. The mic front end
reduces them to the two channels the AEC/IC/NS/AGC pipeline processes. The mode, the
mic gain and the direction of arrival are accessible through the audio servicer
(device-control resource 230, see docs/device-control-spi-protocol.md).
| Mode | Value | Channels |
|---|---|---|
MIC_MODE_PAIR_EW | 0 | East, West (default, the pre-4-mic behaviour) |
MIC_MODE_PAIR_NS | 1 | North, South |
MIC_MODE_AVERAGE | 2 | (North+East)/2, (South+West)/2 |
MIC_MODE_AUTO_PAIR | 3 | The mic facing the talker (from the DOA estimate) and the mic opposite it |
MIC_MODE_BEAM | 4 | A beam at the talker (from the DOA estimate) and a blocking beam that cancels the talker |
MIC_MODE_BEAM turns the AEC/IC stages into a generalized sidelobe canceller. All
four mics are time-aligned towards the talker. Channel 0 is their sum, so the talker
passes undistorted. Channel 1 is a weighted difference that cancels the talker and
hears the rest of the room, weakly below ~500 Hz and with gaps at some directions
above ~2.5 kHz. The IC uses channel 1 as its noise reference, so it removes noise
without a copy of the talker's speech to cancel. Entering the mode points the beams
at the last DOA straight away. After that they re-steer to the mean DOA once the
talker has been more than 15 degrees off them for ~0.5 s of speech, at most every
~3 s, and only if those DOA results agree: two talkers taking turns leave the beams
where they are. Each re-steer makes the AEC and IC re-adapt, as a pair switch does.
See src/audio/beamformer.h.
Steering from any speech also follows a TV, and is too slow for a wake word from a
new direction. So the host can report wake words (AUDIO_SERVICER_CMD_WAKE_EVENT):
the device then locates the wake word from the DOA results of the ~0.75 s before
the report (leaving out the ~300 ms the report takes) and
steers the beams (or, in MIC_MODE_AUTO_PAIR, picks the pair facing it) at once,
and does not re-steer until the conversation ends. With the steering policy
(AUDIO_SERVICER_CMD_STEER_POLICY) set to wake words only, other speech never moves
the beams: a TV stays in the blocking beam, where the IC cancels it.
The right output channel carries a signal without the AGC, for a wake word engine:
AEC+IC+NS by default, or AEC+IC or AEC only (AUDIO_SERVICER_CMD_CH1_TAP). The IC
stops adapting within a frame or two of speech onset
(AUDIO_SERVICER_CMD_IC_FAST_HOLD), so it does not learn to cancel the start of a
wake word when its noise reference also hears the talker. A 100 Hz high-pass
(AUDIO_SERVICER_CMD_HPF) removes rumble below the speech band before the AEC.
The mic gain (default 20 dB, range 0..30 dB) is applied after the AEC, so loud echo is not clipped before the AEC can cancel it.
The direction of arrival (DOA) is estimated with GCC-PHAT on the North/South and
East/West pairs during speech, and only while no audio is played back. It can be read
by the host and optionally shown on the LED ring (LED_RING_SERVICER_CMD_DOA_INDICATOR).
The speech-energy detector and its noise floor use a private 100 Hz high-pass copy
of all four mics. This filtering is always active, including when the configurable
audio HPF is off; it does not filter the streamed audio or change beam timing.
The audio HPF remains enabled by default and resets its history when re-enabled.
See DOA detector energy for validation and limitations.
Firmware Files
variant_name.factory.bin
A complete image of the flash memory: the boot partition, containing the flash loader and factory image.
variant_name.upgrade.bin
A firmware upgrade image that can be uploaded through the Device Firmware Update (DFU) service. Requires a factory image with DFU support running on the device.
variant_name.xe
The XMOS executable (XE) binary format stores programs for XMOS devices and includes information about the system it is intended to run on, allowing support for multiple program loads, configurations and debugging.
Flashing via Satellite1 ESPHome Firmware
Note: The Satellite1 does not come with a pre-flashed XMOS firmware. The initial firmware needs to be written directly to the flash memory via SPI.
The Satellite1 ESPHome firmware running on the ESP32-S3 writes the XMOS flash over SPI. Use a variant_name.factory.bin for this.
Upgrading via DFU over SPI
A device running a factory firmware with DFU support accepts variant_name.upgrade.bin
through the DFU servicer (device-control resource 240) over SPI. See
docs/device-control-spi-protocol.md for the commands.
USB DFU (dfu-util) is no longer supported.
Running / Flashing via xTAG
Note: The Satellite1 does not include an xTAG debugger. This option applies only when testing the firmware with a developer board like the XCORE.AI EVALUATION KIT.
When the XMOS board is connected as a USB xTag device, the firmware can be run or flashed as follows:
Running without flashing:
xrun --xscope variant_name.xe
Flashing:
xflash --quad-spi-clock 50MHz --factory variant_name.xe --boot-partition-size 0x100000
Building the firmware locally
Clone repository
git clone https://github.com/FutureProofHomes/Satellite1-XMOS.git
cd Satellite1-XMOS
git submodule update --init --recursive
Setup XTC-Tools
Download XTX-15.3.1 from https://www.xmos.com/software-tools/
On Mac, the original software requires installing into /Applications. If you want to install into another directory, change XMOS_TOOL_PATH in ${INSTALL_DIR}/SetEnv.sh to :
export XMOS_TOOL_PATH=${0:A:h};
Setup Python Virtual Environment
The xmos-ai-tools python package is required for building the firmware modules.
The build generates the VNR model source (<build dir>/modules/voice/lib_voice/src.autogen/vnr_model/trained_model_xcore.tflite.*) with the xcore-opt of this package, and links lib_voice's VNR against the package's TFLite Micro runtime. lib_voice's AEC schedule generator (run at configure time) needs the numpy it installs as well. When the installed xmos-ai-tools version changes, CMake deletes those generated files on the next configure so they are rebuilt with the new version (modules/CMakeLists.txt).
It is recommended to install it into a virtual environment on Python 3.12 (CI uses the same version; newer Pythons don't work because xmos-ai-tools needs numpy<2.0, which has no wheels past 3.12):
python3.12 -m venv .venv
source activate .venv/bin/activate
pip install -r requirements.txt
for later builds simply activate the environment before calling cmake:
source activate .venv/bin/activate
Creating factory and upgrade images
On Linux and Mac run:
cmake -B build --toolchain xmos_cmake_toolchain/xs3a.cmake
cd build
make create_flash_img_variant_name
make create_upgrade_img_variant_name
On Windows run:
cmake -G Ninja -B build --toolchain xmos_cmake_toolchain/xs3a.cmake
cd build
ninja create_flash_img_variant_name
ninja create_upgrade_img_variant_name
Building the XMOS executable only (.xe file)
Run the following commands in the root folder to build the firmware.
On Linux and Mac run:
cmake -B build --toolchain xmos_cmake_toolchain/xs3a.cmake
cd build
make variant_name
On Windows run:
cmake -G Ninja -B build --toolchain xmos_cmake_toolchain/xs3a.cmake
cd build
ninja variant_name