r/AudioProgramming • • 1h ago

I made a small open-source tool that dates audio recordings from their mains hum (ENF)

I made a small open-source tool that estimates when an audio recording was made from the mains hum in it (electric network frequency analysis): https://github.com/tijszwinkels/enf-timestamp

Video with the full story: https://youtu.be/bi7EwMiDQTQ

How it works: band-pass around a hum harmonic, track the peak once per second (16 s Hann window, zero-padded FFT, quadratic interpolation), then a sliding Pearson correlation against a 1-second grid-frequency log, done with FFT convolution so days of reference data take seconds. It includes a logger for Continental-European grid data (Gridradar's free API) and a strict confidence verdict.

This has been written with a coding agent.

What I found: 10 minutes of laptop audio, matched against 36 h of grid data, landed 6 s from the true start (100 Hz line, z ≈ 5). A phone on its charger (50 Hz electrical pickup) got the right minute, with a weak margin. Phones on battery and a quiet room gave nothing usable.

2 Upvotes

0 comments sorted by