chirp_codec 0.1.0 copy "chirp_codec: ^0.1.0" to clipboard
chirp_codec: ^0.1.0 copied to clipboard

Near-ultrasonic FSK data-over-sound codec in pure Dart: encode a 16-bit payload as 4-FSK symbols in the 18–19.2 kHz band and decode it from raw mic PCM with Goertzel filters. No plugins, no FFI — work [...]

chirp_codec #

Near-ultrasonic data-over-sound for Dart & Flutter — no plugins, no FFI.

A 16-bit payload is encoded as 4-FSK symbols in the 18–19.2 kHz band: above most adult hearing, comfortably below the 22.05 kHz Nyquist limit of a 44.1 kHz mic capture, and within what phone speakers and microphones actually reproduce (unlike true >20 kHz ultrasound, which consumer hardware rolls off). Decoding runs Goertzel filters over raw PCM — cheap enough for real-time use on a phone.

Extracted from ParkerUp's sound check-in: a parking spot owner's phone chirps a random 4-hex code and the arriving driver's phone hears and decodes it — acoustic proof the two phones are physically within earshot.

What it's for #

  • Proximity verification — prove two devices are in the same room/street
  • Offline device pairing — share a short code with no network, no QR scan
  • Check-ins — kiosks, events, pickups: the counter chirps, the app hears

Usage #

import 'package:chirp_codec/chirp_codec.dart';

// Sender: 16-bit payload → WAV bytes for any audio player.
final payload = 0xC0DE;
final wav = ChirpCodec.encodeToWav(payload);

// Receiver: raw mic PCM → decoded payload (null until heard clearly).
final decoded = ChirpCodec.decode(pcmSamples, sampleRate: 44100);
if (decoded == payload) {
  // The devices heard each other.
}

The package is pure Dart (DSP math only). Speaker output and microphone capture stay in your app with whatever audio plugins you already use — ParkerUp pairs it with audioplayers (out) and record (in).

API names above are illustrative — see lib/chirp_codec.dart for the exact surface until 0.1.0 is published.

Status #

Pre-publication extraction (2026-07-17): code and unit tests are lifted verbatim from the production app. Before the pub.flutter-io.cn release: finalize the public API surface, add an example/, and wire CI.

License #

MIT

0
likes
140
points
29
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Near-ultrasonic FSK data-over-sound codec in pure Dart: encode a 16-bit payload as 4-FSK symbols in the 18–19.2 kHz band and decode it from raw mic PCM with Goertzel filters. No plugins, no FFI — works anywhere Dart runs. Extracted from the ParkerUp parking app's sound check-in feature.

Topics

#audio #ultrasonic #data-over-sound #fsk #proximity

License

MIT (license)

More

Packages that depend on chirp_codec