SkillAgentSearch skills...

AudioNetwork

Data transmission over sound waves written in JavaScript without any dependencies. All you need is just microphone, speakers and the browser!

Install / Use

/learn @robertrypula/AudioNetwork

README

Audio Network

npm version Build Status Coverage Status dependencies Status devDependencies Status

Data transmission over sound waves written in <strike>JavaScript</strike>TypeScript. All you need is just microphone, speakers and the browser!

News

  • 2018 May 11 - PR#4 was merged with master. Important: migration process from ES5 to TypeScript is still NOT finished. It will just continue on the master branch.

  • 2018 May 10 - Thanks to Programista magazine, all 3 parts of my articles about data transmission over sound in JavaScript are now available as PDFs. Please find links in the next section.

  • 2018 Feb 06 - Project looks like dead but it's not. Now I'm focusing on configuration that allows me to move entire AudioNetwork project to TypeScript, WebPack, Jest unit test with coverge, Travis etc.

Self-made network stack based on Frequency-Shift Keying (>= v1.2.0)

Audio Network library is a hobby project in which the goal was to create simple network stack that uses sound waves to transmit data. Initialy it was using PSK modulation technique which was later changed into FSK.

Brief introduction to the topic is available as presentation hosted on slides.com here.

If you are interested in details you can read more in polish Programista magazine:

Part 1 Part 2 Part 3

Part 3 of the article was the last one. It means that more focus will go to this website and Audio Network releases. If you can't wait please go trought some of the examples:

Full list of examples is available here:

Full example list

Note: some of the modules are not yet in main NPM package. Please verify roadmap.

This library is supported by PGS Software - the place where I work as Frontend Developer

Deprecated Phase-Shift Keying approach (last update at v1.1.0, will be removed at v2.0.0)

Initial versions of this lib were based on Phase-Shift Keying modulation technique. Unfortunatelly after some tests in turned out that this implementation was not working reliable on mobile devices. Starting from v1.2.0 this part of the lib will be marked as deprecated.

!!! IMPORTANT NOTE !!! - Everything described below (up to Licence) might be outdated or not working properly. Project is now in a phase of big technical changes. Entire v1.x was created mostly to learn DSP and share this knowledge in the 'Programista' magazine articles. Version 2.x will have more stable and simpler API and will be better consumable as npm package.

If you want to try AudioNetwork by yourself I would recommend to first open Demo - simple because Demo - full features might be little scary for the first time. You can also watch YouTube video that shows how to transmit data over sound between two laptops:

Data transmission over sound waves (AudioNetwork)

How can I transmit something over sound?

First of all you need to have two devices. One for sending, one for receiving data. It should work with any device (PC, Mac, tablet, smartphone) with browser that supports Web Audio API. Next you need to open Demo - simple at both devices and follow steps below:

  1. [Receiver] - Before you load demo page you need to be quiet :) Receiving device needs to listen to 'silence' around you when there is no signal in the air. It's indicated by IDLE_INIT state and it ends when FIRST_SYNC_WAIT state will come. If you fell that your silence wasn't good enough you can always use RESET button to start again.

  2. [Transmitter] - All you need to do is to click on SYNC button.

  3. [Receiver] - When SYNC transmission is in progress state should change to FIRST_SYNC. After about 2 seconds it should switch to IDLE. At this point we are ready to send some data!

  4. [Transmitter] - Now you can put some data to textarea and click on Send packet button. After short moment your data will appear on the receiver's side.

By default PSK-2 modulation is used so you can use only symbols 0 and 1 but it's enough to send data bit by bit. For example to send ASCII a character (0x61) you need to put inside textarea 0 1 1 0 0 0 0 1. Please remember to always put one space between each symbol but whole text needs to be without trailing and leading spaces.

If at any point you will see FATAL_ERROR state you need to click on RESET button and start all points again.

AudioNetwork needs raw microphone output without any filter applied. You can verify that by opening Sound settings in your operating system. When you enter your microphone properties you might need to un-check all filters. The worst scenario is when your microphone has some hardware filter that you can't disable. In this case you need to throw it away and buy a new one ;)

How to add sound transmission to my project?

Audio Network is available at GitHub and npm so you can just run one of the commands below:

git clone https://github.com/robertrypula/AudioNetwork.git
cd AudioNetwork
npm install
gulp serve

or

npm install audio-network

In both cases at build directory you will find minified and unminified js file with whole library. Pick one and include it into your HTML file. For example:

<script src="node_modules/audio-network/build/audio-network-v1.3.2.min.js"></script>

Now you can access AudioNetwork object at global JavaScript scope. It's the entry point for all components:

var physicalLayer, transmitAdapter, receiveAdapter;

physicalLayer = new AudioNetwork.PhysicalLayer.PhysicalLayer({
    // config
});
transmitAdapter = new AudioNetwork.PhysicalLayerAdapter.TransmitAdapter(physicalLayer);
receiveAdapter = new AudioNetwork.Physical

Related Skills

View on GitHub
GitHub Stars212
CategoryDevelopment
Updated6mo ago
Forks28

Languages

JavaScript

Security Score

92/100

Audited on Sep 5, 2025

No findings