Skip to content

Unrud/audio-barcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audio Barcode

Send and receive small data packets over sound. The packets have a size of 50 bits and transmitting one packet takes ~1.7 seconds.

Based on the protocol described in "Chirp technology: an introduction". It's not compatible with the Chirp protocol. The parameters for error correction are not published in the article.

Usage

Add this to your Cargo.toml:

[dependencies]
audio-barcode = { git = "https://github.com/Unrud/audio-barcode" }

Then you can do something like:

use audio_barcode::Transceiver;

// Init
const SAMPLE_RATE: u32 = 44100;
let mut transceiver = Transceiver::new(SAMPLE_RATE);

// Receive
loop {
    let sample: f32 = ...;
    if let Some(payload) = transceiver.push_sample(sample) {
        println!("Received: {:?}", payload);
    }
}

// Transmit
let payload = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
for &frequency in transceiver.send(&payload).iter() {
    for &sample in transceiver.generate_beep(frequency).iter() {
        // Play sample
    }
}

Examples

A browser based demo is available at https://unrud.github.io/audio-barcode. The source code can be found in examples/web.

License

MIT (see LICENSE)

Thirdparty libraries

About

Send and receive small data packets over sound

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages