Repo of the Day
quiet/quiet-js
Published: Jun 8, 2022
Open repository ↗Dev.to post about using it to send a payment link via stripe
Summary
quiet-js is a JavaScript library that sends and receives data through a computer's sound card using the Web Audio API. It is a browser binding for the libquiet library, with support for both near-ultrasonic speaker transmission (around 19 kHz, "essentially imperceptible to people") and faster cable-based transfer over a 3.5 mm audio jack.
What it is useful for
Engineers can use quiet-js when they need a data channel between two devices that do not have a conventional network, Bluetooth, or other link. The ultrasonic profile makes it possible to broadcast small payloads — for example URLs, pairing tokens, or short configuration strings — from a laptop or phone speaker to a nearby microphone without most people noticing. The cable profiles run at "at least 40 kbps," enough for moderate-sized files when you can plug two devices together with an audio cable. Because it runs in the browser, it is also useful for prototypes and demos that demonstrate audio-based device communication without custom hardware or native code.
How engineers can use it
The README documents a specific script loading order that must be followed because the bindings must be present before the compiled emscripten module runs:
<script type="text/javascript" src="quiet.js"></script>
<script type="text/javascript" src="your_project.js"></script>
<script async type="text/javascript" src="quiet-emscripten.js"></script>
The emscripten module also needs its quiet-emscripten.js.mem memory initializer, which the README says is loaded automatically. For convolutional or Reed-Solomon error correction, the README strongly recommends also including libfec.js (npm install libfec); without it, profiles that depend on those codes will not work. A working ultrasonic text sender and receiver lives in the repository's examples/text directory, and full API docs are linked from the README.
A few documented constraints shape where quiet-js will actually work. Chrome receivers require HTTPS because Chrome blocks microphone access without TLS. Firefox receivers are limited to audible profiles — its WebAudio implementation "resamples audio input to 32kHz" and adds distortion, so the ultrasonic profile "cannot be used for Firefox receivers." Safari is transmit-only because it does not support getUserMedia. Internet Explorer is not supported at all. The project is BSD-3-Clause, but any build that uses libfec must also satisfy libfec's LGPL terms, which the README notes is the user's responsibility.