I'm going through the Java Trail on their Sound api and they described two types of formatted audio data (data format and file format). From my understanding of it data format tells you how to interpret the raw sound data, while file format tells you how to interpret the file that contains that data. They used mp3 as an example for a specific type of a data format for an encoding. Yet I am also quite aware of the fact that we have .mp3 file types, so is mp3 a data format and and a file format at the same time? Also is my understanding of data formats and file formats correct?
As a general distinction between file formats and data formats,
- File formats are how data is arranged in a file.
- Data formats are how the data itself is formatted.
Many file formats is arranged in such a fashion, so that the data it stores is separated into a header which contains information about the data which is stored in the file, and the actual data which represents some type of information the file should carry.
For example, a MP3 file contains a header, the actual MPEG Audio Layer 3 encoded audio data (which are actually stored as frames of data of fixed or variable size), and optionally an ID3 tag.
A data format on the other hand, could be thought as how the data itself represents some piece information.
For example, a comma-separeted text (CSV) format data arranges the data it holds by separating columns of data which are separated by a comma character. A new line denotes another piece of data of the same formatting, usually another row.
Here are some Wikipedia articles which may be of interest: