<<Graphics`Graphics`

Notebook for Support of worksheet on complex waves

Example 1

\(\(\(
\)\(
\)\(\(f1 = 
        220\ ;\)

    \(f2 = 3  f1;\)

    \(f3 = 5\ f1;\)

    p1 = 0; \ p2 = Pi/2; p3 = 0;

    a1 = 5; a2 = 1.3; a3 = 1;

    \(fr1[t_] = a1\ Sin[2\ Pi\ f1\ t + p1];\)

    \(fr2[t_] = a2\ Sin[2\ Pi\ f2\ t + p2];\)

    \(fr3[t_] = a3\ Sin[2\ Pi\ f3\ t + p3];\)

    \(f[t_] = fr1[t] + fr2[t] + fr3[t];\)

    \(tmax = 10;\)

    \(pl1 = 
        Plot[fr1[t], {t, 0, 0.005}, AspectRatio -> 0.25, 
          DisplayFunction -> Identity, 
          PlotRange -> {\(-5\), 5}];\)

    \(pl2 = 
        Plot[fr2[t], {t, 0, 0.005}, AspectRatio -> 0.25, 
          DisplayFunction -> Identity, 
          PlotRange -> {\(-5\), 5}];\)

    \(pl3 = 
        Plot[fr3[t], {t, 0, 0.005}, AspectRatio -> 0.25, 
          DisplayFunction -> Identity, 
          PlotRange -> {\(-5\), 5}];\)

    \(pl4 = 
        Plot[f[t], {t, 0, 0.005}, AspectRatio -> 0.25, 
          DisplayFunction -> Identity, 
          PlotRange -> {\(-7\), 7}];\)

    \(Show[
        GraphicsArray[{{pl1}, {pl2}, {pl3}, {pl4}}]];\)


    GeneralizedBarChart[{{0, 0, 0}, {f1, a1, 10}, {f2, a2, 10}, {f3, a3, 
          10}, {1500, 0, 0}}, AspectRatio -> 1.4, 
      PlotRange -> All]\)\)\)

tones = {}; tmax = 6;
tones = {}; 
    AppendTo[tones, 
Play[fr1[t], {t, 0, tmax}, 
        PlayRange -> All]];
Export["example1a.wav", tones];
tones = {}; 
    AppendTo[tones, 
Play[fr2[t], {t, 0, tmax}, 
        PlayRange -> All]];
Export["example1b.wav", tones];
tones = {}; 
    AppendTo[tones, 
Play[fr3[t], {t, 0, tmax}, 
        PlayRange -> All]];
Export["example1c.wav", tones]
tones = {}; 
    AppendTo[tones, 
Play[f[t], {t, 0, tmax}, 
        PlayRange -> All]];
Export["example1d.wav", tones]

Example 2

tones={};
f1=220 ;
f2=3f1;
f3=5 f1;
p1=0; p2=-Pi;p3=Pi/2;
a1=5;a2=1.3;a3=1;
fr1[t_]=a1 Sin[2 Pi f1 t+p1];
fr2[t_]=a2 Sin[2 Pi f2 t+p2];
fr3[t_]=a3 Sin[2 Pi f3 t+p3];
f[t_]=fr1[t]+fr2[t]+fr3[t];
tmax=10;
pl1=Plot[fr1[t],{t,0,0.005},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl2=Plot[fr2[t],{t,0,0.005},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl3=Plot[fr3[t],{t,0,0.005},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl4=Plot[f[t],{t,0,0.005},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-7,7}];
Show[GraphicsArray[{{pl1},{pl2},{pl3},{pl4}}]];

GeneralizedBarChart[{{0,0,0},{f1,a1,10},{f2,a2,10},{f3,a3,10},{1500,0,0}},
  AspectRatio->1.4,PlotRange->All]

tones={};tmax=6;
AppendTo[tones,
    Play[fr1[t],{t,0,tmax},PlayRange->All]];
Export["example2a.wav",tones];
tones={};AppendTo[tones,
    Play[fr2[t],{t,0,tmax},PlayRange->All]];
Export["example2b.wav",tones];
tones={};AppendTo[tones,
    Play[fr3[t],{t,0,tmax},PlayRange->All]];
Export["example2c.wav",tones]
tones={};AppendTo[tones,
    Play[f[t],{t,0,tmax},PlayRange->All]];
Export["example2d.wav",tones]

Example 3

tones={};
f1=220 ;
f2=330;
f3=440;
p1=0; p2=-Pi;p3=Pi;
a1=4;a2=2.5;a3=1;
fr1[t_]=a1 Sin[2 Pi f1 t+p1];
fr2[t_]=a2 Sin[2 Pi f2 t+p2];
fr3[t_]=a3 Sin[2 Pi f3 t+p3];
f[t_]=fr1[t]+fr2[t]+fr3[t];
tmax=10;
pl1=Plot[fr1[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl2=Plot[fr2[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl3=Plot[fr3[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl4=Plot[f[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-7,7}];
Show[GraphicsArray[{{pl1},{pl2},{pl3},{pl4}}]];

GeneralizedBarChart[{{0,0,0},{f1,a1,10},{f2,a2,10},{f3,a3,10},{1500,0,0}},
  AspectRatio->1.4,PlotRange->All]

tones={};tmax=6;
tones={};AppendTo[tones,
    Play[fr1[t],{t,0,tmax},PlayRange->All]];
Export["example3a.wav",tones];
tones={};AppendTo[tones,
    Play[fr2[t],{t,0,tmax},PlayRange->All]];
Export["example3b.wav",tones];
tones={};AppendTo[tones,
    Play[fr3[t],{t,0,tmax},PlayRange->All]];
Export["example3c.wav",tones]
tones={};AppendTo[tones,
    Play[f[t],{t,0,tmax},PlayRange->All]];
Export["example3d.wav",tones]

Example 4

tones={};
f1=220 ;
f2=330;
f3=440;
p1=0; p2=Pi/2;p3=Pi;
a1=4;a2=2.2;a3=1;
fr1[t_]=a1 Sin[2 Pi f1 t+p1];
fr2[t_]=a2 Sin[2 Pi f2 t+p2];
fr3[t_]=a3 Sin[2 Pi f3 t+p3];
f[t_]=fr1[t]+fr2[t]+fr3[t];
tmax=10;
pl1=Plot[fr1[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl2=Plot[fr2[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl3=Plot[fr3[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-5,5}];
pl4=Plot[f[t],{t,0,0.010},AspectRatio->0.25,
      DisplayFunction->Identity,PlotRange->{-7,7}];
Show[GraphicsArray[{{pl1},{pl2},{pl3},{pl4}}]]; 

GeneralizedBarChart[{{0,0,0},{f1,a1,10},{f2,a2,10},{f3,a3,10},{1500,0,0}},
  AspectRatio->1.4,PlotRange->All]

tones={};tmax=6;
AppendTo[tones,
    Play[fr1[t],{t,0,tmax},PlayRange->All]];
Export["example4a.wav",tones];
tones={};AppendTo[tones,
    Play[fr2[t],{t,0,tmax},PlayRange->All]];
Export["example4b.wav",tones];
tones={};AppendTo[tones,
    Play[fr3[t],{t,0,tmax},PlayRange->All]];
Export["example4c.wav",tones]
tones={};AppendTo[tones,
    Play[f[t],{t,0,tmax},PlayRange->All]];
Export["example4d.wav",tones]