webaudio-serial-tx
transmit serial data over webaudio in the browser
example
var serial = ;var port = ;port;portstart;
api
var serial = ;
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 useopts.baud
- the number of bits per second of framed data to transmitopts.autosuspend
- automatically suspend the audio playback at the end of the data queue to save cpu and battery life. default: trueopts.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