You can read this lecture from Lothar Reichel
where he explains a little the topic "Digital Audio Compression", and post some Matlab code:
Sound is a complicated phenomenon. It is normally caused by a moving object in air (or other medium),
for example a loudspeaker cone moving back and forth. The motion in turn causes air pressure variations
that travel through the air like waves in a pond. Our eardrums convert the pressure variations into the
phenomenon that our brain processes as sound.
Computers “hear” sounds using a microphone instead of an eardrum. The microphone converts pressure
variations into an electric potential with amplitude corresponding to the intensity of the pressure. The
computer then processes the electrical signal using a technique called sampling. Computers sample the
signal by measuring its amplitude at regular intervals, often 44,100 times per second. Each measurement
is stored as a number with fixed precision, often 16 bits.
Computers emit sound by more or less reversing the above process. Samples are fed to a device thatgenerates an electric potential proportional to the sample values. A speaker or other similar device may thenconvert the electric signal into air pressure variations.The rate at which the measurements are made is called thesampling rate. A common sampling rate is 44,100 times per second (used by compact disc, or CD, audio). The bit rate of a set of digital audio data is the storage in bits required for each second of sound. If the data has fixed sampling rate and precision (as does CD audio), the bit rate is simply their product. For example, the bit rate of one channel of CD audio is 44,100 samples/second×16 bits/sample = 705,600bits/second. The bit rate is a general measure of storage, and is not always simply the product of samplingrate and precision. For example, we will discuss a way of encoding data with variable precision.
Hope it helps.