Sampler format theory

Sampler format theory

Post by leege » Thu, 02 Mar 2006 01:00:57

I see this is a MIDI group but I hope someone here may be able to point
me in the right direction. I would like to learn how a sample file
works. I understand that the sound is sampled/split into chunks at a
specific rate, but not how the sound at the rate is stored. Are there
multiple values stored for each detected sonic frequency?

Many thanks in anticipation, and sorry if this is too off-topic.


Sampler format theory

Post by stickyfo » Sat, 04 Mar 2006 20:32:53

Sampling doesn't record information about frequency, at least not
directly. It is taking snapshots of the sound's amplitude (voltage) at
regular intervals (the sample rate).

A good analogy is the price of a stock. Every day after the market
closes, you can look up your favorite stock in the newspaper. If the
stock fluctuated during the day, you won't be able to tell from the
paper, but if you take the numbers from every day and graph them, you
can get a long-term trend graph. You would be sampling the stock at a
sample rate of 1 sample per day.

Audio samplers do the same thing, at sample rates anywhere (usually)
from 20 kHz to 48 kHz (thousands of samples per second). It's not
unusual to see sample rates much faster than that now with computer
recording gear. The resulting stream of numbers can be reconstructed
just like a stock graph for playback. You just have to put it in a file
for the sample player to use.

To store this sample data into a useful file, you usually want to add
some kind of information about the data itself, including the sample
rate, number of channels (is it mono, stereo, etc), the original note
that was being sampled, how long it is, and how many bits make up each
sample point. This information is usually stored in the "header" part
of the file. Then the data itself is broken into chunks, but simply to
make it easier to load into the sampler. Disk drives and CDROMs have an
easier time dealing with blocks of data than continuous streams.

More advanced samplers can employ more advanced techniques. For
instance, when sampling a chromatic instrument like a piano, you get
better results if you sample many keys (or even all of them, multiple
times), than if you just sample one key and stretch it to cover all 88
notes. This adds to the complexity of the file but uses the same basic

There has got to be a good page on howstuffworks with illustrations and