aifollow.news
返回 IT之家 科技新闻
IT之家 科技新闻· · 原发布时间 AI 评分41

开发者推出 nospeaker,让 Mac 触控板播放系统语音

AI 辅助摘要

开发者科迪 · 科利尔开源了命令行工具 nospeaker,用 Force Touch 触控板的触觉马达播放 macOS 文字转语音。它不能播放音乐或其他音频文件;项目目前只在一台 M5 Max MacBook Pro 上测试,且依赖可能随系统更新失效的私有框架。

正文 · 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.

发现内容有误?提交纠错