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/decodeinterface
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7887891cc2801c04a4947d7c4094478693da35a0966e2dca32bff6808e8a9f93
|
|
| MD5 |
29d923ad4d5fde00d88708f4ac1f0eb0
|
|
| BLAKE2b-256 |
febc593a53b6e994255a83e3ad52ef63f3c86d831dcd863c7058fb811946602e
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36c82265d83606d7839536191b54b5eae91e3d050fc4a421c2cc362dc58a4661
|
|
| MD5 |
d7547139d09d008e0a99d70f52e411cd
|
|
| BLAKE2b-256 |
d3c7e88ffccf7d8825300eefc739879c3a69460e5329b3cdd6a386ac3db6025d
|