How s-macke/sam works
SAM is a compact C text-to-speech synthesizer. The user supplies text or phonemes and voice options; text is converted to phonemes, then SAM parses and adjusts phoneme timing before rendering speech samples. The result is played through SDL or written as a WAV file. The README documents these stages, while sampled code confirms the command-line entry point, output choices, and renderer’s formant-frame preparation. Some internal calls and the precise text-to-phoneme wiring are not visible in the excerpts, so those links are documented rather than inferred from imports alone.
Main entry points: main.c CLI and options · render.c Speech renderer · sam.c Phoneme parsing · reciter.c Text reciter
Components 16
Input conversion
- CLI and options
src/main.c - Text reciter
src/reciter.c - Reciter rules
src/ReciterTabs.h
Speech synthesis
- Phoneme parsing
src/sam.c - Phoneme tables
src/SamTabs.h - Phoneme adjustment
src/sam.c - Output preparation
src/sam.c - Speech renderer
src/render.c - Render tables
src/RenderTabs.h - Debug reporting
src/debug.c
Output delivery
- Sample buffer
src/render.c - WAV writer
src/main.c - SDL playback
src/main.c - WAV file
- Audio device
Other components
- Text or phonemes
Connections 20
- Text or phonemes → CLI and options: provides input
README.md - CLI and options → Text reciter: converts text
README.md - Reciter rules → Text reciter: supplies rules
src/reciter.c - Text reciter → Phoneme parsing: produces phonemes
README.md - CLI and options → Phoneme parsing: sets input; starts
src/main.c - Phoneme tables → Phoneme parsing: supplies tables
src/sam.c - Phoneme parsing → Phoneme adjustment: builds phoneme tables
README.md - Phoneme adjustment → Output preparation: prepares output tables
README.md - Output preparation → Speech renderer: renders speech
README.md - Render tables → Speech renderer: supplies synthesis data
src/render.c - CLI and options → Speech renderer: configures voice
README.md - CLI and options → Debug reporting: enables diagnostics
README.md - Speech renderer → Debug reporting: reports output data
src/debug.c - Speech renderer → Sample buffer: generates samples
README.md - CLI and options → WAV writer: writes WAV
src/main.c - Sample buffer → WAV writer: provides samples
src/main.c - WAV writer → WAV file: writes audio
src/main.c - CLI and options → SDL playback: plays audio
src/main.c - Sample buffer → SDL playback: provides samples
src/main.c - SDL playback → Audio device: plays through
src/main.c