docs: make the README a short landing page

Move the build options, the timing notes, the Asterisk, FreeSWITCH,
FreePBX and live-voice instructions and the voice rebuild steps into
topic files in docs/. The README keeps the voices, the parts, a quick
start and an index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSvurgAXJHmd8Fs4ud
This commit is contained in:
Claude committed 2026-11-23 13:46:08 +00:00
1 parent d8831f4187
commit 378f8d65b9
9 files changed
+218 -194

No files matched your search

+19 -193
View File
@@ -9,6 +9,8 @@ It has these voices, and each voice can give the time to the second:
- Classic speech synthesisers: Microsoft Sam and the other SAPI4 voices,
DECtalk, SAM, MacInTalk and PlainTalk.
The repository has these parts:
- **`asterisk/`**: `app_speakingclock`, the `SpeakingClock()` dialplan
application, written in C.
- **`freepbx/speakingclock/`**: a FreePBX module. Clocks are destinations,
@@ -25,213 +27,37 @@ It has these voices, and each voice can give the time to the second:
The recordings in `voices/` belong to their original owners, and **are not
covered by the code's licence**. Refer to [NOTICE.md](NOTICE.md).
## Building and installing
From the top of the repository:
## Quick start
```sh
make # modules for the PBXs found here, synth/mssam, synth/macintalk,
# sclock-render, and the Microsoft and Apple voice data
sudo make install # modules, configs, voices/ into each PBX's sounds/speaking-clock,
# and the synthesisers with their voice data under /usr/local
make # the modules for the PBXs on this machine, the synthesisers and sclock-render
sudo make install # the modules, the configuration and the voices
make test # render 30 seconds of Pat Simmons with sclock-render
```
It builds `app_speakingclock` if Asterisk's headers are installed and
`mod_speakingclock` if FreeSWITCH's are. `make PBX="asterisk freeswitch"`
picks them yourself (with `ASTERISK_INCLUDE=` or `FS_INCLUDE=` for headers
somewhere else). Microsoft's and Apple's voice files are not in this
repository: `make` downloads them from the Internet Archive into
`sources/` (cabextract or 7z for Microsoft's, unar or unrar for the
PlainTalk voices). `FETCH=no` skips the download, `SYNTH=no` skips the
synthesisers, and `PREFIX=` and `DESTDIR=` work as usual. The sections
below build one part at a time.
## How it keeps time
The old machines played one recording, and all callers listened to it.
The time mark (the third pip, or the tone) came exactly on the second
that the recording announced. Callers started to listen in the middle of
a sentence.
`SpeakingClock()` operates in the same way. The module aligns each
announcement to the system clock, sample by sample. Thus, keep the
system clock on NTP. The module checks the clock each second. If the
clock drifts by more than 20 ms, the module moves back to the clock. The
module does not put announcements in a queue with `Playback()`. Thus the
clock does not drift, for calls of all lengths. On a test call, the third
pip of Pat Simmons came less than 10 ms from the second.
mod_speakingclock does the same on FreeSWITCH.
## Asterisk
```sh
cd asterisk
make # needs Asterisk's headers (asterisk-dev, or make install-headers)
sudo make install # module, speakingclock.conf, voices into sounds/speaking-clock
asterisk -rx 'module load app_speakingclock.so'
```
Then dial the clock from the dialplan:
```
exten => 123,1,SpeakingClock(tim-pat-simmons,t(Europe/London))
exten => 1194,1,SpeakingClock(tim-gordon-gow,t(Australia/Sydney))
exten => 767,1,SpeakingClock(atandt-mike,t(America/Los_Angeles)d(300))
```
`SpeakingClock([voice[,options]])` answers the call. Then it plays until
the caller hangs up or until the duration ends. These are its options:
The clock keeps to the system clock to the sample. Thus, keep the system
clock on NTP ([How it keeps time](docs/timing.md)).
| Option | Effect |
|---|---|
| `t(zone)` | time zone (default: `timezone` in speakingclock.conf, or if it is not set, the time zone of the system) |
| `d(seconds)` | hang up after this number of seconds. 0 means never (default `maxduration`, 180) |
| `h` | 24-hour clock |
| `p(seconds)` | seconds between announcements |
| `s(a+b+c)` | the clips to say, in place of the sequence of the voice (docs/voice-format.md) |
| `w` | wait for the start of the next announcement. Do not start in the middle of an announcement |
| `x` | return when the caller pushes a key |
## Documentation
CLI:
- `speakingclock show voices` lists the voices.
- `speakingclock render <voice> <unix time> <seconds> <file.sln> [zone]`
writes the audio that a caller hears, as 8 kHz signed linear, without a
call.
- `module reload app_speakingclock` reads the configuration and the
voices again.
Asterisk writes "Couldn't find application SpeakingClock in XML
documentation" in the log. The cause is that a module built outside the
source tree of Asterisk has no installed XML documentation. This warning
does not cause a problem.
## Live voices
A voice with `mode=tts` has no clips. For each announcement, the module
runs a synthesiser on the Asterisk machine for the full sentence ("At the
third stroke, it will be four fifteen and twenty seconds."). It does this
a short time before the module must have the sentence. Thus the call
never waits for the synthesiser.
- The `live-dectalk-*` and `live-sam-*` voices run `say` of DECtalk and
`sam`.
- The `live-macintalk-*` voices (Fred, Ralph, Kathy, Zarvox and the other
15 MacInTalk 3 voices) and the `live-plaintalk-*` voices (Agnes, Bruce
and Victoria, standard and high quality) run
[synth/macintalk](synth/macintalk). This is our own synthesiser, and it
reads the voice data of Apple. `cd synth/macintalk && make && make voices && sudo make install`
builds the synthesiser and downloads the data. The PlainTalk voices
also must have `unar` or `unrar` to unpack their disk image.
Set the locations of the programs in speakingclock.conf:
```
tts_program_dectalk=/opt/dectalk/say
tts_program_sam=/usr/local/bin/sam
tts_program_macintalk=/usr/local/bin/macintalk
```
The `live-mssam-*` voices (Microsoft Sam, Mike and Mary, and Mike and
Mary for telephone) run [synth/mssam](synth/mssam). This is our own
synthesiser, and it reads the voice data of Microsoft.
`cd synth/mssam && make && make voices && sudo make install` builds the
synthesiser and downloads the data. Its setting is `tts_program_mssam`.
Refer to [docs/voice-format.md](docs/voice-format.md#live-voices-modetts).
## FreeSWITCH
```sh
cd freeswitch
make # needs FreeSWITCH's headers (libfreeswitch-dev, or a source install)
sudo make install # module, autoload_configs/speakingclock.conf.xml, voices into sounds/speaking-clock
fs_cli -x 'load mod_speakingclock'
```
To load the module at start, add `<load module="mod_speakingclock"/>` to
`autoload_configs/modules.conf.xml`. This is an example for the dialplan
([dialplan-example.xml](freeswitch/dialplan-example.xml)):
```xml
<extension name="speakingclock_tim">
<condition field="destination_number" expression="^123$">
<action application="speakingclock" data="tim-pat-simmons t(Europe/London)"/>
</condition>
</extension>
```
`speakingclock [voice] [options]` accepts the same voices and options as
`SpeakingClock()` above (`t(zone)`, `d(seconds)`, `h`, `p(seconds)`,
`s(a+b+c)`, `w`, `x`). Write the options after the voice, with a space.
With `x`, the channel variable `speakingclock_key` contains the key that
the caller pushed. The time zones are the time zones of FreeSWITCH, from
`timezones.conf.xml`. The live voices operate in the same way. Set
`tts_program_*` in
[speakingclock.conf.xml](freeswitch/speakingclock.conf.xml).
The module sends the clock in 8 kHz signed linear frames. The frames
have the same length as the frames of the call. FreeSWITCH converts them
to the codec and rate of the call. The module calculates each frame from
the position of the clock against the system clock. Thus the time mark
comes on the second, for all codecs.
API (fs_cli):
- `speakingclock voices` lists the voices.
- `speakingclock render <voice> <unix time> <seconds> <file.sln> [zone]`
writes the audio that a caller hears, as 8 kHz signed linear.
- `speakingclock reload` (or `reloadxml`) reads the configuration and the
voices again.
`PBX=freeswitch test/render_test.py` runs the timing test on the module.
Without a PBX, `cd core && make` builds `sclock-render`. It does the same
as `speakingclock render`:
`./sclock-render -v ../voices tim-pat-simmons 1762791295 30 out.sln Europe/London`.
## FreePBX
Do one of these procedures:
- Put `freepbx/speakingclock` into a tarball and install it with Module
Admin (upload).
- Copy `freepbx/speakingclock` to `/var/www/html/admin/modules/` and run
`fwconsole ma install speakingclock`.
The module must have app_speakingclock, installed as described above.
Then **Applications > Speaking Clock** lists your clocks. Each clock is a
destination for inbound routes, IVRs and time conditions. Each clock can
also have a number that extensions can dial.
## Rebuilding the voices
```sh
tools/fetch-sources.sh sources # curl, git, unzip, 7z or innoextract
tools/build_voices.py sources voices # ffmpeg
```
The synthesiser voices come from `tools/synth_voices.py`. This tool
tells the synthesiser to speak each clip separately (a whole number,
"and twenty seconds", "At the third stroke, it will be"). Thus they are
`tim` voices that give the time to the second, and the module makes the
pips:
```sh
tools/synth_voices.py --list # the voices it knows
tools/synth_voices.py voices sapi4:microsoft-sam # SAPI4, via tetyys.com
DECTALK_SAY=~/dectalk/dist/say tools/synth_voices.py voices dectalk:paul
SAM=~/SAM/sam tools/synth_voices.py voices sam:sam
MSSAM=synth/mssam/mssam tools/synth_voices.py --live voices mssam:sam # live-mssam-sam
tools/synth_voices.py voices mac:Fred # MacInTalk, on a Mac
tools/synth_voices.py voices mac:Victoria # PlainTalk, on a Mac
tools/synth_voices.py voices macintalk:fred # MacInTalk 3, synth/macintalk
tools/synth_voices.py --live voices macintalk:zarvox # live-macintalk-zarvox
tools/synth_voices.py --live voices plaintalk:agnes # live-plaintalk-agnes
```
- [Building and installing](docs/building.md): the options of `make`, and the voice data that it downloads
- [Asterisk](docs/asterisk.md): `SpeakingClock()`, its options and the CLI commands
- [FreeSWITCH](docs/freeswitch.md): `mod_speakingclock` and its API
- [FreePBX](docs/freepbx.md): the module, and clocks as destinations
- [Live voices](docs/live-voices.md): DECtalk, SAM, MacInTalk, PlainTalk and Microsoft Sam, spoken at each announcement
- [Rebuilding the voices](docs/rebuilding-voices.md): the source recordings and the synthesiser voices
- [Voice format](docs/voice-format.md), [MacInTalk format](docs/macintalk-format.md), [PlainTalk format](docs/plaintalk-format.md), [Microsoft Sam format](docs/mssam-format.md)
- [Documentation style](docs/STYLE.md): the rules for ASD-STE100 Simplified Technical English
## Licence
The code is licensed under the GPL, version 2 or (at your option) any later
version. Thus Asterisk (GPL-2.0) can load the module. Refer to
The code is under the GPL, version 2 or (at your option) any later
version, so that Asterisk (GPL-2.0) can load the module. Refer to
[LICENSE](LICENSE). The recordings are not covered by it. Refer to
[NOTICE.md](NOTICE.md).
+41
View File
@@ -0,0 +1,41 @@
# Asterisk
```sh
cd asterisk
make # needs Asterisk's headers (asterisk-dev, or make install-headers)
sudo make install # module, speakingclock.conf, voices into sounds/speaking-clock
asterisk -rx 'module load app_speakingclock.so'
```
```
exten => 123,1,SpeakingClock(tim-pat-simmons,t(Europe/London))
exten => 1194,1,SpeakingClock(tim-gordon-gow,t(Australia/Sydney))
exten => 767,1,SpeakingClock(atandt-mike,t(America/Los_Angeles)d(300))
```
`SpeakingClock([voice[,options]])` answers the call. Then it plays until
the caller hangs up or until the duration ends. These are its options:
| Option | Effect |
|---|---|
| `t(zone)` | time zone (default: `timezone` in speakingclock.conf, or if it is not set, the time zone of the system) |
| `d(seconds)` | hang up after this number of seconds. 0 means never (default `maxduration`, 180) |
| `h` | 24-hour clock |
| `p(seconds)` | seconds between announcements |
| `s(a+b+c)` | the clips to say, in place of the sequence of the voice (docs/voice-format.md) |
| `w` | wait for the start of the next announcement. Do not start in the middle of an announcement |
| `x` | return when the caller pushes a key |
CLI:
- `speakingclock show voices` lists the voices.
- `speakingclock render <voice> <unix time> <seconds> <file.sln> [zone]`
writes the audio that a caller hears, as 8 kHz signed linear, without a
call.
- `module reload app_speakingclock` reads the configuration and the
voices again.
Asterisk writes "Couldn't find application SpeakingClock in XML
documentation" in the log. The cause is that a module built outside the
source tree of Asterisk has no installed XML documentation. This warning
does not cause a problem.
+22
View File
@@ -0,0 +1,22 @@
# Building and installing
From the top of the repository:
```sh
make # modules for the PBXs found here, synth/mssam, synth/macintalk,
# sclock-render, and the Microsoft and Apple voice data
sudo make install # modules, configs, voices/ into each PBX's sounds/speaking-clock,
# and the synthesisers with their voice data under /usr/local
make test # render 30 seconds of Pat Simmons with sclock-render
```
It builds `app_speakingclock` if Asterisk's headers are installed and
`mod_speakingclock` if FreeSWITCH's are. `make PBX="asterisk freeswitch"`
picks them yourself (with `ASTERISK_INCLUDE=` or `FS_INCLUDE=` for headers
somewhere else). Microsoft's and Apple's voice files are not in this
repository: `make` downloads them from the Internet Archive into
`sources/` (cabextract or 7z for Microsoft's, unar or unrar for the
PlainTalk voices). `FETCH=no` skips the download, `SYNTH=no` skips the
synthesisers, and `PREFIX=` and `DESTDIR=` work as usual. The pages for [Asterisk](asterisk.md),
[FreeSWITCH](freeswitch.md) and [live voices](live-voices.md) build one part at a
time.
+13
View File
@@ -0,0 +1,13 @@
# FreePBX
Do one of these procedures:
- Put `freepbx/speakingclock` into a tarball and install it with Module
Admin (upload).
- Copy `freepbx/speakingclock` to `/var/www/html/admin/modules/` and run
`fwconsole ma install speakingclock`.
The module must have app_speakingclock, installed as [Asterisk](asterisk.md) tells.
Then **Applications > Speaking Clock** lists your clocks. Each clock is a
destination for inbound routes, IVRs and time conditions. Each clock can
also have a number that extensions can dial.
+49
View File
@@ -0,0 +1,49 @@
# FreeSWITCH
```sh
cd freeswitch
make # needs FreeSWITCH's headers (libfreeswitch-dev, or a source install)
sudo make install # module, autoload_configs/speakingclock.conf.xml, voices into sounds/speaking-clock
fs_cli -x 'load mod_speakingclock'
```
To load the module at start, add `<load module="mod_speakingclock"/>` to
`autoload_configs/modules.conf.xml`. This is an example for the dialplan
([dialplan-example.xml](../freeswitch/dialplan-example.xml)):
```xml
<extension name="speakingclock_tim">
<condition field="destination_number" expression="^123$">
<action application="speakingclock" data="tim-pat-simmons t(Europe/London)"/>
</condition>
</extension>
```
`speakingclock [voice] [options]` accepts the same voices and options as
`SpeakingClock()` ([Asterisk](asterisk.md)) (`t(zone)`, `d(seconds)`, `h`, `p(seconds)`,
`s(a+b+c)`, `w`, `x`). Write the options after the voice, with a space.
With `x`, the channel variable `speakingclock_key` contains the key that
the caller pushed. The time zones are the time zones of FreeSWITCH, from
`timezones.conf.xml`. The live voices operate in the same way. Set
`tts_program_*` in
[speakingclock.conf.xml](../freeswitch/speakingclock.conf.xml).
The module sends the clock in 8 kHz signed linear frames. The frames
have the same length as the frames of the call. FreeSWITCH converts them
to the codec and rate of the call. The module calculates each frame from
the position of the clock against the system clock. Thus the time mark
comes on the second, for all codecs.
API (fs_cli):
- `speakingclock voices` lists the voices.
- `speakingclock render <voice> <unix time> <seconds> <file.sln> [zone]`
writes the audio that a caller hears, as 8 kHz signed linear.
- `speakingclock reload` (or `reloadxml`) reads the configuration and the
voices again.
`PBX=freeswitch test/render_test.py` runs the timing test on the module.
Without a PBX, `cd core && make` builds `sclock-render`. It does the same
as `speakingclock render`:
`./sclock-render -v ../voices tim-pat-simmons 1762791295 30 out.sln Europe/London`.
+33
View File
@@ -0,0 +1,33 @@
# Live voices
A voice with `mode=tts` has no clips. For each announcement, the module
runs a synthesiser on the Asterisk machine for the full sentence ("At the
third stroke, it will be four fifteen and twenty seconds."). It does this
a short time before the module must have the sentence. Thus the call
never waits for the synthesiser.
- The `live-dectalk-*` and `live-sam-*` voices run `say` of DECtalk and
`sam`.
- The `live-macintalk-*` voices (Fred, Ralph, Kathy, Zarvox and the other
15 MacInTalk 3 voices) and the `live-plaintalk-*` voices (Agnes, Bruce
and Victoria, standard and high quality) run
[synth/macintalk](../synth/macintalk). This is our own synthesiser, and it
reads the voice data of Apple. `cd synth/macintalk && make && make voices && sudo make install`
builds the synthesiser and downloads the data. The PlainTalk voices
also must have `unar` or `unrar` to unpack their disk image.
Set the locations of the programs in speakingclock.conf:
```
tts_program_dectalk=/opt/dectalk/say
tts_program_sam=/usr/local/bin/sam
tts_program_macintalk=/usr/local/bin/macintalk
```
The `live-mssam-*` voices (Microsoft Sam, Mike and Mary, and Mike and
Mary for telephone) run [synth/mssam](../synth/mssam). This is our own
synthesiser, and it reads the voice data of Microsoft.
`cd synth/mssam && make && make voices && sudo make install` builds the
synthesiser and downloads the data. Its setting is `tts_program_mssam`.
Refer to [docs/voice-format.md](voice-format.md#live-voices-modetts).
+25
View File
@@ -0,0 +1,25 @@
# Rebuilding the voices
```sh
tools/fetch-sources.sh sources # curl, git, unzip, 7z or innoextract
tools/build_voices.py sources voices # ffmpeg
```
The synthesiser voices come from `tools/synth_voices.py`. This tool
tells the synthesiser to speak each clip separately (a whole number,
"and twenty seconds", "At the third stroke, it will be"). Thus they are
`tim` voices that give the time to the second, and the module makes the
pips:
```sh
tools/synth_voices.py --list # the voices it knows
tools/synth_voices.py voices sapi4:microsoft-sam # SAPI4, via tetyys.com
DECTALK_SAY=~/dectalk/dist/say tools/synth_voices.py voices dectalk:paul
SAM=~/SAM/sam tools/synth_voices.py voices sam:sam
MSSAM=synth/mssam/mssam tools/synth_voices.py --live voices mssam:sam # live-mssam-sam
tools/synth_voices.py voices mac:Fred # MacInTalk, on a Mac
tools/synth_voices.py voices mac:Victoria # PlainTalk, on a Mac
tools/synth_voices.py voices macintalk:fred # MacInTalk 3, synth/macintalk
tools/synth_voices.py --live voices macintalk:zarvox # live-macintalk-zarvox
tools/synth_voices.py --live voices plaintalk:agnes # live-plaintalk-agnes
```
+15
View File
@@ -0,0 +1,15 @@
# How it keeps time
The old machines played one recording, and all callers listened to it.
The time mark (the third pip, or the tone) came exactly on the second
that the recording announced. Callers started to listen in the middle of
a sentence.
`SpeakingClock()` operates in the same way. The module aligns each
announcement to the system clock, sample by sample. Thus, keep the
system clock on NTP. The module checks the clock each second. If the
clock drifts by more than 20 ms, the module moves back to the clock. The
module does not put announcements in a queue with `Playback()`. Thus the
clock does not drift, for calls of all lengths. On a test call, the third
pip of Pat Simmons came less than 10 ms from the second.
mod_speakingclock does the same on FreeSWITCH.
+1 -1
View File
@@ -70,7 +70,7 @@ hours=12 ; or 24
- `tim`: `phrase+hour+minute+seconds+pips`, each 10 s
- `chime`: `quarter+strikes`, each 30 s
- `hourly`: `hourly`, each 10 s
- `tts`: `speech+pips`, each 10 s (refer to Live voices, below)
- `tts`: `speech+pips`, each 10 s (refer to [Live voices](#live-voices-modetts), below)
- **sequence** lists the items to say, joined by `+`. It can use the
words in the table above (`intro`, `its`, `greeting`, `phrase`, `hour`,
`minute`, `seconds`, `ampm`, `pips`, `quarter`, `strikes`, `hourly`,