Hide secret messages inside music using LSB encoding - invisible to ears, readable by code.
Drop a WAV file here
or click to browse
A melody is synthesised using the Web Audio API. Each note is a sine wave at a specific frequency. The audio is rendered into a flat array of 16-bit PCM integers: one number per sample, 44,100 samples per second.
Each character in the secret message is
converted to its ASCII code, then to 8 binary
digits. "H" → 72 → 01001000. The
full message becomes a long string of 0s and 1s.
The first 32 audio samples store the message length in binary. This tells the decoder exactly how many bits to read. Without this, the decoder wouldn't know where the message ends.
For each bit of the message, take one audio
sample and force its last bit to match. If the
bit is 1: sample | 1.
If 0: sample & ~1.
This changes the sample by at most 1 unit out of
32,767 which is completely inaudible.
The modified samples are packed into a WAV file (uncompressed). WAV preserves every sample exactly, unlike MP3, which would destroy the LSB data during lossy compression.
Load the WAV, read the first 32 sample LSBs to get message length, then read that many LSBs from subsequent samples. Group into 8-bit chunks, convert each to ASCII, and reconstruct the original text.