Expose macOS say as an HTTP server that provides text-to-speech audio generation.
Project description
macos-say-server
Expose macOS say as an HTTP server that provides text-to-speech audio generation.
Features
GET /healthfor liveness checks.GET /voicesto list the voices available fromsay -v '?'.GET /cache/statsto inspect current cache usage and limits.GET /speak?text=...&voice=...to return AIFF audio directly.POST /speakwith JSON{ "text": "...", "voice": "..." }to return AIFF audio.- Disk-backed AIFF cache keyed by
text + voice, with lazy TTL cleanup.
Run
uv sync
uv run macos-say-server
The server binds to 127.0.0.1:2576 by default.
Use startup arguments to override bind settings:
uv run macos-say-server --host 127.0.0.1 --port 2576
You can also run the package module directly:
uv run python -m macos_say_server --host 127.0.0.1 --port 2576
Build
uv build
Cache
The service stores generated audio under .cache/audio by default.
- Cache key: hash of
text + voice - Expiration:
CACHE_TTL_SECONDS, default86400seconds - Cleanup: lazy cleanup during requests, at most once per
CACHE_CLEANUP_INTERVAL_SECONDS, default300seconds - On cache hit, the file timestamp is refreshed, so TTL is sliding rather than fixed from first generation
- Capacity control: optional LRU-style pruning using file modification time
- File count limit:
CACHE_MAX_FILES, default0meaning unlimited - Total size limit:
CACHE_MAX_BYTES, default0meaning unlimited
When a cache limit is configured, the oldest entries are removed first. Because cache hits refresh the file timestamp, frequently used items stay warm and cold items are evicted first.
GET /cache/stats returns:
cache_dirand whether it currently existstotal_filesandtotal_bytesexpired_filesunder the current TTL view- configured
ttl_seconds, cleanup interval, and capacity limits - oldest and newest cache entry timestamps
Startup arguments:
uv run macos-say-server \
--cache-dir .cache/audio \
--cache-ttl-seconds 86400 \
--cache-cleanup-interval-seconds 300 \
--cache-max-files 0 \
--cache-max-bytes 0
Examples
curl http://127.0.0.1:2576/health
curl http://127.0.0.1:2576/voices
curl http://127.0.0.1:2576/cache/stats
curl -G http://127.0.0.1:2576/speak --data-urlencode "text=hello from macos say server" --output speech.aiff
curl -i -G http://127.0.0.1:2576/speak --data-urlencode "text=hello from macos say server" --output speech.aiff
curl -X POST http://127.0.0.1:2576/speak \
-H "content-type: application/json" \
-d '{"text":"hello from json","voice":"Samantha"}' \
--output speech.aiff
If you inspect response headers, X-Cache: MISS means the file was newly synthesized, and X-Cache: HIT means it was served from cache.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file macos_say_server-0.1.0.tar.gz.
File metadata
- Download URL: macos_say_server-0.1.0.tar.gz
- Upload date:
- Size: 123.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fed8792c01ba45457a1d9a01de4e42ae4fcb599433bdd80a5bc5605f0dd5f1fc
|
|
| MD5 |
fe3bcbbe47f92ac42e150b4ab9477964
|
|
| BLAKE2b-256 |
b0544ce4961fee8e07df5d74a169061cae7a17731f09ad7c31622e190fb710b8
|
File details
Details for the file macos_say_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: macos_say_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88061233eb91f2502e853716d073dd8f283b1f5a9f6041511f3eae9fae95b0a7
|
|
| MD5 |
d318a3c895b5ee98585fd3571032679c
|
|
| BLAKE2b-256 |
abecd293f913dfac01f875f5d7546fd5ea498f7ce5c0001f12b1e762bf17c987
|