mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-02-07 09:18:01 +08:00
* Initial version ready - bindings are in `bindings/emscripten.cpp` - minimal Javascript example is in `examples/ggwave-js` * add npm package + add test-ggwave.js * js : rename export name to "ggwave_factory" * update to v0.1.5 * Update README.md * npm : add npm-publish target
17 lines
392 B
Python
Executable File
17 lines
392 B
Python
Executable File
import sys
|
|
import ggwave
|
|
|
|
# create ggwave instance with default parameters
|
|
instance = ggwave.init()
|
|
|
|
payload = 'hello python'
|
|
|
|
# generate audio waveform for string "hello python"
|
|
waveform = ggwave.encode(payload, txProtocolId = 1, volume = 20, instance = instance)
|
|
|
|
# decode the audio waveform back to text
|
|
res = ggwave.decode(instance, waveform)
|
|
|
|
if res != payload.encode():
|
|
sys.exit(1)
|