Overview
SoundText renders individual characters as interactive elements: hovering over each letter triggers a unique sine-wave tone generated via the Web Audio API, mapped to a pentatonic scale for a melodic effect. The character jumps, scales up, and glows purple in sync with the sound.
Installation
Requires
framer-motion as a peer dependency.Usage
Props
The text content to display. Each non-space character becomes an independent interactive letter.
The root frequency in Hz for the pentatonic scale. Each character’s pitch is derived by multiplying this value by a scale ratio based on its index position. Higher values produce higher-pitched tones.
Additional Tailwind or CSS classes applied to the wrapper element. Use to control font size, color, and layout.
Examples
Default usage
Lower pitch, bass tones
Higher pitch, bright tones
Features
Web Audio API
Uses native browser audio synthesis — no audio files or external libraries required.
Pentatonic Scale
Each character maps to a harmonious frequency in a pentatonic scale, creating pleasant melodic interactions.
Spring Animations
Characters bounce upward, scale, and glow purple on hover using Framer Motion spring physics.
Lazy Audio Init
The
AudioContext is created on first user interaction, ensuring compliance with browser autoplay policies.