transmit serial data over webaudio in the browser
JavaScript HTML
Latest commit 99b8acd Jul 14, 2015 @substack writeup link, neocities
Permalink
Failed to load latest commit information.
example auto-suspend now actually kicks in Jul 8, 2015
LICENSE pkg Jul 4, 2015
index.js detect resume/suspend Jul 9, 2015
package.json 1.2.1 Jul 9, 2015
readme.markdown writeup link, neocities Jul 14, 2015

readme.markdown

webaudio-serial-tx

transmit serial data over webaudio in the browser

view a demo

serial over webaudio writeup

example

var serial = require('webaudio-serial-tx');
var port = serial({ baud: 9600 });

port.write(new Buffer(5000).fill('wow'));
port.start();

api

var serial = require('webaudio-serial-tx');

var port = serial(opts)

Create a new writable stream port that will play UART framed serial data through the system speakers using webaudio.

  • opts.context - the audio context to use
  • opts.baud - the number of bits per second of framed data to transmit
  • opts.autosuspend - automatically suspend the audio playback at the end of the data queue to save cpu and battery life. default: true
  • opts.polarity - the polarity: 'ttl' (-1) or 'rs232' (+1).

For microcontroller serial ports and arduinos set opts.polarity to 'tty'.

For rs232 cables, set opts.polarity to 'rs232'.

You might need to flip the polarity if you have a custom circuit.

port.write(buf)

Pack buf and send over the wire.

port.start()

Start the audio playback.

port.stop()

Stop the audio playback.

port.flush()

Discard all previously written data.

install

With npm do:

npm install webaudio-serial-tx

license

MIT