Skip to main content

pyggwave

A fork of tiny data-over-sound library with improved documentation and Python compatibility.

# generate audio waveform for string "hello python"
waveform = pyggwave.encode("hello python")

# decode audio waveform
text = pyggwave.decode(instance, waveform)

Features

  • Audible and ultrasound transmissions available

  • Bandwidth of 8-16 bytes/s (depending on the transmission protocol)

  • Robust FSK modulation

  • Reed-Solomon based error correction

Installation

pip install pyggwave

API

encode()

encode(payload, [protocolId], [volume], [instance])

Encodes payload into an audio waveform.

Output of help(pyggwave.encode):

cython_function_or_method in module pyggwave

encode(self, payload: 'bytes | str', protocol: 'Protocol' = <Protocol.ULTRASOUND_FASTEST: 5>, volume: 'int' = 100) -> 'bytes'
    Encode payload into an audio waveform.
    @param {string} payload, the data to be encoded
    @return Generated audio waveform bytes representing 16-bit signed integer samples.

decode()

decode(instance, waveform)

Analyzes and decodes waveform into to try and obtain the original payload. A preallocated pyggwave instance is required.

Output of help(pyggwave.decode):

cython_function_or_method in module pyggwave

decode(self, frame: 'bytes') -> 'bytes | None'
    Analyze and decode audio waveform to obtain original payload
    @param {bytes} waveform, the audio waveform to decode
    @return The decoded payload if successful.

Usage

  • Encode and transmit data with sound:

import pyggwave
import pyaudio

p = pyaudio.PyAudio()

ggwave = pyggwave.GGWave()

# generate audio waveform for string "hello python"
waveform = ggwave.encode("hello python", protocol_id=3)

print("Transmitting text 'hello python' ...")
stream = p.open(format=pyaudio.paFloat32, channels=1, rate=48000, output=True, frames_per_buffer=4096)
stream.write(waveform, len(waveform) // 4)

ggwave.free()

stream.stop_stream()
stream.close()

p.terminate()
  • Capture and decode audio data:

import pyggwave
import pyaudio

p = pyaudio.PyAudio()

ggwave = pyggwave.GGWave()

stream = p.open(format=pyaudio.paFloat32, channels=1, rate=48000, input=True, frames_per_buffer=1024)

print('Listening ... Press Ctrl+C to stop')

try:
    while True:
        data = stream.read(1024, exception_on_overflow=False)
        res = ggwave.decode(data)

        if res:
            try:
                print('Received text: ' + res.decode("utf-8"))
            except as exc:
                print(exc)
except KeyboardInterrupt:
    pass

ggwave.free()

stream.stop_stream()
stream.close()

p.terminate()

More

Check out http://github.com/ggerganov/ggwave for more information about ggwave!

Development

Check out pyggwave python package on Github.

Metadata

Release files for pyggwave 0.4.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyggwave 0.4.2.7
File Size Uploaded Provenance Actions
pyggwave-0.4.2.7.tar.gz 157.7 kB Without provenance Details for pyggwave-0.4.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyggwave 0.4.2.7
File Interpreter ABI Platform Actions
pyggwave-0.4.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for pyggwave-0.4.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Total release size: 789.4 kB

Release files / pyggwave-0.4.2.7.tar.gz

Download URL pyggwave-0.4.2.7.tar.gz
Size 157.7 kB
Tags Source
SHA-256 checksum
How to use checksums
35e8689720386e39c9a737453374c7b376cab0302f1cd7028727799394e7736f
BLAKE2b-256 checksum
How to use checksums
a138092271226c549a8db6580f235357bda0306bbb481edb6c79da548009bb59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release files / pyggwave-0.4.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL pyggwave-0.4.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 631.7 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ba304305d7e497e570d5cd019ddcc7006eac086d34ef222e9a13021e47ba30c1
BLAKE2b-256 checksum
How to use checksums
52fb5eb30ff32b5442b8ab830fb347dc2ab3784d96aede7ec6d7e5b04418d394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Security for pyggwave 0.4.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.2.7 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page