# Samples ↔ Milliseconds Calculator

## How sample-time conversion works

A sample rate states how many discrete audio samples occur in one second. At 48 kHz, one second contains 48,000 samples and one sample lasts `1,000 ÷ 48,000`, or approximately `0.020833` milliseconds.

The calculator uses these formulas:

- `milliseconds = samples ÷ sample rate × 1,000`
- `samples = milliseconds × sample rate ÷ 1,000`

Calculations retain full numeric precision. Visible results are rounded only for display and copying.

## Why sample rate changes the answer

The same number of samples represents less time at a higher sample rate because more samples occur every second. A 1,024-sample block lasts approximately 23.220 ms at 44.1 kHz, 21.333 ms at 48 kHz and 10.667 ms at 96 kHz.

Use the sample rate of the audio or device whose timing you are interpreting. A sample count has no fixed duration without that rate.

## Whole-sample rounding

Milliseconds often convert to a fractional sample count, but a stored sample position or integer delay length may require a whole sample. The calculator exposes three policies instead of silently choosing one:

- **Nearest:** uses `Math.round` for the closest whole sample. For positive half-sample values, this rounds upward.
- **Floor:** chooses the largest whole-sample duration that does not exceed the requested time.
- **Ceiling:** chooses the smallest whole-sample duration that is not shorter than the requested time.

Each result shows the duration produced by that integer sample count and its signed error relative to the requested milliseconds. At most, floor or ceiling differs by less than one sample period; nearest differs by no more than half a sample period.

## Reading buffer-size durations

The reference table converts common powers-of-two sample counts at the selected rate. These block durations can help interpret audio-device buffers, short digital delays, analysis windows and processing blocks.

A block duration is not the same as complete monitoring or round-trip latency. Real paths may include input and output buffers, safety buffers, converter delay, plug-in delay compensation, operating-system scheduling and device-specific processing. The [audio latency calculator](https://playgrid.cc/tools/audio-latency-calculator/) models stated stages explicitly rather than multiplying one buffer and presenting it as a measured result.

## Sound-design uses and limits

- Translate sample-based delay or lookahead values into time before comparing them with an envelope, transient or modulation rate.
- Convert a desired short delay into samples when a processor accepts integer sample lengths.
- Compare the time resolution available at different sample rates: higher rates make each individual sample shorter.
- Treat a displayed device value as authoritative when its internal rounding policy is documented; different processors may round or interpolate fractional positions differently.
- Sample-rate conversion changes the time represented by an unchanged sample count. Recalculate after the rate changes.

[Use the interactive calculator on playgrid.cc](https://playgrid.cc/tools/samples-to-milliseconds-calculator/)
