← Mon, Nov 23 digest

Nospeaker ─ Make your MacBook's trackpad talk using its haptic motor

read article ↗ hn thread ↗

Nospeaker is a command-line tool written in Swift that uses undocumented macOS APIs to drive a MacBook trackpad's haptic motor at audible frequencies, turning the glass surface into a makeshift speaker.

summary is enough The README is lightweight and straightforward, making a quick skim sufficient to understand the low-level mechanism.

summary

Nospeaker utilizes the private MultitouchSupport framework on macOS to control a MacBook trackpad's haptic actuator at frequencies up to 4,000 Hz. By extracting formants and pitch from macOS speech synthesis every 10 milliseconds, it drives the trackpad glass to produce intelligible robotic speech without external speakers. The single-file Swift implementation operates within safe motor strength limits to prevent driver stalling. Commenters heavily praise the project while drawing nostalgia-laden parallels to playing music on floppy drive stepper motors and PC internal speakers.

key points

  1. Drives the trackpad haptic motor at frequencies between 100 Hz and 4 kHz, leveraging glass resonance around 1 kHz for voice clarity.
  2. Uses undocumented MultitouchSupport framework functions like MTActuationCreateFromDictionary to play custom sine tone lists.
  3. Converts speech into formant frequencies and pitch every 10 ms, bypassing Apple's public haptic API which is restricted to three fixed taps.

who should read it

Mac developers and low-level hardware hackers interested in undocumented APIs and creative hardware repurposing.

discussion warm

consensus

Commenters are thoroughly entertained by the project, comparing it to classic hardware hacks like playing music on floppy drive stepper motors and game controller haptics.

pushback

Several users worry that sustained high-frequency driving might damage the haptic motor, though one user reported it accidentally fixed their weak haptic feedback.

best comment by RossBencina ↗

Interesting that Apple's API uses a sum-of-sines representation for controlling the motor. I wonder whether this is to avoid accidentally burning the motor out, to make it easier to compensate the actuator dynamics using simple feed-forward per-partial amplitude and phase correction, or to provide a low-bandwidth encoding that can be sent across USB/HID efficiently. Maybe all of the above?

It would be interesting to see what the USB stream looks like when running Nospeaker on a Magic Trackpad 2.

It analyzes why Apple's API might use a sum-of-sines representation for motor control, considering thermal limits and efficient HID encoding.

Generated by an LLM from the article and thread. Check the sources before relying on it.