Skip to main content

SONNET: Sound Network Negotiated Encoding Transmitter - Audio data transmission over sound

Project description

SONNET - Sound Network Negotiated Encoding Transmitter

SONNET is a Python library for encoding and decoding data through audio signals. It uses frequency-shift keying (FSK) to transmit digital data through sound waves, making it suitable for air-gapped data transfer or creative audio applications.

Features

  • Encode text data into audio signals
  • Real-time audio signal decoding
  • Multiple encoding modes (1, 2, or 3 bits per beep)
  • Signal quality monitoring
  • CRC32 checksum verification
  • Automatic mode detection
  • Transmission rate monitoring

Installation

pip install sonnet-audio

Quick Start

Encoding Text to Audio

from sonnet import text_to_sound

# Encode text file to audio
text_to_sound("input.txt", "output.wav", mode="3bpb")

Decoding Realtime Audio

from sonnet import SonnetDecoder
import pyaudio
import numpy as np

# Initialize decoder
decoder = SonnetDecoder()

# Set up PyAudio for input
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paFloat32,
                channels=1,
                rate=44100,
                input=True,
                frames_per_buffer=512)

try:
    while True:
        # Read audio chunk
        data = stream.read(512)
        audio_data = np.frombuffer(data, dtype=np.float32)
        
        # Process the chunk
        result = decoder.process_chunk(audio_data)
        
        if result:
            if result['type'] == 'bits':
                print(f"Bits: {result['value']} ({result['quality']:.2f})")
            elif result['type'] == 'marker':
                print(f"Marker: {result['value']}")
finally:
    stream.stop_stream()
    stream.close()
    p.terminate()

Advanced Usage

See the examples directory for more detailed usage examples.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sonnet_audio-1.0a1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sonnet_audio-1.0a1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file sonnet_audio-1.0a1.tar.gz.

File metadata

  • Download URL: sonnet_audio-1.0a1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for sonnet_audio-1.0a1.tar.gz
Algorithm Hash digest
SHA256 ee8320cc7cfafa85d48849ca8fcab47de7d8e172a5d1c8a66e4b7f73ab6c7070
MD5 36d2858104ccb6a708dc29908fe8dd88
BLAKE2b-256 1b58e81ec956733acb72bbb09a5c34e20cdd92be2bddcf10f4c8721ee2f8d105

See more details on using hashes here.

File details

Details for the file sonnet_audio-1.0a1-py3-none-any.whl.

File metadata

  • Download URL: sonnet_audio-1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for sonnet_audio-1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae21713912a2e70a1c613b773eb3587e2866f7ec56c9ca17c8d93e06e2c3e551
MD5 edc9fcc605fcda0a13a2a86ca55a32e5
BLAKE2b-256 fda2b587f8b0b04ae6e76c695560833892ce4627fd1ad582dff7064bb7a932de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page