2026 年 11 月 9 日
我家有一个储物间,里面堆满了我们上次搬家后还没拆封的箱子。几周前,那个房间里有东西开始间歇性地发出哔哔声。哔声之间的间隔太长了,站在房间里试图找出噪音来源实在令人沮丧,而且我真的不想把那些箱子一个个翻个遍。所以我让 Claude Code 构建了Beep Locator,这是一个软件系统,利用散布在房间各处的多台设备来三角定位神秘哔声的来源。
这是 Beep Locator 运行一段时间后的样子:

你运行一个 Python Web 服务器来显示主界面,然后用二维码或 URL 连接尽可能多的设备作为监听器——我用了两台 iPad、一部手机、一台 MacBook Pro 和一台 Surface Ultra。
然后这些设备会互相播放声音,以帮助估算各自的位置。这个效果不太好,所以我加了一个“粗略模式”,你可以在空间里拖动它们的图标来提供大致位置,然后根据那些声音进行调整。
设置好之后,所有设备就都开始监听那声哔响了!
我还加了一个拍手模式,这样我就可以在房间不同位置拍手来测试它——在地图上显示为菱形。这让我更有信心它能够定位声音。
哔声会在地图上显示为 X,并在“已定位声音”日志中增加一行。你可以回放这些声音(依次从每台设备),以确认它们就是你正在寻找的神秘哔声,然后点击“这就是那个神秘哔声”将其标记。
一旦你确认了神秘哔声的频率,系统就会监听它,测量哔声之间的间隔,并利用三角定位的位置锁定地图上最可能的位置。
系统按预期工作。它把哔声的位置定位到大约 40 cm 以内,然后我翻遍了那堆特定的箱子,找到了一个古老的、急需更换电池的一氧化碳探测器。
工作原理
当我开始和 Claude 一起解决这个问题时,它很快就找出了BeepBeep:一种基于声学的高精度测距与定位系统,使用商用现成设备,这是 Chunyi Peng、Guobin Shen、Yongguang Zhang、Yanlin Li 和 Kun Tan 在 2007 年发表的一篇论文。以下是该论文的摘要:
我们介绍了 BeepBeep 的设计、实现与评估,这是一个基于声学的高精度测距系统。它在自发、自组织、设备到设备的场景中运行,不依赖任何预先规划的基础设施。它是一个纯软件方案,仅使用最基础的一套商用硬件——一个扬声器、一个麦克风以及某种形式的设备间通信——因此可以很容易地应用于许多低成本传感器平台,以及大多数商用现成移动设备,如手机和 PDA。它通过三种技术的结合实现高精度:双向感知、自录音和样本计数。
这听起来正是我们需要构建的东西!
Beep Locator 运行一个 Python Web 应用服务器,承担大部分工作。监听设备随后通过 WebSockets 连接到该服务器,并呈现一个请求浏览器麦克风访问权限的 UI。监听器主要通过录制最近 60 秒的音频缓冲区来工作。它们还运行一个简单的蜂鸣检测算法(见detector.js),该算法使用快速傅里叶变换和高通滤波器来识别潜在的蜂鸣声。它将这些事件发送到主服务器。
当有蜂鸣声被上报时,服务器会让一台设备播放一段短促的啁啾声(即与服务器往返时间最短的那台设备),然后要求每个监听器上传一段从蜂鸣声前约 0.6 秒到啁啾声后 0.8 秒的音频片段。这段啁啾声使各段音频能够相互对齐,这是定位蜂鸣声的关键一步。
我是如何构建它的
我通过 iPhone 使用 Claude Code Cloud 启动了这个项目,当时 Opus 5.5 运行在 Extra thinking effort 模式下。这里是那个共享的起始会话,它始于针对一个新建的空 GitHub 仓库给出的这段提示词:
Write out a problem.md file describing the problem we want to solve
There is a device beeping in a room and I cannot find it
I want to set up several devices - laptops, phones, iPads - around the room all listening at the same time and have them help triangulate where the beep comes from
There needs to be a Python web app which coordinates it all - one device shows a web page for the app, other devices join a URL which turns them into listeners - all via browser WebAudio and WebSockets back to the Python server app
Ideally I wouldn't need to manually input the relative locations of the devices - it would be amazing if they could play sounds to each other in order to locate each other in 2D space - is that even possible though?
这让我得到了这个 problem.md 文件。在撰写该文件的过程中,Claude 找到并阅读了 BeepBeep 论文,该论文在该文件中有所描述。
这项调研看起来不错,所以我告诉它:
Ok try and build it, add a mechanism so you can send new code to the listeners which they will then run automatically - that way I can set everything up in the room and then leave you alone to continue hacking and experiment while I do something else
这让我走到了这一步——系统的大部分已经搭建完成,但还没有任何东西真正尝试运行过它。
我把新的代码仓库克隆到我的笔记本电脑上,然后启动了 Claude Code……接着Fable 5.2 发布了,而这个项目似乎是一个绝佳的机会来对它进行一番考验。
我让笔记本电脑上的 Claude Code 启动服务器运行,然后确认它既能看见正在发生的事情并且还能在软件运行时对其进行实时修改。
这一点其实已经内置于软件之中:Opus 5.5 在监听器上构建了一个installModule()方法,可以通过 WebSocket 连接触发,这意味着管理服务器可以在其任意客户端上执行任意新代码。
在某些设备上,监听麦克风的网页每次重新加载时都会请求用户授权。热插拔模块机制意味着我们可以部署新代码,而无需逐一手动操作每个正在监听的设备。
从那时起,我的参与主要就是坐在笔记本电脑旁,和 Fable 5.2 聊正在发生的事情,偶尔请求一些新功能。以下是我运行过的一些功能提示:
I think we need to make it so I can drag things around on the map in “rough mode”, where my job is just to put them roughly where they are, then switch out of rough mode and it attempts to get them accurate
这让我能够在地图上拖动监听器。
what’s a good way for me to test this I wonder? Can we have it listen for claps, then I could clap and it could identify the location of the clap? [...]
Claps should use a different symbol on the map than beeps
这加上了这样一个功能:每当我拍手时,地图上会以一个不同于哔声的符号显示出来。
each symbol on the map should include a HH:MM:SS timestamp
这让分辨哪个符号可能对应哪种现实世界的声音变得更容易了。
The log should show beeps and claps with their timestamps AND have a little play button which, when clicked, replays the recorded noise from each of the listeners in sequence (with clear text on screen showing which listener recorded which snippet) while temporarily turning off microphone recording while that replay plays
现在我可以重放声音了,这让辨认哪段录音片段是我在寻找的那个神秘哔声变得容易得多。
There should be a button next to a recording for “This is the mystery beep” - then I can hit replay to see and then confirm it was the mystery beep if that’s the one I am looking for
Then the system can categorize noises in the future to see if they are likely that same mysterious beep and use that information to build a more accurate idea of where it is
到这一步我已经很接近了——我对哔声的来源有了可靠的判断,但如果我能把监听器重新布置在那个点周围,以获得更精细的定位,岂不是更好?
I want a feature for this, I don’t want to have to restart each listening device etc, I want to be able to click a “Reposition the devices” button which lets me switch into repositioning, then I click “Repositioned” and it puts me into Rough mode and asks me to roughly locate them, then I do that and click, then it starts up again. The previous session can be read-only viewed through the app.
而且由于我还有一个备用设备,于是我说:
add a feature where the map includes a spot that is a suggestion for a location that it would be useful to add a listener at - based on data collected so far
给 Claude Code 装上耳朵
我认为这个项目最有趣的地方在于,我证明了这是可能的:给 Claude Code 装上耳朵。
Claude 没有原生音频输入(目前还没有),但它可以运行 JavaScript 和 Python 代码,来分析麦克风采集到的音频。
我让它运行一个带有 WebSocket 连接的 Web 服务器,连接多个监听设备,然后让它在这些设备上运行 WebAudio 麦克风,并把它们连接起来,以便可以通过该 WebSocket 向它们发送新的 JavaScript 代码来执行。
然后我基本上就可以让 Claude 自己折腾了,让它不断攻克问题、查询音频日志,并重新配置它的“耳朵”来帮助它解决问题。
这让我想起几周前在 GitHub Universe 上听说的一个类似的 hack,当时Martin Woodward告诉我他一直在调试GitHub Universe Badge 计算机的方法是通过 USB-C 把它们插到一台电脑上,然后用网络摄像头对准它们的屏幕,这样他的编程智能体就能判断更新是否正常工作。
想办法让编程智能体感知周围的世界,是一件非常有趣的事。