Open this example in the interactive library
Live preview
Source code
// components/SampleMemoryEstimator.tsx
import { useState } from "react";
export default function SampleMemoryEstimator() {
const [seconds, set] = useState(30);
return (
<label>
Duration in seconds
<input
type="number"
min={0}
value={seconds}
onChange={(e) => set(Math.max(0, +e.target.value))}
/>
<output>
{((seconds * 48000 * 2 * 3) / 1048576).toFixed(1)} MiB at 48 kHz, 24-bit stereo
</output>
</label>
);
}
