Generating (and Saving) Tones with SoX

I’ve been using the command line program SoX to generate tones for my physics demonstrations on sound waves.

Single frequency tones can be used for talking about frequency and wavelength, as well as discussing octaves.

Combine two tones allows you to talk about interference and beats.

SoX can do a lot more than this, so I though I’d compile what I’m using it for in a single, reference post. For the record: I’m using SoX in Terminal on a Mac.

Using SoX

To play a single note (frequency 173.5 Hz) for 5 seconds, use:

> play -n  synth 5 sin 347

To save the note to a mp3 file (called note.mp3) use:

> sox -n note.mp3 synth 5 sin 347

The SoX command to play two notes with frequencies of 347 and 357 Hz is:

> play -n synth 15 sin 347 sin 357

and to make an mp3 file use:

> sox -n beat_10.mp3 synth 15 sin 347 sin 357

Listen for the Beat

Two sound waves with slightly different frequencies sometimes cancel each other out (destructive interference) and sometimes add together (constructive interference) to create a sound that gets loud and quiter with a beat. The two lower sound waves (green and blue) are out of phase, and their combination (superposition) creates the third (red) wave.

Play two sound tones that are close together in frequency and the sound waves will overlap to create a kind of oscillating sound called a beat.

When you hear the beat (see below), you're hearing the alternating of the high amplitude region and the low amplitude region.

Below are two tones: separated and then mixed — listen for the beat.

Frequency Sound File (mp3)
Tone 1 347 Hz 1m.mpg
Tone 2 357 Hz 1m-357.mp3
Mixed Tones (with beat) 347 Hz + 357 Hz beat_10.mp3

Interestingly, you can sometimes hear the beat as a third tone if the frequency difference is just right. The frequency of the beat is the difference between the frequency of the two tones.

Notes

The SoX command to play two notes with frequencies of 347 and 357 Hz is:

> play -n synth 15 sin 347 sin 357

to make an mp3 file use:

> sox -n beat_10.mp3 synth 15 sin 347 sin 357

The Real-Time ITCZ

NOAA provides real-time (at least in the last 6 hours) images of the tropical Atlantic, which will often show the Inter-Tropical Convergence Zone (ITCZ) quite nicely.

They show images captured using visible light:

Tropical Atlantic using visible light. (ᔥEUMETSAT, ↬NOAA)

As well as infra-red:

Tropical Atlantic using visible light. (ᔥEUMETSAT, ↬NOAA)

Octave Sound Samples

I’ve not had much real musical training, but enough to know that I have a terrible ear for sound and can’t reproduce a note for anything. However, an informed source tells me that octaves represent the same note at different pitches.

The pitch is the frequency of the sound wave.

This "note" is a sound wave with a frequency (pitch) of 347 cycles per second (347 Hz), which has a wavelength of approximately 1 meter. It sounds like this.

If one note has twice the frequency of the other, they’re said to be one octave apart. For example, click on the image below to listen to the same note at different octaves:

Click the waves to hear the different octaves. The wavelengths of the sounds are shown (in meters).




Or play the files:

Wavelength Frequency Sound File (mp3)
1 m 347 Hz 1m.mpg
0.5 m 694 Hz 50cm.mp3
0.25 m 1388 Hz 25cm.mp3

Foraging for Food

The Splendid Table has an enticing interview with Hank Shaw who just wrote a book on foraging for food in the woods and how to cook what you find. The book’s called, “Hunt, Gather, Cook“.

Shaw’s website is full of details about his adventures in foraging, as well as a lot of recipes — including some excellent photographs of the work in progress.

How Black? 99.7% Black

One of my students asked, “How black can you get?” I didn’t know the answer; however, serendipitously, I ran into this article last night. Researchers in Rochester, NY have created a solar cell that absorbs 99.7% of incoming light, which means that it has an albedo (reflectivity) of just 0.3%. Since solar cells create energy by absorbing light, the more light it can absorb — the blacker the solar cell — the more efficient the solar cell is likely to be.

Concave Mirror Ray Diagrams in VPython

I put together a VPython model to interactively illustrate how ray diagrams can be used to determine the appearance of an object in a concave, parabolic mirror. The video below demonstrates, but the code can be found here.

The white arrow is the object, and the yellow arrow shows it apparent magnification and orientation. You can drag the arrow around by its base, or make it taller (or shorter) by dragging the tip of the arrow up and down.

Summary of Appearance

When the object is closer to the mirror than the mirror’s focal distance then the object appears enlarged.

Enlarged when close.

When the object is between 1 and 2 focal distances away from the lens, it still appears enlarged, but is upside down. (Note that at one focal distance away the object disappears entirely from the mirror.)

When the object is between 1 and 2 focal distances away from the lens, it still appears enlarged, but is upside down.

At twice the focal distance the object appears to be the same size but upside down.

At twice the focal distance the object appears to be the same size but upside down.

Beyond 2 times the focal distance the object appears upside down and shrunken.

Beyond 2 times the focal distance the object appears upside down and shrunken.

NOTE: To create images from VPython, and then convert them into a movie, I used this technique.

Wind Patterns (for the U.S.)

U.S wind patterns (excerpt from April 10th, 2012) HINT.FM

HINT.FM has an amazing animation of winds over the U.S.. A major part of the awesomeness is that it’s updated hourly from the National Weather Service’s weather database, which has an awful lot of excellent data available.