Simulating cymatics

Due to popular demand I put the source for the script I used here up to github: https://github.com/kai5z/Chladni-patterns

I was browsing around youtube when I stumbled upon this nice video on Chladni patterns (there are quite a few there). Here’s the video, it’s apparently part of some demonstration for students:

Cymatics

Sound propagates in solids, similarly as to how it does in air. If we were to slow down the plate in the video above, we would see it vibrating at the frequency of the sound you can hear being played (check another post of mine).

Just as is the case in air, standing waves can form in solids. In solids, the details are quite different, but the basic principle holds. When a standing wave forms, there are locations where the amplitudes of the vibrations have their maximum values, and locations where the amplitudes of the vibrations are very close to zero.

Imagine placing a lot of small particles on the surface in the image. The particles would be tossed around, until they finally find a resting place close to the red circle. This is how all of the patterns are formed, but the way the plate vibrates varies with frequency.

Simulating cymatics

The experiment setup is very clearly defined; a rectangular steel plate is clamped in the middle. This makes for a perfect case to test out some finite element analysis of plate structures!

I used steel as the material of choice for the simulation and Reissner-Mindlin bilinear plate elements, with a lumped mass matrix. I programmed the simulation using Python. By tweaking around with the material properties and dimensions, I managed to roughly match the frequencies to the experiment from the first video. I think it’s really cool how the simulation matches the patterns you can see in the video (up until a point where it’s apparent that there are some asymmetries in the setup).

I made a gif out of the video too, just for the hell of it.

You might have noticed that there are a whole lot of patterns there, which aren’t visible in the video. The standing waves which create the patterns form much more strongly when the frequency is closer to the modal frequencies of the plate (when the plate resonates). The following plot roughly shows these resonant frequencies. The y-axis doesn’t really mean anything significant here, so just pay attention to the peaks. Also, damping hasn’t been taking into account here, making the peaks unrealistically sharp. When the excitation frequency is close to one of those peaks, Chladni patterns should be clearly visible.

Discussion

The frequencies these patterns form on depends completely on the material properties and dimensions of the plate, if we assume that the basic setup is the same (a rectangular plate is clamped at the middle). There are a lot of structures which can be analysed in a similar way (albeit with a more complex analysis for applicable results): floors, windows, doors, the list goes on and on. In this case, the results were very consistent with the video as the physical problem was very clearly defined.

Using beam tracing to calculate reflections in JavaScript

I have been researching beam tracing for a project of mine for a while now. Beam tracing is a method for calculating reflection paths. I won’t go into any details of how beam tracing works, as this is something you can find on google in case you’re not familiar with it.

My first attempt at beam tracing was made in Python, about a year ago. I made an algorithm that worked in 3D, but it became exceedingly complicated as I worked on it (mostly related to occlusion and clipping). As it turned out, I was overcomplicating things. The paper “Accelerated beam tracing algorithm” by Laine et al. served as an excellent introduction into how basic beam tracing should be done: as simply as possible. To get a better understanding of the paper, I decided to try to implement some of the very basics in 2D using JavaScript.

The result

Open simulation

Click to place the source, the specular reflections are updated automatically as you move the mouse around. Note that reflections are only calculated up to a certain limit (theoretically there are an infinite amount of reflections).

Firstly, it should be noted that I only utilised the very basic ideas presented in the paper in my implementation (beam trees and accelerated ray tracing). I only wanted to spend a few days on this, which means that there are probably a lot of things which could (and should) be optimised. I spent most of the time pruning out bugs, which at times were very hard to find. I also pushed the MIT-licensed source code to Bitbucket, in the hopes that someone might think of something useful to do with 2D beam tracing in JavaScript!

Airborne sound insulation

I thought it would be cool to demonstrate some of the vary basics behind airborne sound insulation using a finite element simulation. This is also something I’m planning on utilising in real projects (i.e. it’s not just for playing around with).

Some background

Let’s assume that we have two rooms with nothing but a small piece of wall between them. The rooms are perfectly separated from each other, they’re connected by nothing but this one piece of wall. This means that the situation is analogous to laboratory measurements (i.e. when measuring the sound reduction index R, or the single-number quantity Rw). Situations on the field are different from the situation described here, as flanking transmissions are not taken into account in laboratory measurements.

Let’s also assume that this simple, homogenous piece of wall is perfectly sealed. It’s modeled as simply supported (we’re allowing for rotation on the boundaries) in 2D.

I’m not going to go any deeper into the material parameters I used here, but here’s some background on the theory:

• The simulation is done using a Timoshenko model for the piece of wall (taking shear locking into account using reduced integration).
• I used linear shape functions for both the fluid and beam domains.
• The bottom boundary is completely absorbing.
• There are two completely separate fluid domains, which are both coupled to the piece of wall in the middle.
• I did the simulation in python, and exported the results to a binary file which is read by the javascript viewer below.

Simulation 1

http://kaistale.com/blog/131125coupling/viewer.html

The simulation is a bit heavier than in the simulations I’ve usually posted, as I had to use more elements to get a nice looking result. Here’s a very short summary of what’s happening:

1. A sound wave travels in the lower room.
2. The sound wave arrives at the wall.
3. The sound wave consists of positive pressure (as compared to the surroundings and other side of the wall), and will as such exert forces on the wall.
4. The wall will deform as a consequence of the force. Note that the deformations of the wall are exaggerated in the visualization!
5. As the wall deforms, it moves the air above it, creating new sound waves.

Simulation 2

I also made the following simulation, which is more complex and more difficult to understand, but looks way cooler. I especially like it that you can see the sound moving faster in the wall than in the air when the first wave hits the wall (compare the sound waves below the wall to the sound waves above the wall).

Note:  I switched the colors, here red represents a positive sound pressure. Also, the wall is clamped (rotation isn’t allowed at the ends of the wall).

http://kaistale.com/blog/131126coupling/viewer.html

Epilogue

The most important thing to note is that when you’re hearing sound through the wall, as in the simulated situations, what you’re hearing are the deformations of the wall. It’s the wall that radiates sound into the room. If the wall wouldn’t move at all as a consequence of the pressure waves hitting it, you wouldn’t hear anything. This is why heavy structures, such as concrete, isolate sounds so well.

The situation becomes a whole lot more complicated with separated structures (i.e. light structures or drywall), and when flanking is taken into account. Measuring the sound reduction index with a diffuse sound field is another interesting task I’ll definitely have to do. I’ll most likely return to these topics in later posts. 🙂

Comb filters in acoustics

In this post, I’ll use a feedforward comb filter to explain interference between two sources at some specific location.

The comb filter shows the frequency response of the system. If we have two sources emitting the same signal in space, they will attenuate and amplify certain frequencies at some location according to the frequency response of the comb filter.

The simulation

The red dot represents an ideal microphone in space. Click anywhere inside the simulation to move the sources and the microphone around (you need to click in three separate locations). You can adjust the frequency of the sources using the slider to the right.

http://kaistale.com/blog/131004comb/comb.html

How it works

The simulation is done using WebGL shaders, which makes the simulation run really smoothly. The two sources are summed for each pixel in each frame, which gives a nice visual representation of their interference in a 2D plane.

The simulation has the following properties:

• The sources have identical phases and frequencies.
• 2000 seconds in the simulation represents 1 second.
• The size of the box is 1 meter by 1 meter.
• The sound sources are modeled as cylindrical waves, as per $$\frac{A}{\sqrt{r}}\mathrm{cos}(kr\pm\omega t)$$, with $$A = 1.0$$ for both sources.
• The initial delay from the nearer source is left out of the diagram of the comb filter, but it could be added without any change in the magnitude of the response.
• The frequency response for a point is calculated directly from the frequency response of the depicted comb filter.