Skip to main content

Compress data into WAV files

Project description

WavComp — Compress data into WAV files.

WavComp is a Python library that takes arbitrary data (text or binary) and stores it inside a standard WAV audio file. The output sounds like white noise and can be used for compression or covert transfer.

Features

  • Compress text or binary data into a WAV file
  • Optional zlib/bz2/lzma compression presets
  • Optional password encryption
  • Split large files into numbered WAV volumes (cover.001.wav, cover.002.wav, ...)
  • Recover data exactly via encode / decode interface

Installation

pip install wavcomp

Quick Start

from wavcomp import WavComp

wc = WavComp()

# Compress data into a WAV byte stream
with open("plain.txt", "rb") as f:
    data = f.read()
wav_bytes = wc.encode(data)

with open("cover.wav", "wb") as f:
    f.write(wav_bytes)

# Recover the original data
with open("cover.wav", "rb") as f:
    recovered = wc.decode(f.read())

assert recovered == data

Command Line

# Single WAV output
wavcomp encode secret.txt cover.wav -p mypass
wavcomp decode cover.wav recovered.txt -p mypass

# Split into multiple WAV volumes, 1 MB each
wavcomp encode large.bin cover -k 1M -p mypass
wavcomp decode cover recovered.bin -p mypass

Chunk size suffixes: K, M, G (e.g. -k 10K, -k 5M, -k 1G).

Compression Presets

WavComp(compression="fast")   # zlib level 1, fastest
WavComp(compression="normal") # zlib level 6
WavComp(compression="best")   # zlib level 9, default
WavComp(compression="ultra")  # lzma, best ratio but slower
WavComp(compression=5)        # custom zlib level 0-9

Split Output

When -k is used on the command line, each chunk is written to its own WAV file. This is useful for splitting large payloads into smaller files.

wavcomp encode large.bin cover -k 1M
# creates cover.001.wav, cover.002.wav, ...

Python API:

wc = WavComp(chunk_size=1024 * 1024)
paths = wc.encode_split(data, "cover")
recovered = wc.decode_files(paths)

Notes

  • Designed for file-to-file transfer. The output WAV sounds like noise.
  • Encryption uses a fixed salt, suitable for general use only.
  • Modulation parameters must match between encode and decode.

License

MIT

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

wavcomp-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

wavcomp-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file wavcomp-0.1.0.tar.gz.

File metadata

  • Download URL: wavcomp-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for wavcomp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7887891cc2801c04a4947d7c4094478693da35a0966e2dca32bff6808e8a9f93
MD5 29d923ad4d5fde00d88708f4ac1f0eb0
BLAKE2b-256 febc593a53b6e994255a83e3ad52ef63f3c86d831dcd863c7058fb811946602e

See more details on using hashes here.

File details

Details for the file wavcomp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wavcomp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for wavcomp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36c82265d83606d7839536191b54b5eae91e3d050fc4a421c2cc362dc58a4661
MD5 d7547139d09d008e0a99d70f52e411cd
BLAKE2b-256 d3c7e88ffccf7d8825300eefc739879c3a69460e5329b3cdd6a386ac3db6025d

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