tags:

views:

267

answers:

5

Hi all,

I've been pondering this question lately. I've got this small app I've built, in which I visualize a wav file and give it a wave form (similar to what audacity does).

I've noticed that from some reason there are negative and positive values. Well, I can understand the importance of negative values in sinusoidal waves, where the direction represents the direction of the electric current. But what does negative value represent in music?

+1  A: 

Exactly the same ... a wave file just represents a sampled sound wave. And sound waves (as most waves of any type) are sometimes below and sometimes above the equilibrium (in the case of an sound wave the local air pressure is lower or higher then the ambient air pressure) and hence are the samples sometimes negative and sometimes positive.

In the end its just a matter of fixing a equilibrium. A 16 bit sound file has sample values ranging from -32.768 to +32.767. You could just add 32.768 to all sample values and get samples values in the range 0 to 65.535 and you moved the equilibrium (total silence (in absence of a DC offset)) from 0 to 32.768.

Daniel Brückner
+1  A: 

All waves are effectively combinations of sinusoidal waves. The Fourier transform takes a waveform and turns it into a function describing which sinusoidal waves are present in the waveform. So positive and negative values always make sense.

EDIT: You could, conceivably, have 32768 (or whatever) be the center, and 65535 be the peak (with 1 being the trough). However, that's really nothing more than a shift of the data. The central meaning is always the same; as the volume of the sound goes down, the amplitude of the waves of sound gradually reduces to zero, and the peaks and troughs of the waves gradually go down to the center (i.e. zero, or 32768, or whatever is chosen as the center). It's just that zero makes a lot more sense as a center value than an arbitrary value.

jprete
+1 for noting that all sound is essentially a combination of sinusoidal waves (given enough of such waves, obviously...)
Kylotan
It's true that a sound can be represented as a combination of sinusoidal waves, but that doesn't help the original poster very much. Bringing Fourier transform into what is essentially a simple question is just confusing the issue.In basic digital audio, it's easier to think of the sounds as points on a time line, IMHO.
Martin Vilcans
+1  A: 

Sound is fundamentally a pressure wave, made up of "peaks" which are regions of higher pressure and "troughs" which are regions of lower pressure. A microphone responds to the incident pressure wave by taking advantage of some physical material property to measure that pressure over time. Making a recording is the process of sampling those measurements and transcribing them to some media.

A reasonable representation to choose is to call the ambient pressure zero, with higher and lower pressures positive and negative. Another reasonable representation is to take ambient pressure as half-scale, with lower pressures below and higher pressures above half. Other representations are possible, and it isn't even required that the relationship between the incident pressure and the measured value be linear.

Whether a signed or unsigned representation is used is only a matter of history and convention. 16-bit audio is usually represented as signed but 8-bit audio is usually not, for instance.

Historically, the telephone system has used 8 bit unsigned measurements following a non-linear function called either a-law or µ-law. The non-linear representation supports greater dynamic range within the same bit rate than a linear representation.

RBerteig
so let's see if I got it right. 0 represents no sound whatsoever. So what it the meaning of a negative value? It represents the direction of the amount of sound? Positive value indicates a strengthening sound (say a blast) and a negative value indicates a decrease in the amount of sound? If that's the case why just don't draw a line between the amount of sound in every moment, values always being positive, as long as there's sound. What use is there for negative values then?
vondip
You did not get that right. 0 is a single sample. No single sample can be said to represent any sound or no sound whatsoever. It is only in the frequency of oscillation in the signal that sound can exist. Obviously, a single sample can not represent any oscillation.
recursive
The current value - either positive, zero, or negative - represents no sound at all. It's the variation of the value over time that represents the sound. Look at a loud speaker. The value in a wave form represents the position of the membrane at different points in time. Positive means the membrane moved in one direction (from the equilibrium when the music is off) and negative means the other direction. Absolute smaller values represent small displacements, absolute larger values represent large displacements.
Daniel Brückner
+1  A: 

Waveform is flat (Y=0) if there's no sound.

Y axis relates to the pressure difference relative to ambient pressure. Positive Y values indicate compression and negative Y values indicate rarefaction.

John at CashCommons
A: 

From the WAV format :

8-bit samples are stored as unsigned bytes, ranging from 0 to 255. 16-bit samples are stored as 2's-complement signed integers, ranging from -32768 to 32767.

Negative values comes signed integers.

philippe