how is audio represented in data?

Started by
18 comments, last by ironfroggy 22 years, 9 months ago
The only way I can think of is that its a series of values of the offset of the currect point on the wave from 0. I know I''m wrong and there is probably more to it. So, could someone please help me understand this?
(http://www.ironfroggy.com/)(http://www.ironfroggy.com/pinch)
Advertisement
Depends what type of audio data. Midi data is simply hardcoded into to format. it will read something like
quaternote at x pitch in measure x and beat x
wav, mp3, and most other formats save it similarly. each piece of data tells the pitch or the sound. the timing of it can be assumed by the resolution the it was saved in. (like 44hz)
It''s not quite that simple, but that should give you a rough idea. for exact file formats check out www.wotsit.org.

HHSDrum@yahoo.com
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Actually you''re pretty much right. It really is the value of the waveform from a base point. The sampling frequency would indicate how often along the waveform you take the measurement. This is, of course, for standard pulse code modulation (.wav is ADPCM, Advanced Pulse Code Modulation, which has a little compression work done but is still recognizeable as sampling)... some nifty circuits and our ears make it "sound" smooth. Granted you can run this set of samples from the waveform through a few algorithms to compress it, at the loss of some quality.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
In AD/PCM formats, stereo data is stored in marching steps, L|R|L|R|L|R, through the data stream.

--------------------
-WarMage
...www.wotsit.org will have some links to .wav and PCM decoding
So what is the relations between the waveforms and the spectrum? How do I get spectrum data from the waveform and whate exactly is the spectrum? Know any sites?
(http://www.ironfroggy.com/)(http://www.ironfroggy.com/pinch)

Relation between waveform ("spatial domain") and spectum ("frequency domain") is a bit ... well, not necessarily easiest thing to grasp. But basically it boils down to that you can represent arbitrary data ("waveform") with a proper sum of sinusoidial signals ("frequencies"). I won''t start proving it, so you just have to take my word for it (or any one''s word who''s done even a bit of signal processing...)

By "spectrum" you probably mean the amplitude spectrum of data. It basically shows what frequencies are present in waveform data (just like signal analyzer in winamp or your stereo set).

I don''t start lecturing more here, if you are interested, you might want to look for example "fourier transformation" (spatial->frequency) and "inverse fourier transform" (frequency->spatial).

Be warned however, signal processing can be ... a bit elusive topic, and it probably will take you a while to even grasp the basics. It''ll be one step towards a larger world, however...
~~~ "'impossible' is a word in the dictonary of fools" --Napoleon
the only thing i cant understand is how for instant i a single value of the wave height can be transformed into all those different frequencies. or is it something over time? measure the different frequences over time t and each one it put into the spectrum?

(http://www.ironfroggy.com/)(http://www.ironfroggy.com/pinch)
Without time, frequency is meaningless. You can''t get the frequency for a single sample, you need to do it over a set of samples.
You can''t get more information out of something than you put into it. If you''re doing a Fourier analysis of a signal, the maximum amount of frequencies you can resolve is N/2, where N is the length of your time series (the waveform). The reason for the N instead of N frequencies is that there are both positive and negative frequencies in a real signal, and they are always identical.

For N = one data point, you only have the magnitude of one frequency (0Hz).

For N = 2, you get the DC value and the magnitude of the frequency at the Nyquist rate (half the sampling rate). You can also say Fs/2 where Fs is the sampling frequency.

For N = 4, you get frequencies 0, Fs/4, -Fs/4 and Fs/2.

Your frequency resolution is going to be Fs/N; that is, you''ll get N evenly spaced frequency results along the negative and positive sides of the spectrum. This gives you Fs/2 real data points.

There is a way to get higher resolution with less samples, but it requires using autoregressive modeling & is a bit more complicated than straight Fourier analysis.
First, ADPCM stands for Adaptive Delta Pulse Code Modulation.
Second, WAV is not intrinsically ADPCM as felisandria suggests. In fact, WAV can use many different formats (as defined in mmreg.h), which is why the WAV header contains a field to identify the format. Usually, WAV files are raw PCM; it's rare to find any other types in practice.


Edited by - merlin9x9 on June 28, 2001 3:23:54 PM

This topic is closed to new replies.

Advertisement