Temple Bells

and sines of madness.

In the last two projects sound was “sculpted” with subtractive synthesis —using some basic patterns and tools for filtering frequencies and modulating amplitudes. It was more like working with clay. Molding and pinching. This next approach constructs sound from individual sine waves.

Sine waves are the “atoms” of sound. They are pure frequencies, simple vibrations.

If you want to find the secrets of the universe, think in terms of energy, frequency and vibration. -Nikola Tesla

Sines hold an intimate relationship with right triangles and circles. This makes some intuitive sense as circles are the quintessential symbol of periodic time. The seasons, a watch hand, the cycles of life the rotation of the planets around the sun. A sine itself is the relation between two sides of a right triangle (the hypotenuse and opposite angles), and when this relationship is plotted around the circumference of a circle it produces a wave, beautifully illustrated here.

The cosine in the illustration is the relation between another two sides of the triangle:  the hypotenuse and adjacent angles. The final formula completing the foundations of trignometry is the tangent, or relation between the last unpaired sides of the triangle, the adjacent and the opposite.

Sine and Cosine can be used to plot a rotation around a circle (Sine for the y value and Cosine for the x) and they also underlie important building blocks of nature, like the spiral, which can be created by plotting these same points around an expanding or contracting radius. (So, what’s a tangent good for? With a clinometer app or apparatus, it can determine the height of something that you can see the top of, given the angle to the top and the distance from the base of the thing.)

In the 19th century, Joseph Fourier demonstrated that sines and cosines formed building blocks of all periodic phenomenon. A map for everything that happens in waves or vibrations can be expressed as a composition of these simple relationships. Even gnarly waves. His theorem was crucial to the development of a number of sciences: optics, signal processing, information theory, quantum mechanics and more. If all matter can be expressed as particles and/or waves, as is currently believed, it makes sense such a theorem would have broad application.   1

To get a better feel for how simple sines and cosines can under-wire more complex phenomenon, this project uses a handful of pure sine waves to compose the sound of a bell.

The first pass at this was taking an existing bell sound and looking at its spectrogram, which uses Fourier analysis to break down the frequencies of the sound:

Spectral Display of a Bell Sound

A spectrogram reveals frequencies that are more active over time. It’s indispensable for understanding sound and can be found as a tool in the open-source Audacity program, Adobe’s Audition or the standalone and multiplatform Sonic Visualizer.

From first glance at view above, the bell sound appears to be broken down into a handful of dominant frequencies. In reconstructing sound, the lowest frequency on the bottom of the graph is called the fundamental frequency and the frequencies above it are called overtones and relate to the fundamental frequency in ratios, either harmonically (multiples of the fundamental) or in more complex and fractional ways.

The fundamental frequency of the bell appears to be in the range of 500-700hz, and the overtones at the 1400 and 2100 and 2600 spectra. The 1400 overtone is about the same duration as the fundamental but with slightly less amplitude and the next two, 2100 and 2600 are a bit shorter in duration with quite a bit less amplitude.

The first, simple tool constructed to experiment with additive synthesis generates 4 simultaneous sine waves of selectable frequencies and each has envelope controls for duration and amplitude (as well as attack and decay for a little more control over the shape of the sound volume.) Playing with values within the fundamental and overtone spectra, and emulating their amplitudes with envelopes, can simulate a variety of sounds. Playing with similar ratios to the sample can even create a “family” of bell sounds.

The bell tool can be found here. A short video on how to use it and some results is here. The tool was built with HTML5, Javascript and Web Audio using pixi.js to write the graphics and tone.js to put together the audio graphs.

“Profound study of nature is the most fertile source of mathematical discoveries” -Joseph Fourier

References

Trigonometric Delights by Eli Maor

Notes:

  1. We don’t even have time to get into another amazing application of sines and cosines called Euler’s formula, which physicist Richard Feynman called the “jewel” and “the most remarkable formula in mathematics.”

cutting wind

The last experiment took a block of noise and pounded it into waves on the beach. Wind is much like surf in many ways. But rather than a smooth pulse, wind requires something more erratic. Erratic but not random. A different kind of erratic. Wait, what?!

Yes, there different flavors of chaotic. One flavor was created by Ken Perlin for the original movie “Tron.” It’s a type of bounded randomness rather than careening between extremes with no rhyme or reason. Perlin’s algorithm is popular for generating visual effects with organic textures. It seemed like a good fit for this. (Ken also has a cool online slideshow about how this came about.)

So Perlin noise can (maybe) model the amplitude shifts in a winds natural variation. Better than a simple sine wave oscillation. But wind also shifts frequencies.  Sometimes it sounds like a whistle, other times like guttural sighs and moans. And it frequently contains embedded gusts of more intense sound.

The approach with surf sound was to simply chop off the high frequencies. But wind needs to skip within frequency bands like a flickering flame.

A special kind of filter call the band-pass filter may be useful. It’s one of the prime “sculpting” tools of subtractive synthesis. A little finer blade than the heavy cleaver of the low-pass filter.

A Band-pass filter has a center frequency it filters and a Q value that determines how wide the band is that’s filtered on either side of the target frequency.

So with Perlin controlling the the fluctuation of amplitude and a band-pass filter to slice a frequency for a particular kind of wind, the only thing remaining is the gusts.

For intermittent gusts, the sound will need to be shaped more directly. For this, there’s  another tool in the subtractive toybox called an “envelope” which controls 4 variables: attack, decay, sustain and release. Basically, these control how fast a sound peaks from zero (attack), how fast it drops (decay) to a level it sustains (sustain) and then how fast it drops from there back to zero (release.) With a block of wind-like noise, this should be able to craft a decent gust effect.

The widget created below explores this approach to simulation with controls for all the variables discussed above.

Dials control the band-pass filters frequency and Q value. Play with these to get the right “tone” of wind.

Other dials control the nature of the Perlin noise and a real time graph shows the shape of the resultant waves forming the amplitude of the wind.

The envelope is a set of nodes you can drag to tweak and hit the play button to start a gust of wind at any time into the mix.

This experiment took a little longer than I anticipated. Mainly because I decided to build all the interface elements from scratch. I also skipped the Pure Data sketch and just went straight to code for the audio.

sculpting sound

Sound can be created from scratch –synthesized digitally– in a number of ways. It can be crafted bottom up by combining individual sine waves like blending frequencies of light to create any shade of music, speech or noise. And every sound is a combination of one or more sines. This approach is called additive synthesis.

But sound can also be distilled from complex and chaotic noise by filtering it through virtual prisms, slicing colors off the spectrum from an infinite potential of entropy; this strategy is called subtractive synthesis (and this mixing of sensory metaphors in writing, yeah um, that is known as synesthesia.)

I harbor a suspicion that unshackled from “natural” constraints, a class of stimuli might be discovered foreign to regions of our biology, beyond our brain’s circumscribed exposure in the physical world; stimuli that could trigger insanity, genius, awe or psychosis merely from a brief exposure to its alien imprint. So that’s part of the appeal: learning how to navigate into new territories of sensory experience for their sheer novelty and potential.

And like most explorations here, this one starts with code. In particular, with a visual language called Pure Data used for sound research. Beginning with subtractive synthesis, and arguably the “hello world” of subtractive synthesis, this project is about the simulation of waves on a beach.

The first step is procuring some white noise, which sounds like static and contains a random mix of all audible frequencies, then a different spectra of sound can be created by subtracting a slice and changing amplitudes; it’s the flip side of starting with silence and building sound by adding new frequencies together and tweaking their relative strengths.

The sound of ocean waves is already close to the randomness of noise, due to the vast number of physical forces at work as the water hits the sand and rocks with the tides and the wind and the sun and the sum of energies at play in open seas. So it lends itself naturally to the subtractive approach.

The code below starts by generating white noise and then adds a sine wave of a low frequency (a lfo, or low frequency oscillator), set at 0.05hz, which is one complete cycle every 20 seconds and uses this to control the amplitude (volume) of the noise.  The “lop” is a low pass filter that screens out higher frequency sounds, giving the deeper resonance found in the large currents of the sea and the complete program, expressed in a Pure Data looks like this:

Pure Data program to simulate ocean waves

PD (Pure Data) is great for experimentation, but hard to share unless someone also has Pure Data installed, then they could just load the sketch and run it.

So a second step was converting this PD “patch” to another language native to the web, and browser friendly. I took the opportunity to slap on some dials for tweaking the oscillator and filter values, and added a frequency graph to get a picture of what was happening to the noise visually. And her’s the final widget for experimentation. Have a go, switch it on and play with the dials and see if it can be tuned with just these simple permutations of a block of noise to sound somewhat like a beach. (Closing your eyes and imagining the feel of warm sand between your toes might help too)

See the Pen Surfs Up by Kentskyo (@kentskyo) on CodePen.0

So this was a start, hacking at a chunk of noise. It didn’t really reveal any alien soundscapes, but it’s useful to start by imitating the masters (i.e. nature.)  And it was educational. Next up is hacking noise further for a wind simulation. Writing this up, stumbling around with grammar and constructing gizmos, also gives me a  better understanding and hopefully provides some collateral entertainment.

Resources used in this research track

Technology used

  • Pure Data
  • HTML5 WebAudio and Canvas via Processing P5 and P5.Sound
  • jQuery Knob by Anthony Terrien
  • On/off flip switch from proto.io