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

@best30

Nospeaker ─ Make your MacBook's trackpad talk using its haptic motor github.com · 178 points · 90 comments · HN thread

TL;DR Nospeaker is a macOS command-line tool by Cody Collier that drives the MacBook trackpad's haptic motor through Apple's private MultitouchSupport framework so it produces audible speech and music, with the Mac's speakers muted. It turns macOS voice output into two formant tones per 10 ms frame, and the author reports the motor is loud and clean roughly from 100 Hz to 4 kHz. The repo ships a one-line curl installer, a notarized download and build-from-source instructions.

  • The trackpad's haptic motor is driven up to about 4,000 times a second, enough to produce audible sound, with no speaker involved.
  • The private MultitouchSupport function MTActuationCreateFromDictionary accepts a list of sine tones with frequency, strength and length; Apple's public haptics API offers only three fixed taps.
  • Measured with the MacBook's own microphone, the motor is loud from about 100 Hz to 4 kHz, with its cleanest notes near 1 kHz; a few frequencies are dead spots.
  • Speech is produced by taking macOS's voice output, extracting two formants, loudness and pitch every 10 ms with linear prediction, and playing the formants as tones; the author says two formants were clearer and louder than three in a blind test.
  • Requires a Force Touch trackpad (MacBooks from 2015 on, or Magic Trackpad 2) and macOS 12 or 13 or later; tested only on an M5 Max MacBook Pro running macOS 27.2.1.
  • The author says it never exceeds the motor's normal maximum strength, and warns that the private API could break with a macOS update.

Discussion The thread mixes admiration for the hack with a long side conversation about Apple's haptic trackpad itself. Many commenters are delighted and share retro examples of making hardware sing: the Commodore 1541 floppy drive stepper motor, the PC speaker, ZX Spectrum music and HP scanner easter eggs. A second strand debates the trackpad, with some praising its consistency and others saying clicks fail for them or that it feels odd when the Mac is off. Security and safety come up briefly, along with the decision to pipe curl into sh and worries about motor wear. The mood is playful and appreciative, with some jokes and few hostile replies.

  • Delighted by the hack and reuse of existing hardware (most): Many commenters find it cool and fun, calling it one of the best hacker projects seen recently. They compare it to retro tricks like floppy drive music and PC speaker tunes.
  • Apple's haptic trackpad is impressively convincing (many): Several commenters say the illusion of a physical click on a fixed glass slab is remarkable and better than other laptop trackpads. Some note the Mac's trackpad even seems to click when the machine is off.
  • Haptics are underused by Apple (some): Some wish Apple used the haptic engine for more feedback such as scrolling, zooming and snapping, and point to Force Touch, now dropped from iPhones but kept on trackpads and Apple Watch.
  • Trackpad clicks are unreliable in practice (a few): A few commenters find Apple's trackpad hard to use, with missed clicks, awkward drag and drop, and a haptic click that feels inconsistent, especially with dry or cold hands.
  • Concerns about security, safety and curl-to-shell (a few): Some ask whether a motor that can act as a microphone is a security risk, whether repeated driving will wear the motor out, and whether piping curl to sh from a website is reckless. Replies say the motor has no ADC and the code can be read first.

Links from the comments

#macOS #haptics #hardware #audio #retroComputing #trackpad