2.42 - ROOM ART AND SPEECH
build/DrawerArt draws the sliding left TV drawer, angled VHS case, HOME
lettering and caption. build/RoomDetail handles the three clicks and the
A310 floppy lamp. build/BuildEffects generates the drawer voice from text
using eSpeak NG 1.52.0 (English, speed 157, pitch 37). The finite stereo
clip is number 51 in !Xmas26/FXBank. Source and sample data are listed in
build/EffectsData. The existing project and third-party licences apply.

XMAS26 2.32 UPDATE
BuildEffects now uses standalone eSpeak NG text-to-WAV conversion, not
ctypes or a linked Python binding. The clean elf clip is 0.6343s; original
penguin boings are 2.4s, clip 45. Native playback remains the same.
The following explains the existing playback architecture and history.

XMAS26 v2.29 - HOW THE SPEECH WORKS

VERSION 2.31 ADDITION
FXBank now has 45 clips. IDs 0..43 and the ARM callback are unchanged.
ID 44 is a fixed four-second elf effect: generated British-English
"Yum yum!" at the start and original synthetic eating sounds. It reuses
the finite SharedSound SFX channel and does not join words at runtime.
The implementation notes below remain valid for the spoken clock.

2 November 2026

This is a native playback implementation, not a port of the complete
eSpeak NG speech synthesiser to RISC OS.

BUILD COMPUTER
build/BuildEffects uses eSpeak NG 1.52.0 through espeakng-loader 0.2.4 and
Python ctypes. The British English formant voice generates the numbers and
short fixed phrases. It runs synchronously on the build computer and returns
PCM through a callback. NumPy/SciPy trim long silent edges, resample to
11,025 Hz, normalise each clip and apply short fades and joining gaps.
The results are signed 16-bit stereo PCM, with the mono speech duplicated
in left and right channels. FXBank contains a header, an offset/length table
and those samples. It also holds original synthesized train and bell effects.

ON RISC OS
build/Effects validates the bank, loads it into the Relocatable Module Area
(RMA), and allocates a 441,000-byte phrase buffer. BASIC selects the required
words and copies them into that buffer. A 76-byte original ARM callback in
FXCode feeds the samples to SharedSound, which mixes them with other audio.
The Wimp task polls for completion; it does not wait until the phrase finishes.
Train, speech and clock bell have separate handlers. Clock announcements and
countdown speech share one handler: a new phrase replaces the previous one.
A handler must be removed successfully before its buffer is rewritten/freed.

eSpeak NG, Python, dictionaries, voice data, a neural model and an online
service are not needed on the target machine. This fixed vocabulary cannot
read arbitrary text. Supporting arbitrary speech would require a larger
recording inventory or an actual RISC OS text-to-speech engine/port.

CLOCK CONTROLS
Left-click the wall clock: read the RISC OS local time again and announce it.
Right-click (Adjust): enable/disable hourly chimes, with spoken confirmation.
Middle-click retains the application context menu. Countdown clicks still
announce the days remaining. Music mute does not mute these click sounds.

Examples:
  00:00  The time is midnight.
  12:00  The time is midday.
  09:05  The time is nine oh five in the morning.
  14:30  The time is two thirty in the afternoon.
  19:00  The time is seven o'clock in the evening.
  23:59  The time is eleven fifty nine in the evening.

The time is a snapshot at the click, from OS_Word 14 and
Territory_ConvertDateAndTime. It uses the computer's configured local time;
the app does not contact a time server. A four-second HH:MM notice accompanies
the announcement. The clock normally continues to show hands and date only.
Announcements also work with animation stopped, Low Power enabled or the
scene paused. The native SharedSound/16-bit sound requirement is unchanged.

The v2.29 bank has 44 clips and occupies 1,428,044 bytes. Original IDs 0..35
are preserved; eight time phrases are appended as IDs 36..43. The original
clips and ARM callback remain byte-identical. See EffectsData for each clip
and CheckSpeech/Validation for exhaustive time/countdown and buffer checks.

LICENSING AND AI
The software and generated speech are different materials. See the existing
Licences/eSpeakNG credit and Licences/RightsReview; eSpeak's GPL program and
voice-data files are not redistributed. This formant-synthesis/sample-playback
path does not use a generative AI voice service or clone a person's voice.
ChatGPT/Codex assisted with the project code and build work, as disclosed in
AppSources. That development history is separate from the app's runtime.

References:
https://github.com/espeak-ng/espeak-ng
https://pypi.org/project/espeakng-loader/
The supplied RISC OS SharedSound interface and build/FXARM document replay.

2.34: clip 50 is "You found me!". BuildEffects.found_signal calls the
standalone eSpeak NG 1.52.0 process with -v en -s 172 -a 85 -p 64. Output
is trimmed, resampled, normalised to peak 0.65 and faded, as for other speech.
It is played directly on the existing speech channel. New artwork/code is
original; no commercial character artwork or recorded voice sample is used.
