Samples to Time Calculator

About this calculator

Convert audio samples, time and sample rate. Choose the duration of a block or the time from its first frame to its last.

Calculator inputs

Example: 480 frames at 48 kHz in a block.

Calculate the example or use your values.

Controls are loading. Interactive calculation requires JavaScript; the method and worked example below remain readable.

Uniform sample count, rate and time

An empty block may contain zero frames.

Stereo has simultaneous channel values at each frame; do not add them together.

Changing this unit reinterprets the same digits. Calculate again.

Input syntax, limits and timing assumptions

Use unsigned decimals (including .5), scientific notation with exponent from -24 to 24, or a/b with a nonzero denominator. No signs on the number, expressions, commas, units inside a token or decimal ending in a dot. Frame counts are whole digits. Tokens allow 96 ASCII characters; reduced fractions allow 36 digits per component.

Frames: 0 to 1,000,000,000,000 for a block; at least 1 for timestamps. Rate: 1e-9 to 1e12 frames per second. Time: 0 to 1e21 seconds. Limits apply after unit conversion. These are this tool's arithmetic policies, not supported equipment settings.

This is uniform supplied-rate arithmetic. It does not measure clock accuracy, perform audio processing or predict complete device latency.

Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

Block time and timestamp span answer different questions

At a uniform rate Fs, each frame position is one period, 1/Fs, after the preceding position. An N-frame block occupies N/Fs seconds. Its timestamps run from index zero through index N minus 1, so their first-to-last span is (N−1)/Fs. A block endpoint is one period after the final timestamp.

A frame contains the simultaneous channel values at one position. Stereo does not double this duration. “Samples” here means frames or samples per channel, not the combined number of channel values.

Worked example: 480 frames at 48 kHz

This block occupies 480/48000 second, exactly 10 milliseconds. Its first-to-last timestamp span is 479/48000 second, or 479/48 milliseconds, about 9.97916666667 milliseconds. One frame occupies one period but its first-to-last timestamp span is zero. An empty block has no timestamps.

When a target falls between whole counts

For a 1 millisecond target at 44.1 kHz, occupied-block equivalence is 44.1 frames. A physical whole count is either 44, achieving 440/441 millisecond and falling short by 1/441 millisecond, or 45, achieving 50/49 millisecond and exceeding the target by 1/49 millisecond. For a first-to-last span the corresponding whole counts are 45 and 46. The calculator reports both rather than choosing which timing error fits your task.

Finding a rate

Divide the number of intervals by the supplied duration. A 1001-frame occupied block lasting one second implies 1001 Hz; a first-to-last span of one second implies 1000 Hz. Zero intervals and zero duration fit every positive rate and do not identify a rate. Positive intervals over zero time, or zero intervals over positive time, have no finite positive solution.

Exact source and display units

Rate and time are evaluated as exact fractions from the entered source and its unit. Changing an input unit deliberately reinterprets the entered digits and requires Calculate again. The separate Show controls only change the view of an existing result. Rounded displays never become calculation inputs. “About” marks a rounded number; exact fractions remain available in the result details.

Scope and sources

This is nominal constant-rate arithmetic, not an audio measurement or total latency prediction. One buffer's duration does not include converters, hidden buffers, processing, device clocks or acoustic travel. The tool does not upload or process audio files.

The W3C Web Audio API Recommendation of June 17, 2021 defines buffer length in sample frames, separates channel count and computes duration as length divided by sample rate. Its playback algorithm uses a one-over-rate time increment. The first-to-last formula above follows from the stated uniform timestamps; it does not certify equipment clock accuracy. This calculator's input limits are its own bounded arithmetic policy, not the API's constructor limits.

Privacy and sharing

Calculation stays in this page without project storage or automatic input transmission. Copy and print keep the current complete result or explanation. A public link is created only with consent and includes all numeric source values, units and reference. Anyone with that link can see them. Explanatory or outside-domain outcomes have no numeric public preview.

Frequently asked questions

Does stereo have twice as many sample frames?
No. Each frame position contains simultaneous values for its channels. Summed channel values are not the frame count used for duration.
Is a fractional frame count a recording instruction?
No. It is the exact algebraic equivalent of the requested time. Use the lower or upper whole-count row and its stated timing difference.
Can this calculate my complete audio latency?
No. It can calculate one supplied block duration. Additional buffers, processing, converters and other delays require separate information.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.