IMAGE, AUDIO AND COORDINATE WORKSHEETS

Recovering audio duration from a raw sample-data size

Divide a raw sample-data byte count by the byte rate of the same layout and you recover the duration. This guide shows the round trip and where it stops being valid.

Why a byte count can be turned back into seconds

Uncompressed audio stores a fixed number of bytes for every instant of sound. If you know how many instants occur per second, how many bits each channel value takes and how many channels play together, you know how many bytes one second occupies. That makes the size a straight multiple of the duration, and the relationship can be run in either direction. The audio file size calculator multiplies seconds by the byte rate, and a division by the same byte rate undoes it. This is useful when a log, a buffer report or a disk usage figure gives you bytes and you want to know how much recorded time that represents, or when you want to confirm that a size estimate and a timing estimate agree before you size storage for a project.

The byte rate behind the default example

The worked case uses 48,000 sample times per second, 16 bits per value and two channels. Each sample time then holds 2 × 16 = 32 bits, which is 4 bytes. At 48,000 sample times per second the byte rate is 48,000 × 4 = 192,000 bytes per second. Over 60 seconds that grows to 192,000 × 60 = 11,520,000 bytes, the value the audio file size calculator returns for these inputs. Dividing 11,520,000 by 192,000 on the basic calculator returns 60 again. The key point is that the denominator is not a free choice. It has to be built from the same rate, bit depth and channel count that produced the numerator, otherwise the quotient is a number with no meaning.

Compact disc audio as a second case

Compact disc audio uses 44,100 sample times per second, 16 bits and two channels, which gives 44,100 × 4 = 176,400 bytes per second. A 10-minute stretch is 600 seconds, so the sample data holds 105,840,000 bytes, and dividing by 176,400 returns 600. A common check is the size of one minute of CD audio, 10,584,000 bytes, which is a little over 10 million bytes, or about 10.09 MiB when counted in binary units of 1,048,576 bytes. The decimal and binary readings differ by about 5 percent at this size, so state which unit a byte count uses before comparing it with a drive or operating system figure.

A high-resolution layout

Change the layout and the same method gives a different answer. A stereo recording at 96,000 sample times per second and 24 bits per value stores 96,000 × 24 × 2 / 8 = 576,000 bytes per second. Ninety seconds of it holds 51,840,000 bytes, and 51,840,000 divided by 576,000 returns 90. Dividing that same byte count by the 192,000 rate of the default layout would give 270 seconds, three times the true duration. The error comes entirely from the wrong denominator, which is why a recovered duration is only as trustworthy as the layout assumptions attached to the byte count. Write the rate, bit depth and channel count next to every size you record.

Byte counts that do not divide evenly

Real counts rarely land on a whole number of seconds. Suppose a buffer holds 1,000,000 bytes of the default 48,000 Hz, 16-bit stereo layout. Dividing by 192,000 gives about 5.208 seconds. That is a valid duration, and it corresponds to 250,000 whole sample times because each one takes 4 bytes. If a byte count is not a multiple of the bytes per sample time, a sample time was cut off, which often points to a truncated read, a stray header or a different layout than the one you assumed. A remainder is a useful diagnostic, because correct raw data for a given layout always contains a whole number of sample times.

Headers, metadata and compressed data

The inverse works on sample data only. A complete audio file adds bytes that carry no sound. A plain PCM WAV file begins with a header, commonly 44 bytes for the basic layout, and files may carry additional metadata chunks for titles, cue points or software tags. Those bytes inflate the total without adding time. Subtracting a header the size of 44 bytes from a 11,520,044-byte file leaves the 11,520,000 sample bytes, but you need to know the real header length for your file and that kind of subtraction only makes sense for uncompressed data. Formats such as MP3, AAC and FLAC do not store fixed-width samples, so dividing their file size by a raw byte rate says nothing reliable about duration.

Choosing between file size and a duration field

When a file reports its own duration, that field is the better source, because the player computed it with full knowledge of the format. The byte-count route earns its place when no duration is available: a raw capture from a microcontroller, an exported buffer, a network stream you measured at the socket or a size quoted in a requirements document. It also works as a cross-check. If a recorder claims 60 seconds and the sample data is 11,520,000 bytes at 192,000 bytes per second, the numbers agree. If it claims 60 seconds but the data holds 11,000,000 bytes, about 57.3 seconds of audio, something was lost or the format description is wrong, and that gap is worth investigating.

Sizing storage from a planned duration

The forward direction answers planning questions just as well. A project that needs 8 hours of 48,000 Hz, 16-bit stereo capture has 28,800 seconds to store, and at 192,000 bytes per second that comes to 5,529,600,000 bytes, about 5.53 gigabytes in decimal units. Adding a second backup copy doubles it. If the same project switched to mono, the byte rate would fall to 96,000 and the total would halve to 2,764,800,000 bytes. Running the forward and inverse calculations on the same layout is a quick way to confirm that a planned recording length, a stated size and a drive quota all describe the same material, before any of them is committed to a schedule or a purchase.

What this reconciliation does not cover

The arithmetic assumes constant sample rate, fixed bit depth and a constant channel count for the whole stretch of data, and it counts only the sample bytes. It does not decide how a file should be stored, whether a format is lossless, or how a streaming service charges for transfer. Variable bit rate coding, packet headers, padding and silence suppression all break the fixed-width assumption. The tools used here divide and multiply the numbers you supply, so a mistaken layout produces a confident but incorrect duration. Confirm the layout from the format specification or the recording settings before relying on a result.

Reproduce the checks

Sixty-second sample data

Open the Audio File Size Calculator and enter:

Sample rate
48000
Bits per sample
16
Channels
2
Duration
60

Expected output:

Audio data size

11520000

The size excludes format-specific overhead.

Duration reconstruction

Open the Basic calculator and enter:

First number
11520000
Operation
divide
Second number
192000

Expected output:

Result

60

The denominator uses the same raw layout.

References and implementation scope

The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.

Sources

Related tasks