import { Suspense } from "react"; import SearchBar from "@/components/SearchBar"; import SongResult from "@/components/SongResult"; import { searchSongs as searchSongsDB } from "@/lib/db/client"; import { searchSongs as searchMB } from "@/lib/musicbrainz/client"; import { upsertSong } from "@/lib/db/client"; interface PageProps { searchParams: { q?: string }; } async function SearchResults({ q }: { q: string }) { // Try local DB first let songs = await searchSongsDB(q, 20); // If sparse results, hit MusicBrainz and cache locally if (songs.length < 3) { try { const mbResults = await searchMB(q, 20); for (const s of mbResults) { await upsertSong({ mbid: s.mbid, title: s.title, artist: s.artist, duration_seconds: s.duration_seconds, acousticbrainz_bpm: null, acousticbrainz_time_sig_num: null, source: "musicbrainz", }); } songs = await searchSongsDB(q, 20); } catch { // MusicBrainz unavailable — fall through with local results } } if (songs.length === 0) { return (

No results for “{q}”. Try a different search.

); } return ( ); } export default function HomePage({ searchParams }: PageProps) { const q = searchParams.q?.trim() ?? ""; return (

ClickTrack

Find a song, download a click track. Built for cover bands.

{q && ( Searching…

} >
)} {!q && (
Search
Search any song by title or artist. We pull metadata from MusicBrainz and cache it locally.
Tempo Map
Community-contributed CTP tempo maps define every section, time signature change, and tempo ramp in a song.
Download
Generate a 44.1 kHz WAV click track with accented downbeats — ready for your in-ear monitor mix.
)}
); }