In this lab, you will learn a bit about a few aspects of perception, namely, how sensitive you are to sensing changes in frequency, how your ear discriminates different tones played simultaneously, and how you locate the source of sound.

Since we will need to generate numerous tones, we will first define a simple function to produce a sine function of t for a specified frequency f.  Activate the following cell.

tone[f_,t_]=Sin[2π*f*t]

Just Noticeable Difference
Now, you will play two tones in sequence, the first at frequency f1 and the second at frequency f2 = f1 + deltaf.  You can start with f1 = 440 Hz, as below.  Make deltaf (the difference between f1 and f2) something reasonably large so that you will be able to clearly hear the difference.  After you enter a value of deltaf, activate the cell and play the result.

f1=440;
deltaf=40;
f2=f1 +deltaf;
Show[Play[tone[f1,t],{t,0,1}],Play[tone[f2,t],{t,0,1}]]

Now you will establish the value of you "just noticeable difference" in frequency.  Set, deltaf above to 1 Hz, activate the cell again and play the output.  Could you hear the change in tone?  If not, increase deltaf a bit and repeat until you can "just notice" the change.  Record your value of f1 and your just noticeable value of deltaf here:

f1=		deltaf=

At the just noticeable threshold, you probably can't determine whether the change is to a higher or lower pitch.  Ask your lab partner to change deltaf randomly between positive and negative values of deltaf at your just-noticeable-difference value (the value you entered for deltaf above this paragraph) and see if you can tell whether the pitch goes up or down.  Ask your partner to record how well you do, but don't look at the results until you finish the test.  Increase the value of deltaf used.  At what value of deltaf can you reliably determine whether the change is up or down in pitch?  Summarize your findings here:


Repeat the above with f1 at least a factor or two larger and give your results below.  What happens to the value of your just noticeable deltaf as you increase f1?

Mixing and Discriminating Two Tones
When two tones of widely different frequencies are played simultanesouly, they usually sound distinct.  However, when the frequencies are similar, it is hard to tell them apart.  Nevertheless, some interesting phenomena can be perceived.  The following cell resembles the one above except that the tones are played simultaneously.  As before, you'll start with the frequencies rather different so that you hear a clear difference  between the tones.  Activate the following cell and listen to the output.

f1=440;
deltaf=150;
f2=f1 +deltaf;
Play[tone[f1,t]+tone[f2,t],{t,0,1}]

Listen carefully and you should hear two different tones.  Change deltaf to a few Hertz and listen.   You should see and hear beats.  Can you still hear two different pitches?  What is the beat frequency?


Increase deltaf until you no longer hear distinct beats, but the sound crosses over to "roughness".  At what value of deltaf do you find this happens?  At what value of deltaf does the roughness disappear and give way to the perception of two distinct tones?

Explain your results in terms of what is happening in the basilar membrane in your ear's cochlea.  In particular, discuss why similar frequencies are perceived as a roughening while disparate ones appear as separate tones.

Since Mathematica allows us to play in stereo, let's send the two tones into different ears.  Activate the following cell, setting deltaf to a value for which you perceived some clear roughness.

f1=440;
deltaf=50;
f2=f1 +deltaf;
Play[{tone[f1,t],tone[f2,t]},{t,0,1}]

Now what do you hear?  How is the sound different from when you send both signals in to both ears.  Explain why the result is different, again in terms of what's going on in your ears' basilar membrane.

For relatively low frequencies, we determine the location of a sound based on the fact that it takes a longer time for the sound to reach one ear than the other.  This translates into a "phase difference" between the two signals.  Here you will see how a phase difference of two signals of exactly the same frequency going to different ears produces the sensation of  the sound coming from different directions.  Start by setting the phase to zero, activate the following cell and listen.  (Note that phase is measured in degrees here.)  What direction does the sound appear to be coming from?

f1=110;
phase=0;
Play[{Sin[2π f1 t],Sin[2π f1 t-phase Degree]},{t,0,5}]

Ask your lab partner to pick random values of phase between 0 and 360 degrees and enter them above one at a time while you listen to the result.  Don't look at the phase values s/he picks until the end.  Using a protractor for reference, estimate the direction of the sound to the nearest 10 degrees.  Tell your lab partner your estimate and have her or him enter it into the data table below.  Here's a convenient way to generate random integers between 0 and 360.  Each time you activate, you get a different random number:

RandomInteger[360]

This is the data table.  In each row, enter the phase chosen before the comma and the percieved angle of the source after the comma:  {phase, direction}.  When the table is full, activate the cell and the next one to plot your data.

data={
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,},
{,}
}

ListPlot[data]

What can you conclude about the relationship between phase difference and perceived sound source location?  Note any unusual features of your data and discuss.  




If there is time, repeat the above exercise for a higher frequency. 

At what frequency can you no longer perceive any effect from varying the phase?

When you are done, save this file in your folder on the storage drive.