Git Product home page Git Product logo

pied-piper's Introduction

Pied Piper

Transfer data between any two devices using nothing but a speaker and a microphone (i.e. data transfer over sound waves).

Built during the VeloCity Residence Hacknight for Spring 2015 by Ronuk Raval and Kartik Talwar.

Demo

Watch the video on YouTube.

How it works

The flow of data is unidirectional, going from a client (a tone generator over a speaker) to a server (which is sampling a microphone). To transfer data, the client encodes bits as single frequency sine waves emitted for a fixed amount of time. The sine waves are then captured by the server, isolated, decoded, error corrected, and finally the original data is reconstructed.

The following parameters must be agreed upon by both the server and client ahead of time:

  • The sampling interval: the duration of time which a single tone is held for. Empirical testing indicates that 100ms is reliable enough but 50ms runs into problems.

  • Chunk size: the number of bits each tone represents. We use 4 for reliable transmission and 8 works most of the time.

  • Handshake start frequency: indicates the start of a chunk sequence. 8192 Hz for now.

  • Handshake end frequency: no more chunks follow. 8704 Hz for now.

  • Transmission start and step frequency: specify the frequency that should be generated for a given number. The full formula is:

    freq = start + (i * step)
    

    For 4 bit chunks (reliable comms), start = 1024 Hz and step = 256 Hz. For 8 bit chunks, start = 1024 Hz and step = 16 Hz. These values essentially ensure that any data frequency lies below the handshake spectrum:

    (start + (2 ^ chunk_bits - 1) * step) < 8192
    
  • Reed Solomon error bytes for forward error correction. Currently 4 bytes.

For a client to transmit data:

  • Compute the Reed Solomon encoding for its payload.

  • Emit the handshake start frequency

  • Split its payload into bit size chunks of the right size. Convert and emit the frequencies corresponding to those chunks.

  • Emit the handshake end frequency.

The server analyzes intervals half the size of the one the client uses (i.e. twice as many times). This eliminates issues caused by the temporal phase shift between the client generating tones and the server listening for them. For each half interval:

  • Compute the FFT and find the dominant frequency.

  • If its the handshake start, start collecting frequency data.

  • If its handshake end, stop collecting frequency data and decode:

    • Throw away every alternate frequency found (twice as many samples!)

    • Filter away frequencies not in the right range

    • Convert remaining frequencies into their representative bit chunks, combining that into a byte stream.

    • Validate and correct byte stream with Reed Solomon

Performance

The current best and reasonably reliable parameters involve 8 bits per tone and 10 tones per second. This translates to 10 bytes per second.

The data transfer itself is mostly unaffected by background human chatter.

Further Work

  • It should be quite possible to transmit multiple frequencies per tone instead of just one. The server would then look to decompose that many frequencies instead of just the most dominant one.

    This could easily double or quadruple throughput. Some work has been done on the multifreq branch but we ran out of time for the hackathon.

  • Experiment to find the range of frequencies that can reliably be transmitted and recorded. A wider range means more chunk bits, which directly impacts throughput.

  • Reed Solomon error correction may not be the ideal one to use here. Investigate alternatives that might provide better performance.

  • The Reed Solomon libraries only support combined payload + error byte sizes of 255 bytes. Larger payloads would need to be chunked across several error corrected packets, which requires client and server support for it.

pied-piper's People

Contributors

kartiktalwar avatar rraval avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pied-piper's Issues

How to decode on android device?

Hi , I was wondering if this project has capabilities to decode data form recording on android device.
How do I approach that?

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.