Open this example in the interactive library
Live preview
Source code
// components/PitchClassWheel.tsx
import { useState } from "react";
export default function PitchClassWheel() {
const [n, set] = useState(0);
const notes = ["C", "C♯", "D", "E♭", "E", "F", "F♯", "G", "A♭", "A", "B♭", "B"];
return (
<label>
Semitones above C
<input
type="range"
min={0}
max={11}
value={n}
onChange={(e) => set(+e.target.value)}
/>
<output>{notes[n]}</output>
</label>
);
}
