Git Product home page Git Product logo

beepfiletransfer's Introduction

BeepFileTransfer

This tool allows you to transmit files between two devices relying EXCLUSIVELY on the sound, speaker to microphone. Therefore the two devices can work both offline, regardless of the platform and the hardware configuration, as long as the sender device has working speakers, and the receiver a working microphone
Preconiditions:

  • Sender has a working speaker
  • Receiver has a working microphone
  • The two devices are pretty close (but not completely attached each other), so that the sound can be properly detected by the receiver for the data processing
Recommendations:
  • The distance between the two devices is pretty close
  • The room / place where the two device are located is the most silent possible
  • The two devices are fixed while the transmission is ongoning (better not to cause noise while running, in order to avoid unexpected data transmission which may corrupt the file)
How to use:
  • The Receiver device starts the session from "Receive file"
  • The Receiver device presses on "Start receiving" and allows the microphone permission asked by the browser
  • The Sender device starts the session from "Send file" and picks the file which is intended to be transmitted to the Receiver device
  • The Sender device presses directly on "Start sending"
How does it work:
  • The entire tool relies on the natively provided Web Audio API
  • It generates beep sounds (Sender) and analyzes and determines the frequency of that sound (Receiver)
  • We define a sound frequency spectre and we quantize it to be able to represent all the values of a single hexadecimal number (0x0 -> 0xF)
  • Each quantum is a frequency range representing a single value in hexadecimal
  • The list below represent the mapping of the hex value and the representing frequency range:
    • Each Byte (0x00 -> 0xFF) in the file stream, is locally split in two parts. This allows us to represent the each part with a dedicated beep. Therefore, each Byte is "logically" represented by two beeps. In order to help the Receiver audio analysis, we place a "separator" beep between the two part and one after the second part. As final result, each Byte is actually represented by 4 beeps
    • The Sender start with a "separator" beep to awake/normalize the Receiver microphone, and also to inform you that the transmission is about to start.
    • After the initial beep it will start sending the sequence of beeps to build up the meta info object (as json string). Those meta info are file name, file size, file type
    • Once the meta info beep sequence is sent, it will perform another "separator" beep, which indicates that the actual file transmission in beeps, is about to start
    • The Receiver, who hopefully managed to receive and detect a valid json sequence of caracter, will parse it and receive file name, file type and file size. The file size will be used to determine the end of the file transmission on the Receiver side
    • The file data transmission (Byte after Byte till the end) will run by performing the beeps, until the end of the file. As you can imagine, this process is overall pretty long, and error prone, given the nature of the solution adopted (sounds) to transmit information from Sender to Receiver
    • Once the Receiver gets the last expected Byte, it will wrap it up and download it on the disk
    Extra notes:
    • The configuration adopted at the moment is the one that fit my tests, with the lowest error rate. Fell free to play around by changing the common parameters, check the "Common parameters" checkbox in the main screen.
      IMPORTANT: If you change any of the params, make sure they match on both Sender and Receiver devices!
    • The "Separator frequency" MUST NOT fall in the range of the min/max frequencies, including the resulting delta range unit
    • If you use an iPhone as Sender device, make sure that the phone is not in Silent mode in order to successfully perform the beeps sounds
    Dependencies:
    • This tool is written using Vanilla Javascript, HTML and CSS, with NO third party libraries

    beepfiletransfer's People

    Contributors

    lucaiaco avatar

    Watchers

     avatar

    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.