# In a audio stream of signed data, what difference is there between a positive and a negative sample?

Say I have 16 bit signed data in my audio file.

What is the difference between a sample set to +1,000 and a sample set to -1,000? Since silence is still at 0, I'm not too sure how to interpret these signed values.

Imagine a simple speaker, or a microphone. Either of these devices (usually) have a diaphragm which vibrates to create or detect sound. The position at any given time of the diaphragm relative to its resting position could be called its displacement. Since it can move in two directions from the resting position, the displacement is a distance that can be positive or negative.

There are various complications and imperfections, but generally speaking, samples in an audio file are proportional to displacements of a speaker or microphone diaphragm. That's the fundamental thing. Everything else is implementation details.

The sample value zero corresponds to the resting position of the speaker. Therefore, if you play "all zeros", you hear nothing. But if you play, say, a second's worth of the sample value +1000, you're in principle telling the speaker "slam forward as fast as you can, then stay there for a second, then go back to zero".

It's that transition from one position to another that produces/is the click you hear. You don't hear anything at a constant +1000 because nothing is moving — depending on your perspective it's either nothing at all or a "zero hertz" signal.

So, what's the difference between +1000 and -1000? The speaker moves in the opposite direction, that's all. This mostly does not make a difference to the sound you hear, but it does have some consequences.

• Suppose you have the samples [+1000, -1000, +1000, -1000, +1000, -1000, …]. That's a high-frequency oscillation, so that's a sound you can hear. But if they were all +1000, that would be silent again.

(And in case you're wondering: if you had [+1000, 0, +1000, 0, +1000, 0, …], that would be the same sound but quieter, because there's half as much change in displacement.)

• If you take all of the samples of an audio signal and switch the signs around, you have changed the phase of the signal, or in other words inverted it. It'll sound the same by itself, but if you mix (add) them together, they'll all sum to zero (cancellation) instead of being louder, and if you play the original and inverted versions through two speakers, you'll get weird frequency-dependent effects depending on where the listener is. (This is why it is important to pay attention to polarity when wiring stereo speakers.)

One detail I haven't mentioned: most speaker systems are “AC coupled” (high-pass filtered). This means that they will not actually displace the speaker in response to a constant level; instead they will return slowly to zero, slowly enough that this makes no audible sound of its own. This protects the speaker from overheating and saves energy, but, again, has very little audible effect. The clicks and silence you hear from the experiments discussed above are the same as you would hear if this was not done.

Many other audio components are AC coupled too. Generally, this is done so that there are not any constant levels — this avoids unnecessary clicks when you add or remove sound sources, and also makes the best dynamic range — for example, if you have a silence at +30000 in your 16-bit data, then you can't make a very loud sound on top of that silence, because it'd run into the +32767 maximum possible value. So keeping things centered around zero lets the entire range be used.

• Great answer. Thank you. I was not aware that you could move the speaker forward and backward. In the really old days, I would just send a pulse to the speaker and so I assumed it could only go forward. Jul 5, 2019 at 22:43

Your assumption that silence is at zero (0) sample value is incorrect.

The values of the 16-bit signed data in your audio file are simply audio samples, which represent the level of an audio waveform at a specific point in time. As you join the dots as it were, you will begin to see the shape of the entire audio waveform.

You should look up digital sampling theory and try to understand how digital audio sampling works. How you get from an analogue waveform, to sampled data and then back again to an analogue audio waveform.

There is no such thing as silence other than the absence of any change in a stream of audio samples.

You can simply interpret the values of +1000 and -1000 as simply two points in time where the sampled value of the original waveform happened to result in values of +1000 and -1000 respectively.

• Why do I think 0 is silence? Well... So I create two 2 second files. One has all of its samples set to 0 and the other with all of its samples set to 15,000. While playing, both "sound like silence". However, when I start playing the one with 15,000 and also when it ends, I hear a small "tick". So there is something special about 0, at least on my crappy audio device. Jul 3, 2019 at 21:53
• Seriously mate. Go read up on Digital Audio Sampling theory. This will answer all of your questions. The 'tick' you are hearing is the DAC jumping from 0 to 15000 and then from 15000 back to 0 again at the end of the file. The other thing that is 'special' about the file is that you have created a file with a massive DC offset. I don't think this will damage your gear, but if you make one long enough.... well you never know. Don't get caught out by the incorrect assumption that any particular value has anything to do with silence. All these samples do is represent a sampled waveform level
– Mark
Jul 3, 2019 at 23:01