A time conversion that does not need BPM
A sample length calculator converts a known clock duration into the number of samples available at a declared sample rate. Tempo is absent because the input is already time. This keeps the page distinct from musical loop planning and useful for any bounded digital-audio duration.
The output separates an exact mathematical count from the integer count a sampled system can represent.
Core formula
First convert the input to seconds. Milliseconds are divided by 1,000. Then:
exact samples = seconds × samples per second.
If the result is an integer, the requested duration lies exactly on the sample grid. Otherwise, nearest, floor, or ceiling selects a representable integer position. The page converts that integer back to time and shows the difference.
Worked 23.976-millisecond example
Enter 23.976 milliseconds at 48,000 Hz and choose nearest. The duration in seconds is 0.023976. Multiplying by 48,000 gives 1,150.848 exact samples.
Nearest rounding returns 1,151 samples. That integer represents 1,151 ÷ 48,000 seconds, or approximately 23.979166667 milliseconds. The signed timing error is approximately +0.003166667 milliseconds.
Floor returns 1,150 samples, representing approximately 23.958333333 milliseconds and an error of about −0.017666667 milliseconds. The labels make the tradeoff visible.
One sample sets the resolution
At 48,000 Hz, one sample period is 1/48,000 second, about 0.020833333 milliseconds. At 96,000 Hz, it is half as long. This period is the spacing between representable sample boundaries.
The page does not interpret higher sample rate as universally better or recommend a production setting. It uses the rate you declare.
Rounding choices
Nearest generally minimizes absolute timing difference. Floor ensures the represented length does not exceed the requested time. Ceiling ensures it is not shorter. Those properties can matter for buffers or boundaries, but a destination may impose its own policy.
Do not repeatedly convert a rounded integer back to milliseconds and then into samples again. Preserve the original duration and selected rate to prevent compounding display loss.
Optional start and exclusive endpoint
If you provide an integer start sample, the exclusive endpoint equals start plus rounded length. A start of 10,000 with a length of 1,151 ends at exclusive position 11,151. The included zero-based sample indexes run from 10,000 through 11,150.
Some systems use one-based labels or inclusive end positions. Translate the result only after checking their documentation.
Duration is not file size
Sample count alone does not determine bytes. File size also depends on channel count, bit depth or encoding, container overhead, compression, metadata, and possibly block structure. The page intentionally does not estimate storage.
It also does not read a file’s actual rate, channel layout, or duration. Enter values from a source you trust.
Duration is not content alignment
An integer sample boundary says nothing about waveform phase, a transient, a zero crossing, or a clean loop. Audio can click at a mathematically tidy endpoint. The calculator has no waveform and makes no editing decision.
For musical material, first derive the desired clock duration with a tempo-aware route if needed. Then use this page for discrete conversion.
Large values and precision
The implementation rejects totals outside safe integer arithmetic. Display decimals control the time cards but do not change the chosen integer sample count. The formula trace retains the normalized duration and rate.
When a source duration itself is rounded, the calculated error describes sample-grid rounding only; it cannot quantify source uncertainty.
Local and non-destructive
No file is opened, modified, created, or uploaded. The values remain in page memory. Copy produces a text summary after a browser action. Reset restores the fractional demonstration.
Verify by converting back
After rounding, divide the integer sample count by the declared rate. The represented-duration card performs this reverse check. Its difference from the requested duration should match the signed-error card. This closed loop tests both unit normalization and rounding direction.
For example, 2,205 samples at 44,100 Hz represent exactly 0.05 seconds, or 50 milliseconds. If an input of 49.99 milliseconds rounds to that count, the positive error belongs to the grid choice; it is not hidden in the display.
Keep channel count separate
A stereo file contains two channel samples at each sample frame, but timeline duration is commonly counted in sample frames per channel. This page uses the supplied sample rate as positions per second and does not multiply by channels. A storage calculation would need channel and encoding details and belongs to a different product.
Frequently asked questions
How many samples are in one second at 48 kHz?
Exactly 48,000 samples under the declared rate.
Why can exact samples be fractional?
The requested clock duration may fall between positions on the discrete sample grid.
Does the calculator know my file’s sample rate?
No. You must enter the correct rate.
Is endpoint inclusive?
No. The optional endpoint is explicitly exclusive, so length equals endpoint minus start.
Enter a duration and sample rate, choose the destination’s rounding rule, and retain both requested and represented timing.
