Kinetic UI
Back to Introduction
Interactive

Generative Audio Button

A button that synthesizes satisfying physical sound effects in real-time using the Web Audio API.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add generative-audio-btn
Generative Audio Button

Generative Audio UI

Click these buttons to hear physical sound effects synthesized entirely in the browser using the Web Audio API. Turn on your volume!

Installation

npx kinetic-ui-cli@latest add generative-audio-btn

How It Works

Most UI is completely silent, or relies on .mp3 files which bloat bundle sizes and can have latency issues. This component leverages the browser's native AudioContext API to generate waveforms (sine, sawtooth) mathematically in real-time. By connecting an Oscillator Node to a Gain Node (for volume enveloping) and modulating the frequency across a few milliseconds, we can synthesize crisp, high-tech physical haptic sounds exactly when the pointer presses down and lifts up.

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { GenerativeAudioBtn } from "@/components/creative/generative-audio-btn";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { GenerativeAudioBtn } from "@/components/creative/generative-audio-btn";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <GenerativeAudioBtn
        soundType{/* value */}
      >
        <div>Content goes here</div>
      </GenerativeAudioBtn>
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.