WHAT IS IT?
-----------
This project simulates sound wave interference. There is one speaker at each end.
Each of these speakers is powered by an independent sinusoidal signal
generator.The YELLOW line represents the sound level due to the left speaker. The
CYAN line represents the sound level due to the right speaker. The RED line
represents the sum of the sound levels of the two speakers.

HOW TO USE IT
-------------
The SETUP button initializes the simulation.  The GO Button runs the simulation. 
All of the sliders can be changed while the model is running.

The frequency sliders (LFREQ and RFREQ) control the frequencies of the signal
generators. The amplitude sliders (LAMPLITUDE and RAMPLITUDE) control the maximum
sound level of the speakers. As you might have guessed, the LFREQ and LAMPLITUDE
sliders govern the left speaker, while RFREQ and RAMPLITUDE control the right.

The PHASE slider puts the right speaker on hold for a time that the slider
represents. 360 (degrees) is one whole cycle.

The SPEED slider is used to slow the model down, for better viewing. Set the
slider to 100 for maximum speed.

The FRICTION slider controls the amount of sound damping in the air.

There are three buttons to hide each waveform and there are three buttons to show
each waveform. Every waveform can be observed individually or together with the
other waveforms.

The SELECT-LISTENING-POINT button allows you to select a point between the
speakers to attend to. Click on the button, select a point in the graph window
and the deselect the button. Sound levels at that point are graphed in the plot
window. If no point is selected, the default  listening position is in the
middle.

RUNNING THE MODEL
-----------------
Click the SETUP button to set up system. Click GO to turn on the speakers.

Plot Window 1 displays a running graph of the sound-level at a selected point
between the speakers. Click anywhere on the X axis with the mouse to observe the
plot of sound level versus time at the given point. The LISTENING-POINT monitor
displays the x-coordinate of the point you have selected.

THINGS TO NOTICE
----------------
Sound effect is due to pressure change spatially and temporally. In the model,
the waveforms are made up of three lines of turtles. Each turtle acts as it were
connected to its neighboring turtles with springs. The greater the distance
between two neighboring turtles, the larger the exerted force between them.

When the left end of the sound level goes up, it "pulls up" the turtle to its
right, which in turn pulls up the turtle to its right, and so on. In that way, a
sound wave moves through the air.

The green turtles (the speakers) continue to put more energy into the air. If
there was no friction in the air, the waves in the air would keep getting bigger
and bigger.

When two speakers are turned on, the sound level at a certain point at a certain
time is the sum of the sound level produced by the two speakers at that time.

The lines you see in the graphic field are the sound level at a certain moment
mapped in space. The y-coordinates are these sound levels at this particular
point in time.

THINGS TO TRY
-------------
Change the values on the sliders and observe what happens to the sum of the sound
level (the red line).  Start with simple cases: -- left and right frequencies the
same, change relative amplitudes. -- left and right amplitudes the same, change
relative frequencies. -- simple ratios, i.e., LFREQ is 4 and RFREQ is 8.

Does the phase affect this pattern?

The red line represents what your ear would "hear" at a given point, since it
detects the total sound pressure and not waves that might produce it.  Move the
LISTENING-POINT around.  For any given pattern, would you "hear" the same thing
everywhere?

Try to create a "standing wave," in which some points on the lines do not move at
all. Plot one of the points to see if the sum at this point is zero.

EXTENDING THE MODEL
-------------------
Program the red turtles to find the sum of the absolute values of the two waves.

Make it possible to "fix" the waves to zero at some point along the line -- as if
this were a string and you put your finger on it.

Make the waves "reflect" from each end instead of going on.

STARLOGOT FEATURES
-----------------
In order to have three independent waves, three lines of turtles are created --
yellow, then cyan, then red -- in order from left to right.  Special turtles are
created to control the ends of these waves.  One end generates the wave (green)
and the other end prevents the wave motion from wrapping (dark blue).

At each iteration of GO, each turtle looks at its neighbors and calculates a new
speed and position accordingly.  The order in which this is done is not obvious,
since the turtles are running in parallel.  It's important that the order in
which the turtles look at their neighbors doesn't matter.  Therefore temporary
variables are created, "ypos-old", and "yvel-old".   Each turtle looks at its
neighbors in previous state and updates its own temporary variables "ypos-new"
and "yvel-new".   Then all the turtles update their states together.

For this project, it does not make sense for the turtles to "wrap" when they get
to the top or bottom of the screen. Thus the y-position of the turtles is kept in
a new variable (YPOS), and the turtle is hidden if its y-position moves outside
the boundary of the screen.

RELATED MODELS
--------------
Speakers - a simpler version of the same thing
Rope
Doppler
Wave Machine

A TRUE STORY
------------
The contributor of this model is a teacher. This is a story from his classroom.

Typically, in my class, we do a standard  physical experiment about wave
propagation and interference:

Two speakers are put on a straight track one meter apart and facing each other.
Each speaker is powered by a 1500 Hz sinusoidal signal generator.

Students are asked to use a microphone to measure the sound level along the track
between the two speakers and write down the positions where the microphone
readings are at a minimum. The student is then asked to explain the results and
to determine if the minimum readings should be zero or not.

The results showed that the average distance between two minimum readings is
about one half of the wavelength. However, the students could not explain the
results and could not determine if the readings should be zero.

A student asked the teacher for help and the teacher extended the StarLogoT
sample model "rope" to help solve the problem.

The teacher extended the rope model into a model with two driving forces located
at each end of the rope. This setup is equivalent to the setup of the physical
experiment. He also changed a command that the y coordinate represents the
absolute value of the deflection, because the microphone reading is the root mean
square value of the sound level. Run the program and it's very clear that the
minimum readings should be zero and the distance between any two minima is one
half of the wave length.

Can you explain the experimental results and predict if the sound level at the
minima should be zero?

Isn't it amazing that such a simple program can be so helpful?