speechControl Driver

Last updated: · On hold
Features
The version 1 feature set is now sufficiently defined that development is proceeding against a frozen target rather than an open-ended list of ideas. The intention is to keep the public game-facing API stable even if the Pi-side implementation changes later.
The list below is the finalised V1 development target, not a claim that all features are implemented. The driver and communications foundation are hardware-proven through M2E and the first TTS request through M3A. Synthesis and DAC playback have also succeeded in a separate test. Backend integration, the fuller speech controls and STT remain development work.
Game-facing design
Designed specifically for NextBASIC and game-oriented use rather than as a general Linux speech wrapper.
Asynchronous operation so the game can continue running while speech is being synthesised or recognised.
DRIVER calls for control, status, limits, errors, session state and reconnect operations.
Three logical text channels: tts for speech output, stt for recognised text and grammar for command phrases.
Backend abstraction: games do not need to know about ALSA, USB device names, TTS engine names or STT engine names.
Numeric result and error reporting intended to be straightforward to use from BASIC.
Text-to-speech (TTS)
Asynchronous speech submission: returning to the game immediately rather than waiting for playback to finish.
Eight local TTS slots, allowing speech to be queued rather than forcing one sentence at a time.
Maximum v1 utterance length of 255 bytes.
Abstract voice IDs so games select a voice without depending on backend-specific voice names.
Configurable speech rate, pitch and volume.
Voice settings are snapshotted with each queued utterance, so later changes do not alter speech already waiting in the queue.
Speech status reporting, including idle, synthesising, speaking and error states.
Stop operation for active speech plus queued speech, and a separate queue-clear operation that can leave the current utterance running.
Printable ASCII is the initial game-facing text path for v1; Unicode translation is deliberately left for later.
Speech-to-text (STT)
Constrained, game-oriented command recognition rather than unrestricted dictation in v1.
One-shot listening for a single command and continuous listening for games that need ongoing voice control.
Grammar upload from the Spectrum to the Pi.
Synonyms: several spoken phrases can map to the same command ID, for example FIRE|SHOOT|OPEN FIRE.
Canonical text is retained alongside the compact command ID.
Recognition confidence normalised to a 0-100 range.
Configurable listen timeout and confidence threshold.
Four-result Pi-side queue so a short burst of recognised commands is not immediately lost if the game is busy.
Automatic STT pause while TTS is speaking in v1 to reduce the chance of the computer recognising its own generated voice.
Driver architecture and reliability
Normal 512-byte resident NextZXOS driver area, with one additional 8K ZX RAM bank for the banked worker.
Worker mapped through MMU7 at $E000-$FFFF, with the exact caller mapping restored on every return path.
Interrupt-safe IM1 callback architecture that has now been exercised on real hardware.
Framed SCSP binary protocol with protocol version, message type, sequence number, opcode, payload length, CRC-16 and frame escaping.
Retries reuse the same sequence number, allowing duplicate protection on the Pi side.
Session state machine covering Supervisor synchronisation, service launch, readiness banner, HELLO, READY, recovery and error states.
Public reconnect operation for quickly re-establishing the protocol when the service is already running.
Persistent Python 2.7-compatible Pi service stored on the writable NextPi partition, rather than embedding a large Python program inside the Z80 launch command.