Sunday, October 4, 2009

High Definition Digital Audio Files Part 1 - Background

I have been exploring higher definition audio file formats to store digital music with less compression. I want to be able to archive music I download or rip from my own CDs that is as close to the source as is possible. I know, mp3 (universal) or mwa (Windows Media Player) or m4p (ITunes) formats are the commonest formats for music files. But they all have compression, which means that there is loss of signal. Now that signal may be outside of the audio response of the player I use or the ears I have, but if I want to keep a copy that is as close to the original as possible, I want to have some kind of format that has all the original file information.

Background: When an audio stream is digitized, you essentially sample the sound pulse value with a very small time between samples. Then you can run the file of digits back through your computer or audio system to reproduce the music. The rate at which you collect those samples controls the highest frequencies that you have recorded. CDs have high frequency content to capture all of the sound in the original recording, and frankly you will not be able to heart most of that through your computer speakers. In addition, CD files take a lot of space. To store data, .wav format (wave files) is a binary format that essentially copies all the information off the CD at the original CD sample rated, and has no compression at all. And wav files are general purpose, any stream of binary data can be stored in a wav file, including a photo or even a volume of data. The difference is in the decoding software. A loss free format such as flac allows some compression to reduce size.

Compression is a way to make the files smaller. I am going to consider two levels of compression. One is to do things to store redundant material in an efficient way or to store enough information to predict values correctly in a more compact form. This is lossless compression, because when the file is uncompressed, the new copy is the same as the original. This is the type of compression used in the flac format. The second way is to store the music values with less precision and to remove both low amplitude and the highest frequency signal

Mp3, wma and I-Tunes formats all are compressed, resulting in lost information and smaller file size. Once compressed the information cannot be recovered. When you compress files with the mp3 format, the compression options are the sample rate and a smaller sampling frequency, the more compression and the more of the original is lost. In Windows Media Player, for example, the choices for sample rate are from 128 KPS to 320 Kbps (Kbps here stands for thousand bytes per second). How do you convert this to the sample rate to determine loss of high frequencies?

Math of compression: Consider that the normal range of human hearing is commonly quoted as 20 Hz to 20,000 Hz (1 Hz =1 cycle per second). To completely recover a signal of 20 KHz you would have to have a sampling rate of 40,000 samples per second. For a 16 bit word, stereo recording with response to 20 Khz, we will need a rate of: 40 Khz x 16 bits x 2 channels = 1280 kbps. So, for the example of Amazon downloads, with 256 KPS Variable rate (according to Amazon’s web site today, September 27, 2009), the compression averages 5:1 over the whole musical piece. The trick is that they are VARIABLE RATE, with better sampling in the more complex passages and longer in simpler parts. So this is why most people feel that the higher bit rates, though they are compressed some, are still “comparable” with the original CD especially heard through most computer speakers indeed most home or car audio systems and with most ears.

Tags: Tags are strings of information you can ad to a file to identify that can be read and used by the decoding software. For example, ITunes files usually have an Artist, a Title, and more. It can also incude such things as graphic images or digital rights management software (DRM) This means that somewhere in the file you would find the character string containing the title. The term “Tag” refers to both the character string itself and its name, which the decoding software must understand in order to display it properly. You either get this added to your file when you rip it, it comes with this when you download it, or you add it your self Obviously any there can be as much information as you want as long as you have software that can display it properly. And you would want to have agreed upon tag names so ITunes and Windows Media Player can both read the same tags, for example understand that “Artist” may not be the same as “Performing Artist” or “Artist Name,” which is the tag I use as the sort in my own ITunes to make sure that I get “Springsteen, Bruce” and “Bruce Springsteen and the E-Street Band” to end up next to each other when I view my album covers. The wav file cannot have tags but the flac lossless compression can have tags.

No comments:

Post a Comment