[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116252":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":13,"stars7d":15,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":23,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":14,"starSnapshotCount":14,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},116252,"beep-locator","simonw\u002Fbeep-locator","simonw","Locate annoying beeps","",null,"Python",70,1,0,15,3,51.9,"Apache License 2.0",false,"main",true,[],"2026-11-10 04:40:06","2026-11-23 15:54:07","# beep-locator\n\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202.0-blue.svg)](https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fbeep-locator\u002Fblob\u002Fmain\u002FLICENSE)\n\nFor background on this project, see [Locating the source of a mysterious beep with Claude](https:\u002F\u002Fsimonwillison.net\u002F2026\u002FNov\u002F9\u002Fmysterious-beeps\u002F).\n\n*The rest of this README was written by Claude.*\n\nLocate annoying beeps. Laptops, phones and tablets around a room become a\nmicrophone array: they find each other by playing chirps (two-way acoustic\nranging, see [problem.md](problem.md)), then work out where a mystery beep\ncame from using time-difference-of-arrival.\n\nEverything runs in the browser (WebAudio + WebSockets) against a Python\nserver. Code running on the listeners can be replaced remotely without\nreloading their pages, so experiments can continue after the devices are set\nup.\n\n## Running it\n\nYou need [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) and, to give phones the https they\nneed for microphone access, [cloudflared](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fcloudflare-one\u002Fconnections\u002Fconnect-networks\u002Fdownloads\u002F)\n(`brew install cloudflared`).\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fbeep-locator\ncd beep-locator\nuv run beep-locator serve --tunnel\n```\n\nIt prints:\n\n- a **coordinator URL** (contains the admin token - open it on your laptop)\n- a **join URL** plus a QR code: open it on each phone\u002Ftablet and tap\n  *Start listening*\n- `BEEP_URL=... BEEP_TOKEN=...` for driving it from elsewhere; locally,\n  `uv run beep-locator ctl ...` finds the server and token automatically\n\nThen:\n\n1. Put 3 or more listeners around the room (volume up, silent mode off, no\n   Bluetooth speakers, plugged in, screen left on with the page in front).\n   The coordinator laptop can join too: *Also listen on this device*.\n2. Press **Calibrate**. Each device chirps in turn; the map shows where they\n   are. Use rotate\u002Fflip to match the map to the room (distances can't tell a\n   room from its mirror image).\n3. **Test beep** makes one device play a fake beep, which should be located\n   on top of that device - a quick accuracy check.\n4. Leave **Listen for beeps** on. When a beep is heard, one device plays a\n   short sync chirp, every device uploads the audio around it, and the\n   estimate appears on the map. More beeps sharpen the shaded region.\n\n`\u002Fsim` runs a simulated room (fake listeners hearing a virtual beeper) for\ntesting without hardware: `\u002Fsim?n=5&every=10&bx=3&by=2`.\n\n## Remote hacking\n\nWith `--auto-update` the server polls `origin` for new commits on its branch,\nfast-forwards and restarts itself; listener pages reconnect automatically and\nkeep their audio running. Leave it off if you don't want code from the branch\nrunning on your machine without review.\n\nIndependently of that, JavaScript can be sent straight to the browsers:\n\n```bash\nexport BEEP_URL=https:\u002F\u002F....trycloudflare.com BEEP_TOKEN=...\nuv run beep-locator ctl state                      # devices, levels, layout\nuv run beep-locator ctl eval 'return rt.info()' --to Red\nuv run beep-locator ctl push listener myexp exp.js  # install a module everywhere\nuv run beep-locator ctl unpush listener myexp\nuv run beep-locator ctl run selftest               # does each device hear itself?\nuv run beep-locator ctl run calibrate\nuv run beep-locator ctl run testbeep device=Blue\nuv run beep-locator ctl results                    # calibrations and beep estimates\nuv run beep-locator ctl clips \u002F clip 42 -o x.wav  # recorded audio\nuv run beep-locator ctl events --follow           # logs, detections, errors\nuv run beep-locator ctl settings '{\"detector\": {\"threshold_db\": 10}}'\nuv run beep-locator ctl sql 'select topic, count(*) from events group by topic'\nuv run beep-locator ctl update                     # git pull + restart now\n```\n\nA module is an ES module whose default export receives a context object:\n\n```js\nexport default function setup(ctx) {\n  ctx.onAudio((frame, samples) => { \u002F* every mic chunk, with its frame number *\u002F });\n  ctx.method(\"myexp.hello\", (args) => ({ hi: ctx.deviceName }));  \u002F\u002F callable via ctl rpc\n  ctx.send(\"my_topic\", { some: \"data\" });  \u002F\u002F stored as an event on the server\n  ctx.ui.textContent = \"shown on the device's page\";\n  return { teardown() {} };  \u002F\u002F optional; timers\u002Fhandlers registered via ctx are cleaned up automatically\n}\n```\n\nModules on disk in `beep_locator\u002Fmodules\u002F{listener,coordinator}\u002F` are the\ndefaults (the coordinator UI is itself a module). Pushed modules override\nthem. If a pushed version fails to load, devices keep running the previous one\nand report the error.\n\n## How it works\n\n- `beep_locator\u002Fstatic\u002Fruntime.js`: the stable part of every page. Owns\n  the AudioContext, a 60 second ring buffer of microphone audio indexed by\n  AudioContext frame number (each device's own clock), the WebSocket, RPC and\n  the module loader.\n- `beep_locator\u002Fhub.py`: connections, RPC, module distribution, a rough\n  (tens of ms) server-time to device-frame mapping from ping\u002Fpong, used only to\n  know where to look in recordings.\n- `beep_locator\u002Fprocedures.py`: calibration (devices chirp in turn, upload\n  recordings), locating (sync chirp right after a beep, upload, solve) and\n  test beeps.\n- `beep_locator\u002Fanalysis.py` + `dsp.py`: matched-filter chirp detection with\n  first-arrival logic, BeepBeep two-way ranging (only intervals within one\n  device's recording are used, so clock offsets and audio latencies cancel),\n  MDS + SMACOF layout with outlier rejection, onset detection, TDOA grid search\n  + Gauss-Newton.\n- `beep_locator\u002Fsim.py` and `static\u002Fsim-io.js`: simulated rooms with random\n  sample rates, clock drift, latencies and a reflection, used by the tests.\n\nData (SQLite database, WAV clips, token) lives in `beep-data\u002F`.\n\n## Tests\n\n```bash\nuv run pytest\n```\n","beep-locator 是一个基于分布式麦克风阵列的声源定位工具，用于精确定位房间内突发性蜂鸣声（如设备报警、硬件故障提示音）的物理位置。它利用多台联网设备（笔记本、手机、平板）作为同步监听节点，通过双向声学测距（chirp-based TDOA）完成设备自校准与空间建模，并结合时间差到达算法实时估算声源坐标；全部前端逻辑运行在浏览器中（WebAudio + WebSockets），后端为轻量 Python 服务。适用于IT运维排查异常告警、实验室设备故障定位、智能家居异响诊断等需要快速识别声源空间位置的物理环境场景。",2,"2026-11-24 04:53:18","CREATED_QUERY"]