问题描述
我喜欢思考一切如何实现并以数字表示.例如,纯文本由类似ASCII的代码表示,图像由RGB值表示.这些是表示文本和图像的最简单方法.
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.
推荐答案
从物理上讲,音频是一种振动.通常,我们是谈论大约20Hz和20,000Hz之间的空气振动.这意味着空气每次来回运动20到20,000次第二.
Physically, as you probably know, audio is a vibration. Typically, we'retalking about vibrations of air between approximitely 20Hz and 20,000Hz.That means the air is moving back and forth 20 to 20,000 times persecond.
如果测量该振动并将其转换为电信号(例如,使用麦克风),您将通过电压以与声音相同的波形变化.用我们的纯音假设该波形将与正弦函数的波形匹配.
If you measure that vibration and convert it to an electrical signal(say, using a microphone), you'll get an electrical signal with thevoltage varying in the same waveform as the sound. In our pure-tonehypothetical, that waveform will match that of the sine function.
现在,我们有一个模拟信号,即电压.仍然不是数字.但我们知道此电压在(例如)-1V和+ 1V之间变化.我们可以当然,将电压表连接到电线并读取电压.
Now, we have an analogue signal, the voltage. Still not digital. But, weknow this voltage varies between (for example) -1V and +1V. We can, ofcourse, attach a volt meter to the wires and read the voltage.
我们将任意更改电压表的刻度.我们会多重以32767伏为单位.现在称为-1V -32767 和+ 1V 32767 .哦还有它将四舍五入到最接近的整数.
Arbitrarily, we'll change the scale on our volt meter. We'll multiplethe volts by 32767. It now calls -1V -32767 and +1V 32767. Oh, andit'll round to the nearest integer.
现在,我们将电压表挂接到计算机上,并指示计算机执行以下操作:每秒读取仪表44,100次.添加第二个电压表(用于其他立体声通道),我们现在有了音频上的数据CD.
Now, we hook our volt meter to a computer, and instruct the computer toread the meter 44,100 times per second. Add a second volt meter (for theother stereo channel), and we now have the data that goes on an audioCD.
此格式称为立体声44,100 Hz,16位线性PCM .确实是只是一堆电压测量值.
This format is called stereo 44,100 Hz, 16-bit linear PCM. And it really isjust a bunch of voltage measurements.
这篇关于音频在计算机中如何用数字表示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!