Beat Frequency of Sound Waves

Manipulate[
If[c>range-1/100,c=range-1/100];
Column[
{
Show[Plot[Sin[(a-(b/2))2 π t]+Sin[(a+(b/2))2 π t],{t,0,range},AspectRatio->1/3,ImageSize->{375,125},PlotRange->{-2.2,2.2},Axes->{True,False}],Plot[{2.2},{t,c,c+1/100},AspectRatio->1/3,ImageSize->{375,125},PlotRange->{-2.2,2.2},Filling->Bottom,Axes->{True,False},PlotStyle->Transparent,FillingStyle->{Opacity[0.4,Red]}]],

Show[Plot[{Sin[(a-(b/2))2 π t]+Sin[(a+(b/2))2 π t],Sin[(a-(b/2))2 π t],Sin[(a+(b/2))2 π t]},{t,c,c+1/100},AspectRatio->1/3,ImageSize->{375,125},PlotRange->{-2.2,2.2},PlotStyle->{Thick,Dashed,Dashed},Axes->{True,False}]]
}
,Center],

{{range,1,"upper view"},{1/16->"narrow",1/4->"medium",1->"wide",4->"really wide"}},
{{c,0.58014`,"zoomed view"},0,range-1/100},

{{a,320,"mean frequency (Hz)"},220,5000,Appearance->"Labeled"},
{{b,3,"difference in frequencies (Hz)"},-20,20,1,Appearance->"Labeled"},

Button["play tones",EmitSound[Sound[Play[{ Sin[(a-b/2)*(2 π t)], Sin[(a+b/2)*(2 π t)]},{t,0,time},SampleRate->6000]]],Appearance->"FramedPalette",ImageSize->168,ImageMargins->{{135,2},{2,2}}],

{{time,4,"play time (s)"},2,20,2,Appearance->"Labeled"},

ControlPlacement->Bottom
]

CAPTION

Adjust the sliders to explore the relationship between the difference in frequencies of the two component waveforms (shown dashed) and the resulting beat frequency seen in the upper plot. The red region in the upper plot is projected in the lower plot: move the "zoomed view" slider to view where the component waveforms are in phase, so that their sum reaches maximum amplitude, and where the waveforms are out of phase, so that their sum reaches minimum amplitude. The frequencies permitted by the "mean frequency" slider are audible to humans: click the "play tones" button to hear the resulting beating effect.

DETAILS

Note that each stereo channel plays a tone of a single frequency, so that beating effect is the inteference of the soundwaves and not the speakers playing the mathematical summation of the two waveforms.

This Demonstration is an expanded version of the application created by Jon McLoone in the Screencast titled "Mathematica Player Family: Creating an Application in 60 Seconds" found in the Wolfram Screencast Gallery.

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Beat Frequency of Sound Waves" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/BeatFrequencyOfSoundWaves/

Contributed by: Christopher Engberg

After work by: Jon McLoone

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »