Back to Blog

Encode Heart: Hide Messages Inside Your Pulse

Encode Heart: Hide Messages Inside Your Pulse

What if your heartbeat could carry a secret message? That's the idea behind Heart Codec — a project that hides text inside the subtle skin-color changes caused by your pulse.

The Inspiration

I stumbled on a post on Hacker News about remote photoplethysmography (rPPG) — the technique of extracting cardiac signals from video by analyzing tiny pixel variations on your skin. It clicked immediately: if you can read a signal from pixels, you can write one too.

How It Works

The system runs entirely in the browser, built with Next.js. Four steps:

  1. Record — Film your face for a few seconds using your webcam
  2. Detect — The rPPG algorithm extracts the cardiac signal from the pixels
  3. Encode — A secret message is modulated into the pulse frequency using amplitude modulation
  4. Decode — The message is recovered through spectral analysis (FFT) of the video

The encoding uses two carrier frequencies — 5 Hz and 8 Hz — to represent bits. The injected signal amplitude is only ~10/255, making it completely invisible to the naked eye. The video looks unchanged.

The Stack

  • Next.js for the app and the landing page
  • WebRTC for webcam capture
  • Canvas API for pixel-level manipulation
  • FFT (Fast Fourier Transform) for spectral decoding
  • No backend — everything runs client-side

Try It

The project is live at heart.famat.me — you can encode and decode messages right in your browser. The full source code is on GitHub.

⚠️ This is an experimental project — a fun proof-of-concept at the intersection of signal processing, computer vision, and steganography. Do not use for real encryption.

Hide something meaningful in your next heartbeat.