Category Archives: Composition

The limits of Human Hearing II

Yesterday, we looked at sounds near the bottom of human hearing and found a lot of water. Today, we’ll look upwards. Who knows what elements we’ll find?

As you may recall, we started with a sine wave at 100Hz:

To me, this sounds almost like your canonical computer generated sound, something you might hear in a hearing test, or at the Science Center in the 1980s.

Let’s go up an octave to 200Hz:

Same kind of feel, a little higher, feels a little louder (probably again because of ‘equal-loudness contours‘).

Now, 400Hz:

This is starting to get into painful territory for me (at least through headphones).

800Hz:

This is starting to sound like an alarm.

Warning: We’re now getting into sounds that might start hurting or make your ears ring. I recommend that if you’re going to play these, that you play them at low volume first, and step them up in volume slowly.

1600Hz:

This is most definitely an alarm sound. About 2.5 octaves above middle C, it is above the normal soprano range, and therefore might reasonably be normally interpreted as an exclamation/scream, or alarm by early humans.

3200Hz:

An alarm, or medical beep.

6400Hz:

Many people would find this painful. I don’t think pitches this high are used for very much at all[1]. Probably only in movies to show a painful sound. (My right ear rang briefly after playing this sound.) It also sounds like we’re starting to reach the limitations of 44100Hz[2] sampling, as you will probably be able to hear the distortion in this clip.

12800Hz:

This is getting into the range of where humans might stop being able to hear things. It sounds (to me) like something out of place, or ear ringing (which is happening right now after playing it)[3].

25600Hz:

We’re now probably above what we can reproduce with 44,100Hz sampling. This sound seems to be inaudible at normal volumes, but when you turn it up, you’ll hear something very high-pitched, probably a lower (but still high) pitch caused by aliasing.

51200Hz:

We should not be able to hear anything here, due to it being above the sampling rate. I hear it as a loud sound a major third above the (quieter) 12800Hz .wav above. This suggests that the aliasing is producing a pitch of around 16,000Hz, which is about 1/3, or an octave and a fifth lower than the 51200 we attempted to make. (It still hurts, though.)

Next time, we’ll look at some different-shaped waveforms. Stay intuned!

[1]We’re talking about the fundamental frequency in a constellation of frequencies. I’m sure that 6400Hz occurs often, but there are generally lower pitches which it helps ‘fill out’.

[2]44,100Hz is one of the standard sampling rates, apparently chosen for Compact Discs by Sony in the Red Book standard. The article also mentions that 44,100 was chosen for Nyquist Sampling reasons to be >2x the commonly accepted threshold of human hearing (20kHz), plus a guard band for low-pass filtering. Also, for those of you who love prime factors and easy divisibility, 44100 = 2*2*3*3*5*5*7*7.

[3]Is it sympathetic? Is it because the ears or processing mechanisms are now expecting it? Are guarding against it?

The limits of Human Hearing I

Now that we’ve generated a .wav file from our sine wave, let’s take a look at some of the limitations of music as it’s written for the human ear[1].

We’ll start with the low end of human perception.

As you may recall, last time, we made a 100Hz sine wave:

This is near the bottom of what most humans can hear (and close to the bottom of what I can sing), but there’s still plenty of room to explore.

One octave down, we have 50Hz:

This is as low as I can comfortably hear (and sing!). Below this, for various reasons, things get much quieter[2] and more difficult to produce.

25Hz:

At normal volumes (halfway up on my laptop) sounds quite soft, but still audible. At louder volumes, it sounds like something you might hear in the 8-bit audio of a game from the early ’90s, perhaps in a dungeon to tell you something is oozing out of the wall.

12.5Hz:

To me, this is inaudible at normal volumes. At high volumes, it feels like what gargling would sound like in an 8-bit world.

6.25Hz:

At normal volumes, still inaudible. At high volumes, almost like water.

3.125Hz:

If the previous one sounded almost like water, this is the real deal. Still inaudible (as you would expect) at normal volumes.

1.0675Hz:

I totally did not expect to go this low in frequency. This sounds perhaps even more like water at high volumes. I wonder why all of these do. Maybe it’s some other effect unrelated to the actual frequency of the sinewave, perhaps waves (and water) do actually make sounds at such low frequencies, or those low frequencies make secondary effects/harmonics at high amplitudes.

Next time, we’ll look at the high end of human hearing. Stay tuned[3]!

[1]I’m leaving out discussion of making music to be felt by other parts of the body, although that is probably a large part of why dance clubs are so popular. We could also talk about different species, using devices, perhaps mediated human listening to music, but that is outside of scope.

[2]I had assumed it had to do with the amount of energy being transmitted being non-linear with the frequency, but apparently it has more to do with human hearing. ‘Equal-loudness contours‘ will show you the way.

[3]Hee.

If you wish to make a song from scratch, you must first Invent the Universe…

To write some music, you must first invent some instruments. To do this, one might start with a simple sine wave, then do modulations and superpositions to make various ‘instruments’.

To this end, I did a little bit of research (thanks, soledadpeandes!), and put/cribbed together some python code to make arbitrary .wav files:
# Written 2016-12-26, with special thanks to:
# https://soledadpenades.com/2009/10/29/fastest-way-to-generate-wav-files-in-python-using-the-wave-module/

import wave
import struct
import math

SAMPLING_RATE = 44100
WAV_FILE_LEN = SAMPLING_RATE * 1 # 44.1KHz sampling rate, 5 seconds
MAX_AMP = 32767
CORR_FACTOR = 10
SIN_WAV_FREQ = 100 * CORR_FACTOR # Sine wave frequency, in Hz*10 for some reason, 1000 gives 100Hz

output_file = wave.open('test.wav', 'w')
output_file.setparams((2, 2, 44100, 0, 'NONE', 'not compressed'))

for i in range (0,WAV_FILE_LEN):

data = MAX_AMP*math.sin(i*float(SIN_WAV_FREQ)/float(SAMPLING_RATE)/(math.pi/float(2)))
print data
packed_data = struct.pack('h', data)
output_file.writeframes(packed_data)
output_file.writeframes(packed_data)

output_file.close

For those who are curious, this generates a 100Hz sine wave: .

Next up, some experimentation with different pitches, perhaps different timbres. Stay tuned*!

*Also 100Hz.