I'll start by exploring the project structure.
The project uses a single-file build, so I'll synthesize all audio procedurally with the Web Audio API — that guarantees crystal-clear, gapless, infinitely-loopable sound with zero downloads. Let me start with the DSP core and audio engine.
Now the audio engine with all the sound generators:
Now the curated sound library with the science behind each:
Now the shared UI primitives, visualizer, and styles:
Now the sound card component and the main app:
Now the main application:
Now updating the HTML shell with mobile-optimized meta tags:
Build succeeded. Now a few audio-quality refinements:
For a sleep app, background/lock-screen behavior matters. Let me add a media-session keep-alive layer:
The build is clean. Let me verify the final structure of the app files:
Lull — a mobile-first sound therapy studio is built and building cleanly.
Why the audio is genuinely high quality
Instead of shipping compressed loops (which hiss, click at loop points, and eat bandwidth), every sound is synthesised live with the Web Audio API at your device's native sample rate:
dsp.ts — proper noise generators: Paul Kellet's 7-pole pink filter, a leaky-integrator brown noise with a DC blocker, and stereo-decorrelated channels for a wide, non-fatiguing image. Each buffer gets an equal-power tail→head crossfade, so loops are mathematically seamless — it can run all night with zero artefacts.
engine.ts — 11 generator types built from filters, LFOs and scheduled grains: multi-band rainfall, ocean swell modulated at ~0.05 Hz (breathing rate), wind, bubbling stream, campfire with randomised crackle bursts, fan/cabin drones, binaural beats (hard-panned dual oscillators), click-free isochronic gating via a waveshaped pulse curve, harmonic drones and bell-partial chimes. Master chain: sub-sonic DC cut → user volume → timer fade bus → gentle limiter, so dense mixes never clip.
Features
- 25 sounds across Sleep / Focus / Calm / Nature / Noise / Brainwaves — each with an "i" button explaining the research behind it (pink noise & slow-wave memory, 40 Hz gamma/MIT GENUS, natural-sound autonomic studies, etc.).
- Unlimited layering + mixer — per-sound volume sliders on the cards and in a mixer sheet, plus master volume.
- Sleep timer — Off/5–120 min, live countdown ring around the play button, selectable gentle fade-out (10s–2min) so it never jolts you awake, plus +5 min and cancel.
- 8 evidence-based presets (Deep Sleep, Power Nap, Deep Work, Study Flow, Rainy Night…) and save your own mixes.
- Mobile-ready: 100dvh layout, safe-area insets, thumb-reachable bottom bar, bottom sheets, screen Wake Lock, media-session lock-screen controls, silent keep-alive element, auto-resume on tab focus, and localStorage persistence.
- Live spectrum visualiser, 🎧 badges on binaural tracks, and a "How to use" guide with safe-volume guidance.
Files built: src/audio/dsp.ts, src/audio/engine.ts, src/data/library.ts, src/index.css, src/components/ui.tsx, src/components/Visualizer.tsx, src/components/SoundCard.tsx, src/App.tsx, index.html, src/audio/keepalive.ts