Recovering a sample rate from a file
Sometimes the sample rate is not written down. A raw data dump from a logger, a snippet exported from an analysis tool or a recording whose header was lost may tell you only how many samples it holds and how long it ran. This page turns those two facts into a rate. You enter the samples counted in one channel and the duration in seconds, and it returns samples per second. It is also a quick way to check a nominal rate against what a device really delivered, for example to see whether a recorder drifted over a long take. The answer is the per-channel rate, which is the figure used to label audio and data acquisition systems.
Samples divided by seconds, per channel
The calculation is rate = samples / seconds. If a channel holds 480,000 samples across 10 seconds, the rate is 48,000 samples per second, also written 48 kHz. The count must be per channel. A stereo file that stores left and right samples interleaved contains twice as many values as samples per channel, so divide the total by the channel count before entering it. The duration should be the span between the first and last sample instants as accurately as you can know it. The page does not multiply by channels, bit depth or anything else, because those affect the bitrate or file size, not the sampling frequency itself.
Why 480,000 samples in 10 seconds is 48 kHz
The page starts with 480,000 samples and a duration of 10 seconds. Dividing gives 48,000 samples per second, the common rate for video and professional audio. The same arithmetic works at other scales. A count of 441,000 samples over 10 seconds gives 44,100, the audio CD rate, and 192,000 samples over 2 seconds gives 96,000. For a data logger that captured 8,000 samples in one second the rate is 8,000. Because the formula is a plain ratio, scaling both inputs by the same factor leaves the answer unchanged, so ten times the samples over ten times the duration still describes a 48 kHz recording.
Interleaved stereo and multichannel counts
Many tools report total frames or total values, and it is easy to confuse them. A frame holds one sample for every channel, so a stereo file of 960,000 frames over 10 seconds has 960,000 samples per channel and a rate of 96,000 samples per second. If instead the tool reports 960,000 individual values, the per-channel count is 480,000 and the rate is 48,000. Look for terms such as frames, sample frames or samples per channel. When the total is quoted in bytes, divide by the bytes per sample and by the channel count first. Getting this step wrong produces a rate that is off by exactly the number of channels, which is a useful sign of the mistake.
Checking for clock drift
Real converters run from a crystal clock that is close to its nominal frequency but never perfect. Suppose a recorder set to 48 kHz stored 2,879,424 samples during a 60 second reference tone. The page returns 47,990.4 samples per second, about 0.02 percent slow. Over an hour that error accumulates to roughly 0.7 seconds, enough to shift audio against video. Measuring a long recording against a trusted timing source in this way shows whether two devices will stay in sync. The result is only as good as the duration measurement, so use a clock, a timecode or a reference signal that you trust, not an estimate by ear.
Common sample rates and what they are used for
A handful of rates cover most audio. The audio CD uses 44,100 samples per second. Film and video production use 48,000, with 96,000 and 192,000 for high-resolution work. Telephony uses 8,000, and wideband voice uses 16,000. Measurement systems vary widely, from a few samples per second for slow temperature logs up to millions per second for oscilloscopes. If your computed rate lands near one of these standards, it is probably that one, and the small difference is clock error or a duration measured imprecisely. A result like 47,999.8 is almost certainly 48,000, whereas 22,050 is exactly half the CD rate and often appears in older multimedia files.
Sample rate and the frequencies you can capture
A sampled signal can represent frequencies up to half the sample rate, known as the Nyquist frequency. At 48,000 samples per second that limit is 24,000 Hz, and at 8,000 it is 4,000 Hz, which is why telephone speech sounds band-limited. Content above the limit must be removed by a filter before sampling, or it folds back into the band as aliasing. When you recover a rate from a file, this limit tells you what frequencies the file could ever have held. A recording that came out as 16,000 samples per second cannot contain information above 8,000 Hz, no matter how it was captured originally or how it is later resampled.
Practical sources for the two counts
Where the two numbers come from decides how much you can trust the result. A sample count can be read from an audio editor status line, from a file analysis tool or from a program that opens the raw data and reports its length in frames. The duration can come from the recording device log, a timecode stamp or a reference event such as a start and end tone. Avoid taking the duration from a file player after it has resampled or stretched the audio, since that reflects playback rather than capture. For long recordings, use the largest span you can measure, because a fixed timing error of a few milliseconds matters less over an hour than over a few seconds.
When an average sample rate hides gaps
The calculator computes a plain quotient. It does not detect variable or irregular timing, so a log with dropped samples will return an average rate that hides the gaps. It does not apply to non-uniformly sampled data, to compressed formats where the stored count is not the original sample count, or to recordings whose duration you only know approximately. The output must be finite, so a duration of zero is not accepted. Treat the answer as an estimate whose accuracy follows from the accuracy of the two numbers you enter, and compare it with the rate documented by the device or format when one is available.