Samples ⇄ Time Converter
Enter a number of samples and the sample rate to get the time. You can also turn a time into samples, or find the theoretical time of an audio buffer from its size.
Formulas
- Time (s) = samples ÷ sample rate (Hz)
- Samples = time (s) × sample rate (Hz)
- Theoretical time of a buffer = buffer size in samples ÷ sample rate (for one buffer; if you choose a number of buffers n, the time for n buffers is shown too)
- Time of one sample = 1 ÷ sample rate
Everything is calculated with exact fractions, so no decimal rounding error creeps in. The only rounding is the one done when the result is displayed.
Time to samples
The number of samples is a whole number, but time × sample rate does not always come out as one. The calculator shows the exact value (which may have decimals) and two whole numbers: rounded down (the samples that fit completely in that time) and rounded up (the samples needed to cover that time). Which one you want depends on the use, so a "round to nearest" value is not given. When the result is exactly a whole number, the two are the same.
The time of a buffer is a theoretical time
- Buffer size ÷ sample rate is a theoretical time worked out from the size of the buffer alone. It is not the delay of the whole system. A/D and D/A conversion, the driver, the operating system and plug-in processing can add more (no estimates of those delays are given here).
- Whether "latency" is counted one-way or round-trip depends on the equipment and software. This calculator lets you enter the number of buffers n yourself and does not assume that a round trip is n = 2.
Examples
- 48,000 Hz, 480 samples → 10 ms
- 44,100 Hz, 1 second → 44,100 samples
- 48,000 Hz, a 256-sample buffer → about 5.333 ms (16/3 ms, for one buffer)
- 96,000 Hz, a 512-sample buffer → about 5.333 ms
- 44,100 Hz, 1/3 second → 14,700 samples (it divides evenly, so rounding down and up both give 14,700)
- 44,100 Hz, 10 ms → 441 samples
Notes
- The sample rate is one of the listed values (8,000 to 192,000 Hz) or a value you enter (greater than 0 and at most 1,000,000 Hz). The list contains only numbers and does not say what each rate is used for.
- Samples can be a whole number from 0 to 999,999,999,999, the buffer size from 1 to 1,000,000 samples, and the number of buffers from 1 to 8.
- To convert between the size of an audio file and the recording time, see the Audio File Size Calculator. For the delay time from a distance, see the Speaker Delay Calculator.
Frequently asked questions
How many milliseconds is 480 samples at 48,000 Hz?
10 ms (480 ÷ 48,000 = 0.01 s).
How long is a 256-sample buffer?
About 5.333 ms at 48,000 Hz. This is the theoretical time; the delay of the whole system can be larger.
Is the buffer time all of the latency?
No. The buffer time is only part of the delay of a real system. A/D and D/A conversion, drivers, the operating system and plug-ins can add more.
Why is the number of samples not a whole number?
Because time × sample rate does not always come out as a whole number. The rounded-down and rounded-up whole numbers are shown too.