正文 · AI 翻译
IT Home reported on November 23 that MacBook trackpads give users the sensation of a click because a haptic motor beneath the glass panel vibrates to simulate the feeling of a finger pressing down. A new open-source tool called nospeaker uses that motor to make the MacBook trackpad produce sound directly.
According to IT Home, the tool was developed by Cody Collier, whose developer account is os6, and the project is open source on GitHub. It runs from the command line and can play macOS system speech through the trackpad, convert text to spoken output, and play tones that gradually rise in pitch. It cannot, however, play music, YouTube videos, or other audio files.
The key to the tool is the speed at which the haptic motor vibrates. According to the project description, nospeaker can drive the motor at a frequency of up to 4000 times per second, making the glass panel vibrate rapidly and producing sound audible to the human ear.
Specifically, the tool first uses macOS’s built-in speech function to generate speech. It then analyzes the audio every 10 milliseconds, extracting information such as two formants, loudness, and pitch, before using the motor to turn that information into two tones for playback. Hissing speech sounds are converted into short, high-frequency tones.
Although the resulting sound has a distinctly robotic quality, it is surprisingly loud. Collier measured relatively strong sound output across a frequency range of about 100 Hz to 4 kHz, though there are clear gaps in output at some frequencies. Sound quality is clearest at around 1 kHz.
Simple tests on a MacBook also showed that sound from the trackpad is sufficient for it to serve as a temporary speaker. The developer also recommends muting the Mac and placing the computer on a desk during use to reduce additional noise.
However, the tool does not use Apple’s publicly available haptic feedback API. Apple’s public API provides only three fixed haptic feedback effects, so nospeaker instead uses the private MultitouchSupport framework. This also means future macOS updates could prevent the tool from working properly.
Collier said the tool does not drive the haptic motor beyond its maximum strength during normal operation.
In terms of hardware, any Mac equipped with a Force Touch trackpad should be able to run the tool, including MacBooks released in 2015 or later, as well as the Magic Trackpad 2 and newer models. For system requirements, Apple silicon Macs need macOS 12 or later, while Intel Macs need macOS 13 or later.
So far, Collier has tested the tool only on a MacBook Pro with an M5 Max chip. The project is licensed under the open-source MIT license and is free to use.