Giter Club home page Giter Club logo

audio-barcode's Introduction

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

audio-barcode's People

Contributors

uniphil avatar unrud avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

manniru

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.