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
Release files for wavcomp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wavcomp-0.1.0.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wavcomp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.0 kB
Release files / wavcomp-0.1.0.tar.gz
| Download URL | wavcomp-0.1.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7887891cc2801c04a4947d7c4094478693da35a0966e2dca32bff6808e8a9f93
|
|
BLAKE2b-256 checksum How to use checksums |
febc593a53b6e994255a83e3ad52ef63f3c86d831dcd863c7058fb811946602e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / wavcomp-0.1.0-py3-none-any.whl
| Download URL | wavcomp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36c82265d83606d7839536191b54b5eae91e3d050fc4a421c2cc362dc58a4661
|
|
BLAKE2b-256 checksum How to use checksums |
d3c7e88ffccf7d8825300eefc739879c3a69460e5329b3cdd6a386ac3db6025d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|