IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

2025/tompng - Most soothing

Synthetic seashore

Author:

Award: Most soothing

To build:

    make all

To use:

To generate sound.wav:

    ./prog duration seed filename

To play the sound immediately, for example:

    # using sox sound player
    ./prog - | sox --buffer 1024 -t s16 -r 48000 -c 1 - -d 2>/dev/null

    # using ffplay sound player
    ./prog - | ffplay

    # using aplay sound player
    ./prog - | aplay

Or use your favorite sound player able to read the input from stdin.

Try:

    ./try.sh

Judges’ remarks:

This entry provided a welcome relief after several grueling judging sessions. See what the C seas, si?

A fun challenge

Explain the purpose of the constant .5, used several times in prog.c. How does changing .5 to a different value affect the generated sound?

The above fun challenge is still open. See the “Fun challenge Info” section for details.

Author’s remarks:

Synthetic Seashore

Close your eyes. You are sitting by the ocean. Nearby, someone is playing quiet music — the kind that makes you forget you had anywhere else to be. The waves agree. The silence agrees. You agree.

Don’t open your eyes. Once you do, you’ll see something you can’t unsee, and you’ll know that the beach was arithmetic, the music was probability, and the peace you felt was born from layers upon layers of the same forgetting, until the forgetting became a shore. And yet, all of it felt real. The sea, for its part, does not know it doesn’t exist.

Description

This program generates a 5-minute stereo WAV file of ocean ambiance: layered wave sounds combined with procedurally generated music: slow, resonant notes that settle into the sound of water as if they were always there. Each run produces a unique result.

Usage
    ./prog duration seed filename

Implementation Notes

The sound of ocean waves is, at its core, the sound of countless overlapping bubbles. This program begins with a single bubble and repeatedly synthesizes pairs of sounds — layering them again and again — until millions of bubbles accumulate into a wave. The same synthesis operation drives every level of this hierarchy.

A single filter function, distinguished only by its arguments, handles everything from bubble resonance and bandpass noise shaping to stereo envelope tracking and musical dynamics. The layers of sound and the layers of reuse converge on the same principle. This is, perhaps, how the world is also made.

Inventory for 2025/tompng

Primary files

Secondary files


 Jump to: top