Search code examples
javaframesamplewave

Is a frame a sample?


I'm working with sound files in Java for a homework assignment (dealing with wave files only). I've read a lot of articles and information about wave files and the header and everything the only thing I'm confused with is a frame (For the sound data to be read in/processed/or manipulated).

Can anyone help clarify the concept of a frame to me? I've been reading that Frame is an interchangeable term with Sample. But I'm getting confused between the two or if there is any difference.


Solution

  • A frame contains one sample for each channel in the audio file. For a mono WAV file, a sample will just be one sample in size. For a stereo WAV, each frame will have two samples, one for the left channel and one for the right. Same logic applies for higher number of channels (5.1, etc.)

    There's more explanation on this page, see 'Sample Points and Sample Frames' section)