As far as I understand, a frame consist of multiple samples and both are kind-of a point in a time series.
My questions are :
- What's the difference between sample and frame?
- Why define two different concepts? Why not just merge them into one?
Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
A sample is the smallest usable quantum of digital audio. The term frame isn't formally defined in pure audio terms, but is often used in relation to video that may accompany an audio track. In that context a frame is the quantity of audio samples taken during a video frame interval.
If there are 30 video frames per second and 48000 audio samples per second, you could say that there are
48000 / 30 = 1600 samples per frame, or that an "audio frame" contains 1600 samples, but there literally is no audio frame, it's just a convention for talking about audio with respect to a video frame rate.
In some media encoding schemes like DPX, a frame can contain video and audio sample data, so it's convenient to call the contained audio samples an audio frame, but that's a property of the container and not a property of the audio itself.
The term 'frame' has several different meanings, dependent on the context. Beside the obvious meaning in video contexts, and the usage in audio codecs like MP3, a frame may also be used as a name for all the samples in a bundle with several channels, which belong to the same point in time. Yet another usage of the word is with communication protocols, where a frame is defined to be a collection of bits on the wire which together form an item of information that is sent as a whole, and often protected against transmission errors.
For example: The S/P-DIF interface transports a stereo signal, which consists of two channels, typically a left and a right side signal. Within this interface, a frame is defined to encompass all the bits that correspond to a single sampling instant. A frame consists of two subframes, one for each channel. A subframe holds the sample itself, and several additional bits which are used for synchronization, error detection and other sundry stuff. So there are three things to distinguish:
With S/P-DIF, there's a fourth thing, the block, which holds 192 frames. This is only interesting for ancillary information ("metadata") that describes the audio to some extent.
If you only have one channel, and only the sample with no ancillary bits, then the terms 'frame' and 'sample' are synonymous.