mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-02-06 16:47:59 +08:00
- by default ggwave will now output 32-bit float samples - python samples no longer use numpy - python test now decodes payload - fix buffer overflow in receive.py example
16 lines
343 B
Python
Executable File
16 lines
343 B
Python
Executable File
import sys
|
|
import ggwave
|
|
|
|
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)
|