Trackpad Voice
A MacBook trackpad has no speaker, only a haptic motor that taps the glass. nospeaker makes it talk by playing a voice's two strongest resonances on that motor, restarted on every pitch beat.
This page runs the same pipeline on your speakers, with a model of the glass taken from the project's own measurements. Pick a line, press Trackpad, then change one knob at a time.
Five stages, one of them is the trick
macOS's own voice speaks the line into memory. Every 10 ms, linear prediction finds the formants, the loudness and the pitch. The motor's private API takes a list of sine tones with a frequency and a strength each, and nospeaker plays one such list per pitch period. Restarting the tones on every period is what turns two whistles into one buzzing voice. Toggle the restart above to hear it.
The glass, from the README: loudness over a quiet room for every semitone from 98 Hz to 3,951 Hz, measured with the MacBook's microphone. The bands show where F1, F2 and F3 usually sit for an adult voice.
“Two resonances beat three”
The README says two tones beat three in a blind test, “because the motor's strength is split fewer ways.” In my test the three rules tie in a quiet room; three tones sharing the motor's strength fall behind only as the room gets louder, and three tones with their own strength never do worse than two. The numbers, the method and what would make this wrong are in the note: Why a talking trackpad plays two notes, not three.
Blind test: which is clearer?
Each round plays one line two ways, two tones and three tones, both through the glass with a shared budget and the room noise set above. The order is random. Play both, pick the clearer one. After ten rounds the tally is revealed.