ggwave-napi
v0.0.3
Published
Tiny data-over-sound library
Downloads
152
Maintainers
Readme
ggwave-napi (Node.js native addon)
This is a fork of the original ggwave library. GGreganov is responsible for all of this work. I simple slapped a slightly different node wrapper around it.
Tiny data-over-sound library exposed as a native Node.js C++ addon.
- Audible and ultrasound transmissions available
- Bandwidth of 8-16 bytes/s (depending on the transmission protocol)
- Robust FSK modulation
- Reed-Solomon based error correction
Build
npm installThis compiles addon.cpp + src/ggwave.cpp through node-gyp.
Example Usage
import factory from 'ggwave';
const ggwave = await factory();
const parameters = ggwave.getDefaultParameters();
parameters.operatingMode |= ggwave.GGWAVE_OPERATING_MODE_USE_DSS;
const instance = ggwave.init(parameters);
const payload = 'hello js';
// Generate waveform bytes for "hello js"
const waveform = ggwave.encode(
instance,
payload,
ggwave.ProtocolId.GGWAVE_PROTOCOL_AUDIBLE_FAST,
10
);
// Decode waveform bytes back to payload
const decoded = ggwave.decode(instance, waveform).toString('utf8');
ggwave.free(instance);
if (decoded !== payload) {
process.exit(1);
}