Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is audio represented with numbers in computers?

Tags:

audio

I like thinking about how everything can be and is represented by numbers. For example, plaintext is represented by a code like ASCII, and images are represented by RGB values. These are the simplest ways to represent text and images.

What is the simplest way that audio can be represented with numbers? I want to learn how to write programs that work with audio and thought this would be a good way to start. I can't seem to find any good explanations on the internet, though.

like image 749
Paige Ruten Avatar asked Apr 09 '09 03:04

Paige Ruten


People also ask

How is audio represented in computer?

Representing sound Sound needs to be converted into binary for computers to be able to process it. To do this, sound is captured - usually by a microphone - and then converted into a digital signal.

How is audio data represented in digital form?

An audio file format is a digital container format for storing audio data on a computer system. In general a codecl (compression-decompression algorithm) is used to encode and decode a digital data stream. Codecs can be used for audio, video and any data that is streamed.

What represents audio data?

Audio Data is Amplitude and Frequency It turns out that there are two important types of numbers: amplitude and frequency. The amplitude of a sound wave shows its volume. The frequency of a sound wave represents its pitch.

How is analog audio signal represented by a computer?

Which of the following best explains how an analog audio signal is typically represented by a computer? An analog audio signal is measured at regular intervals. Each measurement is stored as a sample, which is represented at the lowest level as a sequence of bits.


1 Answers

Physically, as you probably know, audio is a vibration. Typically, we're talking about vibrations of air between approximitely 20Hz and 20,000Hz. That means the air is moving back and forth 20 to 20,000 times per second.

If you measure that vibration and convert it to an electrical signal (say, using a microphone), you'll get an electrical signal with the voltage varying in the same waveform as the sound. In our pure-tone hypothetical, that waveform will match that of the sine function.

Now, we have an analogue signal, the voltage. Still not digital. But, we know this voltage varies between (for example) -1V and +1V. We can, of course, attach a volt meter to the wires and read the voltage.

Arbitrarily, we'll change the scale on our volt meter. We'll multiple the volts by 32767. It now calls -1V -32767 and +1V 32767. Oh, and it'll round to the nearest integer.

Now, we hook our volt meter to a computer, and instruct the computer to read the meter 44,100 times per second. Add a second volt meter (for the other stereo channel), and we now have the data that goes on an audio CD.

This format is called stereo 44,100 Hz, 16-bit linear PCM. And it really is just a bunch of voltage measurements.

like image 97
derobert Avatar answered Oct 03 '22 15:10

derobert