clickable.

The click sound this site makes, synthesized from four milliseconds of filtered noise, with a little jitter so no two presses sound the same.

web audio / sound / interaction

Loading component...

live component, try it

what to expect.

Press the pad a few times and listen
The ticks below show each press's frequency
Respects the site's sound toggle

how it works.

Every press on this site is four milliseconds of white noise through a narrow bandpass filter, which is what a mechanical click acoustically is. Synthesizing it costs no network bytes and lets each kind of interaction pick its own timbre from one primitive instead of shipping a sprite sheet of near-identical samples. The detail that matters is the jitter. Without it, every press is bit for bit the same and the ear catches the repetition by the third, because no real mechanism ever makes exactly the same sound twice. The ticks under the pad plot where the last few presses landed, so the jitter is visible with the sound off.

take it with you.

Three steps, and the stage above runs in your own project.

  1. Install

    Nothing to add. It runs on React alone, 18 or newer.

  2. Copy the files

    3 files, kept together in one folder, clickable/. The styles travel with them.

    "use client";
    
    import { useState } from "react";
    import { haptic, playBurst } from "./feedback";
    import "./clickable.css";
    
    interface Props {
      // hz the noise is filtered around: higher reads as a tick, lower as a thock
      frequency?: number;
      // how narrow the filter is: higher rings more like a tone
      q?: number;
      gain?: number;
      // samples the noise takes to die away
      decay?: number;
      // random detune per press, as a share of frequency; 0 makes every press identical
      spread?: number;
    }
    
    const SAMPLES = 192;
    const HISTORY = 8;
    const AXIS = 0.25;
    const MID = 20;
    
    function envelope(gain: number, decay: number): string {
      const top: string[] = [];
      const bottom: string[] = [];
      for (let x = 0; x <= 100; x += 1) {
        const a = 18 * gain * Math.exp(-((x / 100) * SAMPLES) / decay);
        top.push(`${x},${(MID - a).toFixed(2)}`);
        bottom.push(`${x},${(MID + a).toFixed(2)}`);
      }
      return `M${top.join(" L")} L${bottom.reverse().join(" L")} Z`;
    }
    
    export default function ClickTuner({
      frequency = 2600,
      q = 7,
      gain = 0.35,
      decay = 30,
      spread = 0.3,
    }: Props) {
      const [hits, setHits] = useState<number[]>([]);
    
      const press = () => {
        const centre = frequency * (1 + (Math.random() - 0.5) * spread);
        playBurst({ frequency: centre, q, gain, decay }, 0);
        haptic("click");
        setHits((prev) => [...prev, centre].slice(-HISTORY));
      };
    
      return (
        <div className="click-lab">
          <figure className="click-lab-envelope">
            <svg viewBox="0 0 100 40" preserveAspectRatio="none" aria-hidden="true">
              <path d={envelope(gain, decay)} />
            </svg>
            <figcaption>4ms of noise, shaped</figcaption>
          </figure>
    
          <button
            type="button"
            className="click-lab-pad"
            onPointerDown={press}
            onKeyDown={(e) => {
              if (e.key === " " || e.key === "Enter") {
                e.preventDefault();
                press();
              }
            }}
          >
            press
          </button>
    
          <figure className="click-lab-scatter">
            <div className="click-lab-axis">
              {hits.map((hz, i) => (
                <span
                  key={`${i}-${hz}`}
                  style={{ left: `${(50 + ((hz / frequency - 1) / AXIS) * 50).toFixed(2)}%` }}
                  data-fresh={String(i === hits.length - 1)}
                />
              ))}
            </div>
            <figcaption>
              {hits.length === 0
                ? "where the last presses landed"
                : `${hits.length} press${hits.length === 1 ? "" : "es"}, ${Math.round(hits[hits.length - 1]!)}hz`}
            </figcaption>
          </figure>
        </div>
      );
    }
  3. Use it

    The stage above, exactly as it runs here. The comments mark what to change.

    "use client";
    
    import ClickTuner from "./clickable/ClickTuner";
    
    // the tuner plays one burst per press so you can hear each setting;
    // in your own buttons, call feedback("tick" | "click" | "close" | "confirm") from ./clickable/feedback
    export default function ClickableExample() {
      return <ClickTuner frequency={2600} q={7} gain={0.35} decay={30} spread={0.3} />;
    }

© 2026 Made with ❤️ by Ashwin S Nambiar

Check out v1, v3.