Sound

By Martin McBride, 2018-07-17
Tags: computer music analogue sound
Categories: computer music sound synthesis

The ultimate aim of computer music is to create actual sound in the real world. So let's start by looking at what sound actually is.

What is sound?

A sound is created whenever anything disturbs the air around it. A twig snapping, a gong being struck, a note being played on a violin, all cause the surrounding air to move. This creates a variation in pressure that radiates out as a sound wave.

The effect is rather like throwing a pebble into a pond and watching the ripples radiate outwards. In the case of sound, the waves are not circular, they are three dimensional spheres that expands outwards from the source, travelling at the speed of sound, which is about 340 meters per second, or 760 miles per hour. The speed varies slightly depending on conditions such as air temperature, pressure and humidity.

Complexity of real world sound

In the real world, your senses will often be met with several sound sources, located in different places, each emitting their own stream of sound waves.

For example, a full orchestra might have a hundred different instruments, all around the stage, each creating their own different and interesting sounds.

But it is actually even more complex than that, because sound reflects. If you stand in a mountain range and shout, you will hear an echo coming back - the sound reflected back off the side of a nearby mountain. The same happens in a concert hall - the sound bounces off the walls, ceiling and floor, perhaps many times. Concert halls are actually designed to make that happen, that is what we mean when we say that a room has good acoustics. It makes the sound wonderfully full and rich.

If you could actually see the sound waves when and orchestra is in full flow, with a hundred sources of sound and a thousand reflections, it would be a complex and beautiful sight! But how can a computer program replicate that?

How we hear

One thing that makes computer sound slightly less daunting is the fact that we can only hear the sound that enters our two ears. Specifically, we mainly detect sound waves that hit our eardrums (a small membrane in each ear that transmits sound from the air to the inner ear).

This means that we can create something like the sound of a full orchestra (or any other type of music) using a pair of headphones or two (or more) speakers. We can even simulate the effect of sounds being reflected, by applying echo or reverb to the sound. It won't sound exactly like being in the concert hall, but it can be a reasonable approximation.

The cochlea, in our inner ear, is the part that actually senses sound. It contains a large collection of hair cells, each of which responds to a narrow range of frequencies, and sends a signal to the brain based on the loudness of that particular frequency - our ear hears sound as a collection of frequencies rather than as a single "sound wave". A normal human ear can detect frequencies between 20Hz and 20,000Hz. Our ears are less sensitive to higher frequencies, so as a sound approaches 20,000Hz it will get quieter and quieter until we can't hear it at all. As we get older, we tend to lose the ability to hear very high frequencies.

At lower frequencies something slightly different happens. Consider an electromechanical buzzer, a simple device that makes a click sound each time you apply a pulse of electricity. If you make it click 30 times a second, you will hear a continuous buzz. If you make it click 10 times a second, you will here the individual clicks. The transition from hearing a buzz to hearing separate clicks happens at about 20Hz.

See also

Sign up to the Creative Coding Newletter

Join my newsletter to receive occasional emails when new content is added, using the form below:

Popular tags

555 timer abstract data type abstraction addition algorithm and gate array ascii ascii85 base32 base64 battery binary binary encoding binary search bit block cipher block padding byte canvas colour coming soon computer music condition cryptographic attacks cryptography decomposition decryption deduplication dictionary attack encryption file server flash memory hard drive hashing hexadecimal hmac html image insertion sort ip address key derivation lamp linear search list mac mac address mesh network message authentication code music nand gate network storage none nor gate not gate op-amp or gate pixel private key python quantisation queue raid ram relational operator resources rgb rom search sort sound synthesis ssd star network supercollider svg switch symmetric encryption truth table turtle graphics yenc