Turntable Pro
One payment, every Pro piece. $9 tomorrow.
Install
npx shadcn@latest add @mu-pro/turntablePro. Installs with your licence key through the @mu-pro registry; the key comes with Pro. Lands in components/mu/turntable/ with the shared foundation.
Usage
import { Turntable } from "@/components/mu/turntable/Turntable";
<Turntable
tracks={[
{ title: "Opening", artist: "Your Band", duration: 201, cover: "/labels/opening.webp", src: ["/audio/opening.m4a", "/audio/opening.mp3"] },
{ title: "Second", artist: "Your Band", duration: 187, src: "/audio/second.mp3" },
]}
/>
// controlled: Start asks and you decide; the player moves `track` itself (next, previous, a track's end)
// and tells you, so keep what it tells you
const [playing, setPlaying] = useState(false);
const [track, setTrack] = useState(0);
<Turntable tracks={tracks} playing={playing} onPlayingChange={setPlaying} track={track} onTrackChange={setTrack} />Use with an agent Beta
npx shadcn@latest add @mu-pro/uisdk/turntableOptional. An AI agent in your app can read and set this piece by name, and you can ask before anything it can’t undo. The piece itself doesn’t change; installs with your Pro key, like the piece. Built on UI SDK 0.1.0-beta.23, which is in beta too, so this add-on follows its releases.
Source
How it works
Building with an agent? Hand it a ready prompt for this piece.
Input and reduced motion
- Pointer / touch: Start, Stop and Cue; grab the tonearm and drag it across the record to seek; drag along the progress line (a 44px target); drag the pitch fader from where it is (it clicks into 0).
- Keyboard: every control is in tab order. Space plays and pauses from any part of the player but a button (where Space presses it); ← and → seek 5 seconds (Shift: 15) from any control but the pitch; N and P drop the next and previous record. The progress line is a range that says "0:41 of 2:41"; the pitch is a vertical slider (↑ ↓ 0.5%, Shift 2%, Page Up and Down 2%, Home and End the ends) that says "+2.5%". A polite status says what is playing, paused (with the time) or stopped.
- Reduced motion: the same result without the travel: the record doesn't turn, the arm is placed instead of swung and lowered, the label and title change at once, and the stylus doesn't sparkle. A drag still tracks. The music plays, pauses and seeks the same.
- Off-screen: the platter and the clock pause while the player is out of view.
Props
| Prop | Default | What it does |
|---|---|---|
tracks | two silent demo records | TurntableTrack[]: { title, artist?, duration, cover?, src? }; [] is an empty state (a bare platter, "No record", Start and Cue disabled, data-empty). src is a URL or a list in order of preference (["/a.m4a", "/a.mp3"]): it starts with the first this browser says it can play and tries the next if that one fails. Without src the platter keeps the time silently; without cover the label is plain printed paper |
track, defaultTrack, onTrackChange | 0 | the record on the platter, by index: controlled with track, or where it starts. onTrackChange gets the new index on next, previous and the end of a track |
playing, defaultPlaying, onPlayingChange | false | controlled with playing, or whether it starts playing (a track without src only: audio never starts without a press). onPlayingChange is called by Start, Cue, Stop, Space, a hand on the arm, an error and the end of the last track |
time, defaultTime, onTimeChange | 0 | the playhead in seconds, like a media element's currentTime: a new time seeks there (the arm glides). onTimeChange is called on every seek and as the shown second changes while it plays, so time={t} onTimeChange={setT} stays in step without a render a frame. A defaultTime above 0 starts with the arm over the record, cued |
pitch, defaultPitch, onPitchChange | 0 | pitch in percent, −8 to 8, controlled with pitch |
onTrackEnd | — | (index) => void: a record played to its end |
onMedia | — | (audio \ | null) => void: the <audio> once the first press makes it, and null on unmount; route it into the equaliser or a visualiser |
preservesPitch | false | the music follows the platter by default (it bends up as the platter spins up, and with the pitch fader), as on a deck; true keeps the pitch, for speech |
loop | false | at its end a track plays again; false drops the next record, and after the last the arm goes home |
labels | English | TurntableLabels: { model ("TT-02"), name ("Turntable"), now, pitch, cue, start, stop, seek, playing, paused, stopped, error, empty ("No record"), loading } |
sound | off | key and motor sounds: true, or a volume 0–1 (see Sound) |
className | — | added to the root |
Sound
None. It loads in silence.
Off by default. With sound (or a volume, sound={0.5}) the keys click, the motor spins up when the stylus lands after a press and runs down when a press stops it, and the pitch fader clicks into its 0 detent. Nothing plays on hover, on mount or from a prop change; a track that ends on its own is silent, and the motor sound stops if the player leaves the view. setMuted(true) from components/mu/sounds.ts silences every cottoncandy item at once.
Licence
Included with Pro: use it in unlimited end products for you and your clients; no reselling as a kit. See the licence.
Press Start and the tonearm swings over and lowers onto a real record, the platter spins up and the music plays; drag the arm or the line to seek, ride the pitch fader, cue or stop and the platter coasts. Its groove light stays fixed to the room while the record turns under it, with a felt mat on a satin platter, paper grain on the label and a brushed steel arm whose highlight slides as it swings.
For music players and listening roomsMore in Audio & media