Python examples 7.8.0¶
The Python sample projects are available in sample/python/ in the TrulyNatural installation directory.
See ~/Sensory/TrulyNaturalSDK/7.8.0-pre.2/sample/python/
New to the Session API? Start with the Python tab in Your first program, then explore the samples below.
Run the samples¶
-
Create the virtual environment and install the SDK wheel from $HOME/Sensory/TrulyNaturalSDK/7.8.0-pre.2/lib/python/:
cd ~/Sensory/TrulyNaturalSDK/7.8.0-pre.2/sample/python uv venv uv sync -
Run the smallest phrase-spotting sample:
uv run src/hello_world.py -
Run the sample acceptance tests:
uv run --group dev pytestlive_audio.pyis excluded from the default sweep because CI machines usually have no microphone. SetSNSR_RUN_LIVE_AUDIO=1to include a short live-capture run.
Examples¶
- hello_world.py
- Loads a wake-word model, runs pull-mode inference from a WAV file, and prints each result event.
- stt_push.py
- Runs push-mode Speech-to-Text by feeding WAV audio chunks with push. On SDK builds without STT, it exits cleanly with an "STT not supported" message.
- custom_stream.py
- Implements a custom input source with fromProvider and a zero-copy Python
memoryviewcallback. - live_audio.py
- Captures from the default microphone with fromAudioDevice and runs a wake-word spotter for a fixed duration.
- live_enroll.py
- Runs interactive UDT wake-word enrollment from recordings or live microphone input.