3 ms·
Ah yes, off-by-one errors when filling a PCM buffer can be loud. Speaking from experience, it’s similarly loud when you accidentally fill an integer PCM buffer
by layoutIfNeeded 5y ago
Ah yes, off-by-one errors when filling a PCM buffer can be loud. Speaking from experience, it’s similarly loud when you accidentally fill an integer PCM buffer with floating point data.
My story: I physically broke an indoor bike trainer by writing a mobile app.
I was fed up with the rent-seeking subscription-based app that the vendor provided for the machine, and wanted to write a simple app to be able to change the training parameters over Bluetooth. It worked via a standard BLE fitness machine protocol, so I’ve spent a few hours creating a prototype iOS app for interacting with it via the CoreBluetooth framework, based on the free docs from Bluetooth.org.
Everything worked wonderfully, up until the point of adding a slider to the UI for changing the “hardness” parameter of the current session. You see, changing the hardness parameter adjusted an electromagnetic braking mechanism inside the machine, and the slider I’ve put on the UI was set to its “continuous” mode, which meant that it was generating a steady stream of change events while dragging, basically at the framerate of the phone (60 fps). The designers of the machine probably didn’t anticipate that someone would be flooding it with 60 “set hardness” commands per second, and the actuator doing the adjustment simply broke from the overload after a few seconds of me dragging the slider…
I’m not sure exactly which part broke, but there was a loud crack from inside, and the braking power could no longer be adjusted at all. I could have disassembled the machine, but it wasn’t even mine (it was lent to me by my brother-in-law to try it out), and was still under warranty, so I gave it back and told that it spontaneously broke :^)