声音 – 巴尔托什·切哈诺夫斯基
Sound – Bartosz Ciechanowski (2022)

原始链接: https://ciechanow.ski/sound/

声音是振动物体扰动空气分子时产生的压力波。这些粒子随机运动并碰撞,但扰动会以压缩区和稀疏区的形式在它们之中传播,最终到达我们的耳朵。频率决定音高;振幅决定响度;波形决定音色。复杂的振动可以通过傅里叶分析分解为正弦波。弦、膜和空气柱以谐波振动,塑造出音乐声音。声音以有限速度传播,随距离而减弱,并以分贝(SPL)衡量。它可以反射、干涉、产生拍音,并通过多普勒效应改变音高。归根结底,音乐和噪声是同一种物理现象:空气中微小而有组织的压力变化。

Hacker News 最新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 声音 – Bartosz Ciechanowski (ciechanow.ski) 16 分 由 dverlaeckt80 发布 1 小时前 | 隐藏 | 过去 | 收藏 | 1 条评论 帮助 StrLght 1 小时前 [–] (2022) 回复 考虑申请 YC 的 2027 年冬季批次! 申请 开放至 11 月 2 日。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Invisible and relentless, sound is seemingly just there, traveling through our surroundings to carry beautiful music or annoying noises. In this article I’ll explain what sound is, how it’s created and propagated.

Throughout this presentation you will be hearing different sounds, which you will often play yourself on little keyboards like the one below. You can either click its keys with your mouse or use WER keys on your computer keyboard, but before you do so make sure your system volume is at a reasonable level:You can press its keys with your fingers, but before you do so make sure your system volume is at a reasonable level. You may also need to unmute your device:

We’ll eventually understand how these sounds are created and how they get to your ears, but we have to start by talking about the medium that is most commonly associated with sound – air.

You’re probably aware that at microscopic level air consists of individual, tiny particles. Let’s look at the behavior of those molecules up close. In the demonstration below, I parceled out a tiny cube of air – notice how the molecules freely enter and leave this space. You can drag the cube around to change the viewing angle and you can also control the speed of the flow of time with the slider:

I need to note that this visualization simplifies things a little. The air consists primarily of nitrogen and oxygen – their particles contain two atoms bound together, but for simplicity I’m drawing all molecules as simple spheres.

Each particle of air travels through space with some velocity in a more or less random direction. While some molecules are faster, and some are slower, at room temperature the average velocity of a particle is a staggering 1510 ft/s460 m/s so to make the particles visible I’m showing their motion significantly slowed down. As a side note, I’m using imperialmetric units here, but you can switch to the metricthe imperial system if you prefer.

With all the commotion in the previous simulation it may have been hard to see that the air particles collide with each other. In the demonstration below, I’m flashing the particles red and making them a little bigger right after they collide. To make these events easier to see you can control the speed of time with the slider:

Naturally, those particles can also collide with other things in the environment. In the simulation below I put up walls around that parcel of air. While at this scale we could also see the individual atoms constituting the walls of the box, I’m not showing them here to make things clearer. The particles of air are bouncing off these sides and every time that happens I’m drawing a little blue glow on the wall:

When an air particle bounces off, it imparts a small force on the wall. Although a single collision doesn’t do that much, with enough particles present the walls experience a constant barrage of collisions which exert expanding pressure on the container. The magnitude of that pressure is the sum of all these forces of impacts divided by the area of the box. Intuitively, for a box of a fixed size, the more particles there are, the heavier they are, and the faster they move, the higher the pressure.

Let’s see what happens if we resize this box a little while keeping the number of particles constant. In the demonstration below, you can drag the slider to change the length of the box, the plot in the bottom tracks the number of collisions per area of the box in a unit of time:

The number of collisions per area, and thus the pressure, increases as we squeeze particles closer together, and it decreases as we let them loose. Remember that we’re observing a significantly slowed down simulation. Because of the speeds involved here, I’m only letting you resize the box at a limited pace. That limitation prevents the walls from moving at enormous speeds, which would create some truly extreme pressure conditions.

It may not be immediately clear, but the experience of pressure is not limited to the walls of the box we built. Molecules in any open region of gas also experience compressing forces exerted by collisions with molecules from the neighboring regions. Those collisions aren’t as neatly aligned in space, but in aggregate it makes no difference if particles are bouncing off a wall or off particles from the neighboring area – the pressure is still there.

All the collisions between particles also have other consequences, but to look at them I need to adjust the scale at which we’ll be looking at – you can do this with a slider below:

The small cube of air from the previous demonstration is now just part of a larger volume. While this large cube is 20 times larger in each dimension, its sides measure only 1 micrometer – a few times smaller than a width of spider silk. Unfortunately, it would be both chaotic to display and taxing to correctly simulate the over 26 million air particles that one could find in this area. Instead, I’ll just visualize the motion of a single molecule as it travels through this space. In the demonstration below, I enlarged that particle to make it visible, you can also control the flow of time with the slider:

Due to collisions with other molecules, it may take a while for this particle to travel a significant distance and get out of this larger volume. You probably experienced this yourself – when someone sprays perfume in a distant part of a room the scent doesn’t instantly get to you. It’s only after some lucky aromatic particles manage to bounce into the vicinity of your nose that you get to experience the smell. If it wasn’t for the collisions with other molecules, those fragrant particles could travel the distance to your nose in a fraction of a second.

The important point is that, while the air particles move very fast, the collisions with other particles keep them mostly contained inside their local area. Over a longer period of time they will eventually all mix up, but at the short timeframes we’ll be interested in here, each reasonably sized parcel of air contains mostly the same particles.

All the microscopic behavior of individual particles we’ve observed ends up contributing to properties of air at larger scales. From this point on, we’ll move past looking at individual molecules and instead we’ll focus on regions of air that more closely match the sizes we’re used to. Those particles are still there, and they’re what actually end up distributing changes in gases, but we need to aggregate a huge collection of the molecules to end up with more discernible motions.

Let’s witness some of this large scale behavior when a section of air in a tube gets pushed on by a moving plate. In the demonstration below, I divided the air next to that circular plate into individual slices, which I’m drawing with thin lines. Although these boundaries are imaginary, they let us see what happens to different sections of air as you move the plate around with the slider:

Notice that the individual parcels of air move only a little from their initial position, but the disturbance caused by the motion of the plate seems to propagate through them with some speed. Moreover, that disturbance moves away from the plate regardless of the direction of the plate’s motion.

If you recall our experiment with a resized cube of air having more or less available space, you’ll notice that a very similar situation happens here inside each slice – this tells us that we’re witnessing some changes in pressure.

Let’s look at this situation from the side, which will make it easier to see how these pressure changes propagate. In the following demonstration I’m coloring each slice of air red when it’s compressed and the pressure increases, and I’m coloring it blue when it’s expanded and the pressure decreases:

When the plate moves to the right, it compresses the air particles in its vicinity, which increases the pressure in this region. Those particles then push and expand into particles in the neighboring slice of air, which then push onto the next slice and so on. All of this results in an area of higher pressure propagating away from the plate.

On the flip side, when the plate moves to the left, it creates an area of depletion, or rarefaction, which the neighboring slice of air rushes to fill in. This then reduces the pressure in the vicinity of the next slice and so on. While the slices move towards the receding plate, the pressure disturbance still moves away from the plate.

What we’ve just seen more clearly were pressure waves propagating through the air. When those pressure waves reach our ears we perceive them as sound. By moving the plate we’ve effectively created a very crude speaker that emits sounds as its moving element changes position.

While this simple demonstration helps to build an intuitive understanding of the propagation of pressure waves, the relation between the vibration of the object and the pressure disturbances it generates is much more complicated. We’ll soon explore some of those details, but for now we’ll focus on the relation between the movement of that vibrating element and the sound it produces.

Let’s begin by introducing a simple musical instrument. By pressing a key down, you can request the plate to rapidly change its position. When you let that key go, the plate will move back by the same amount. Notice that each of the three keys moves the plate by a different amount, with red marker showing the total offset:

Despite its simplicity, this device lets us observe a few things. Firstly, a sudden jump of a plate creates a popping sound. It also doesn’t matter if the object has jumped forwards or backwards – the effect sounds the same.

Secondly, the loudness of that pop depends on the magnitude of the jump – the larger the jump the louder the pop.

Finally, this plate can jump forwards or backwards from any position – you can verify this by holding one of the keys and then pressing some other key. That pop sounds exactly the same as the sound created by a standalone key press.

Three pops of different loudness is not much to create music with as this only lets us play some simple beats. You may have tried pressing the buttons as fast as possible to create more upbeat tunes, but there are limits to how fast human fingers can press buttons.

Thankfully, we can ask the device you’re using to repeat the pops at a certain rate. In the demonstration below, you can drag the first slider to change how many times per second the plate should jump forwards and backwards. You can also control how far the plate moves with each jump using the second slider:

To describe the frequency of vibration, I’m using the unit of hertz, often abbreviated as Hz – it describes how many full cycles of motion happen within a single second. For example, a frequency of 2 Hz means that two full cycles happened in a second which means that the plate moved back and forth and back and forth again.

While at lower frequencies these patterns sound like a rapid series of pops, at higher frequencies these sounds blend together into a discernible note. The most important observation we can make here is that the higher the frequency with which the plate vibrates, the higher the perceived pitch of the resulting sound is.

You’ve probably observed that at lower rates you could follow the motion of the vibrating plate, but as the frequency increases, it becomes impossible to reliably track its movement. Unfortunately, we’re hitting the limits of frequencies we can easily display on a screen and perceive with our eyes, so from this point on I’ll significantly slow down the motion of the plate. The patterns of motion will still be correct, they’ll just happen at a much slower pace so that we can actually see what’s going on.

With that in mind, let’s make our music synthesizer create those very frequent jumps of the plate. We’ll assign a different frequency to each key – you can see them displayed above the keys. I’m also drawing three plots corresponding to each key, and an additional plot showing the cumulative effect of the individual motions.

These plots, or waveforms, represent the motion of the plate as requested by the keys. As the plots pass through the center line they reflect the current position of the plate, but remember that the motions we see here are a few hundred times slower than the actual ones:

Notice that when you press two keys at the same time you can still hear both sounds playing through – we’ve already seen that the final plate movement is just the sum of individual motions that each key requests.

You may also have realized that I’ve shifted the center line of the plate. What we consider a base position of that object is ultimately arbitrary. The keys simply request the plate to move forward or backward and they don’t care from where it’s starting, but having the object oscillate around a well defined origin will be more convenient.

If you look closely at the plots when two keys are pressed, you may have also noticed that there are some areas where one of the keys wants the plate to move forward, while the other wants it to move back. As a result, the plate stays at the same position.

What may be a little surprising is that there is nothing magical about the sound emitted by the plate when two keys are pressed – the emitted sound depends purely on the final movement of the plate. In the demonstration below, I made the third key emit the same pattern of motion as the combination of the first two:

The sound emitted when the third key is pressed is exactly the same as the sound emitted when the first two keys are pressed together. This is a very important observation, as it lets us explore some other patterns of motion that the keys could induce.

We’ll expand on this idea by changing the way in which the plate vibrates. Instead of having it rapidly jump back and forth, we can request the plate to move with constant velocity, following a triangular pattern. Let’s look at that pattern up close. Like other periodic shapes, a triangular waveform can be characterized by its amplitude, frequency, and phase:

In these visual examples the amplitude controls the height of the waveform. The frequency controls the width of the repeating pattern, which affects how many repetitions of the up-and-down triangles can fit inside a single second. The phase just shifts the shape around to change what we consider the beginning of that pattern.

We’ve already seen how the amplitude of the plate’s motion affects the perceived loudness, and this triangular motion is no different. In the demonstration below, all three keys move the plate in the same pattern, only their amplitude is different:

Similarly to the original rectangular pattern, we perceive different frequencies of this triangular motion as different pitches. In the following demonstration, each key has a different frequency as marked by the display in the upper part of the keyboard. The higher the frequency the higher the perceived pitch:

With these more complicated triangular shapes in place it may be a bit harder to understand how all these waveforms add up to form the final plot. Let’s visualize this process step-by-step using a few examples that you can select in the demonstration below. The slider tracks the process of the addition of four different triangular shapes of different amplitude:

Notice that each waveform expresses some shift from the current position. This offset can be positive or negative – I’m visualizing it using small arrows. To add the waveforms we just need to apply these arrows to the existing shape, which we can do by placing the arrows on that shape and then deforming the shape as the arrows demand.

The yellow bars in the bottom part symbolize the amplitude of the specific triangular waveforms at different frequencies. Notice that it’s completely fine for an amplitude to be zero – that element just won’t participate in the creation of the final cumulative waveform.

The last parameter of any periodic function is phase. On its own, phase doesn’t do much for sound, but it may give us some trouble when a phase-shifted shape is combined with another shape of the same frequency. In the demonstration below, all three keys of our synthesizer vibrate at the same frequency and amplitude, but each one is shifted in phase by a quarter of a cycle:

Individually, each of the three keys sounds exactly the same, but once we combine the keys the trouble begins. When the middle key is combined with the left or the right key, the resulting sound is slightly louder. However, when the first and last keys combine, their waveforms perfectly cancel each other out causing no plate movement – no sound gets emitted! We’re experiencing a destructive interference where the peaks of one waveform end up getting cancelled out by the valleys of the other waveform.

Triangular functions were a little more intricate than simple jumps, but nothing prevents us from using completely arbitrary motions. In the top part of the demonstration below, you can draw your own shape of the waveform that defines the vibration of the plate. I then repeat this pattern at frequency prescribed by each keyboard key, letting you hear the result through your speakers:

After playing with different shapes you may have noticed that while they have a different character, they all share a very similar pitch. Different shapes end up creating different timbre which is a property of sound that lets us distinguish different instruments playing the same note.

So far we’ve been building waveforms of increasing complexity, but it’s time we reversed this direction by discussing sinusoidal waves, which form the most fundamental periodic functions.

Let’s try to create a sine wave from scratch. In the demonstration below, you can witness a rotating circle with a small red point marked on it. If we track the vertical position of that point over time we’ll draw a perfect sine wave. While we can assign amplitude, frequency, and phase to any other periodic function, those properties beautifully correspond to radius, speed, and initial angle of the rotating circle that generates this wave:

Let’s see how a sinusoidal vibration of a plate sounds. In the demonstration below, you can experience the whole range of sine waves with different frequencies and amplitudes playing through your speakers. Some of the tones are expected to be imperceptible, so do not adjust your sound volume until you reach the middle frequencies:

You’ve probably noticed that low frequencies start inaudible, and they increase in loudness as the frequency increases. However, as the frequencies go toward the higher end the sound fades away into silence. Although your speaker and audio settings may to some extent contribute to this effect, it’s otherwise perfectly natural – humans can hear in a limited range of frequencies and the perceived loudness changes with frequency.

In the physical world, these pure sine tones are easily generated by striking different tuning forks, but on this website we have to resolve to making our synthesizer play some of these notes at different frequencies:

Once again, as each key requests the plate to vibrate in a certain way, its final motion is the sum of those individual requests. That addition can sometimes create unexpected effects when the frequencies of played sounds are close to each other, which you can experience in the demonstration below. Notice the frequencies of sounds as shown above the keyboard keys:

When you press two keys at the same time you’ll hear the volume of sound increasing and decreasing in a phenomena known as beats. It’s not your ears misleading you – it’s a real effect caused by the two original frequencies interfering with each other, which you can observe on the plots. This effect can happen with all periodic signals and you can sometimes hear it when sitting in an airplane – the rotation speeds of two engines may not be perfectly synchronized and you can hear the variation in slowly changing volume of the resulting sound.

Similarly to triangular waves, we can fairly easily visualize how the addition of multiple sine waves with different amplitudes, frequencies, and phases creates more complex shapes. In the demonstration below, I’m adding a bunch of these sine waves. You can use the control below to choose the shape we’re creating:

Observe that I’m also using a “special” sine wave with frequency of 0 Hz – it reflects a constant value that is useful to represent waveforms that are, on average, not centered around the baseline. Looking at the construction of these waveforms, we can easily reason that the final shape is actually created by 6 different sine waves with varied amplitude, frequency, and phase.

Instead of adding these sinusoidal basic blocks to create a complicated function, we can, perhaps surprisingly, invert this process and decompose any repeating waveform into its constituent sine waves. Let’s see this in action. In the demonstration below, you can draw the desired shape in the top part and I’ll do my best to express it using the sum of 64 sine waves with increasing frequencies. For clarity, I’ll skip the animations of green and red arrows being added:

In the bottom part I’m once again showing the amplitudes of individual sine waves creating the final shape, but since we have so many of them I just pack their amplitude bars next to each other to create a cumulative plot of amplitudes.

Depending on how the original signal is expressed, this method of decomposing periodic functions into sines is known as Fourier series or Fourier transform. It lets us deconstruct a waveform expressed as a function of time into a waveform expressed as a collection of individual frequencies that are contained in that waveform.

We can look at any repeating pattern either as a collection of individual values over time or as a collection of distinct sine waves that add up to the same pattern. Both views represent the same shape, they just present it in a different way.

In general, Fourier transform provides us with both amplitude and phase of each contributing sine wave. As we’ve seen, however, human hearing is almost completely agnostic to phase shifts so amplitudes typically provide enough information to express the original shape.

Let me bring in the little waveform decomposer once more, this time I’ll fill it with a square function corresponding to the simple back-and-forth jumps that our plate did initially:

As you drag the slider to the end you’ll notice that the decomposition of a waveform that rapidly changes values ends up creating ripples in the recreated function in an effect known as Gibbs phenomenon. Notice, however, that as we add more sines of high frequency the width of that ripply region decreases.

More importantly, this square pattern that repeats once per second contains in it many sine waves of much higher frequencies. This explains why we were able to hear a plate jumping back and forth once per second – while we can’t hear many of those lower frequencies, we can hear the higher pure tones. A sine wave at 1Hz frequency contains only a 1Hz signal that we can’t hear.

Let’s look at the frequency spectrum of the things in your environment. In the demonstration below, you can press the button to start using your microphone. I’ll then draw a plot of different frequencies and their amplitudes as heard by the device:

联系我们 contact @ memedata.com