Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ironfroggy

how is audio represented in data?

This topic is 6255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!