Ave Verum Corpus

Note sequence

Soprano

aves={{10,2},{15,3},{7,3},
       {10,3},{9,3},{8,2},
       {8,3},{12,3},{10,3},{8,3},
       {8,3},{7,3},{7,2},
       {5,6},{5,3},{7,3},{7,3},{8,3},{8,3},{8,2},{7,3},{7,3},{5,1},
       {5,6},{10,3},{10,3},{9,3},{9,2},{5,3},{9,2},{12,3},{12,3},{10,3},{10,3},{10,3},
       {15,2},{15,2},{15,3},{14,3},{12,3},{10,3},{10,2},{9,3},{9,3},{10,1},
       {10,6},{10,3},{10,3},{11,3},{11,3},{11,3},
      {11,3},{15,3},{13,3},{11,3},{11,3},{10,3},{10,2},
      {8,6},{8,3},{8,3},{11,3},{10,3},{8,3},{8,2},{6,4},{5,4},{6,3},{5,1},
      {7,6},{7,3},{7,3},{5,3},{3,3},{8,3},{8,3},{8,3},{8,3},{8,3},
      {8,3},{7,3},{5,3},{10,3},{10,3},{10,3},{10,3},{10,3},
      {10,3},{8,3},{10,3},{12,3},{7,2},{5,3},{5,4},{7,4},{8,2},
      {8,2},{15,2},{15,2},{15,2},{16,2},{17,3},{12,3},{14,3},{15,3},
      {14,3},{12,4},{10,4},{15,3},{8,3},{7,2},{5,7},{5,4},{3,1}};
max=Length[aves];

Alto

avea={{7,2},{7,3},{7,3},
      {5,3},{5,3},{5,2},
       {5,3},{8,3},{7,3},{5,3},
       {5,3},{3,3},{3,2},
       {2,6},{2,3},{3,3},{3,3},{5,3},{5,3},{5,2},{3,3},{3,3},{2,1},
       {5,6},{5,3},{5,3},{5,3},{5,2},{5,3},{5,2},{9,3},{9,3},{10,3},{10,3},{10,3},
       {27,2},{9,2},{10,3},{10,3},{7,3},{7,3},{5,2},{5,3},{5,3},{5,1},
       {5,6},{5,3},{5,3},{5,3},{5,3},{5,3},
      {5,3},{5,3},{5,3},{5,3},{5,3},{6,3},{6,2},
      {3,6},{3,3},{5,3},{6,3},{5,3},{5,3},{5,2},{3,4},{2,4},{3,3},{2,1},
      {3,6},{3,3},{3,3},{2,3},{28,3},{5,3},{5,3},{5,3},{5,3},{5,3},
      {5,3},{3,3},{2,3},{7,3},{7,3},{7,3},{7,3},{7,3},
      {7,3},{8,3},{7,3},{5,3},{3,2},{2,4},{2,3},{2,4},{3,2},
      {27,2},{27,2},{7,2},{8,2},{7,2},{5,3},{5,3},{5,3},{5,3},
      {5,3},{3,4},{2,4},{3,3},{3,3},{3,2},{2,7},{2,4},{3,1}};

Tenor

avet={{10,2},{10,3},{10,3},
      {12,3},{12,3},{12,2},
       {10,3},{10,3},{10,3},{10,3},
       {10,3},{10,3},{10,2},
       {10,6},{10,3},{10,3},{10,3},{10,3},{10,3},{10,2},{10,3},{10,3},{10,1},
       {14,6},{14,3},{14,3},{15,3},{15,2},
       {12,3},{12,2},{15,3},{15,3},{14,3},{14,3},{14,3},
       {27,2},{15,2},{17,3},{15,3},{14,3},{12,3},{12,2},{12,3},{12,3},{14,1},
       {14,6},{14,3},{14,3},{14,3},{14,3},{13,3},
      {13,3},{11,3},{10,3},{8,3},{8,3},{10,3},{10,2},
      {12,6},{12,3},{14,3},{15,3},{17,3},{14,3},{14,2},{15,4},{15,4},{12,3},{5,1},
      {27,6},{27,3},{12,3},{12,3},{12,3},{12,3},{12,3},{10,3},{8,3},{14,3},
      {14,3},{14,3},{14,3},{14,3},{14,3},{12,3},{10,3},{15,3},
      {15,3},{15,3},{15,3},{15,3},{10,2},{10,3},{10,4},{10,4},{8,2},
      {27,2},{27,2},{13,2},{15,2},{13,2},{12,3},{15,3},{15,3},{12,3},
      {10,3},{10,4},{10,4},{10,3},{8,3},{10,2},{8,7},{8,4},{7,1}};

Bass

aveb={{15,2},{15,3},{15,3},
      {15,3},{15,3},{15,2},
       {14,3},{14,3},{14,3},{14,3},
       {15,3},{15,3},{15,2},
       {10,6},{10,3},{15,3},{15,3},{14,3},{14,3},{15,2},{15,3},{15,3},{10,1},
       {22,6},{22,3},{22,3},{24,3},
       {27,3},{27,2},{17,3},
       {18,3},{19,3},{19,3},{19,3},{19,3},
       {27,2},{12,2},{14,3},{14,3},{15,3},{15,3},{17,2},{17,3},{17,3},{10,1},
       {22,6},{22,3},{22,3},{20,3},{20,3},{20,3},
      {13,3},{13,3},{13,3},{13,3},{13,3},{18,3},{18,2},
      {18,6},{18,3},{17,3},{15,3},{14,3},{10,3},{11,2},{10,4},{10,4},{9,3},{10,1},
      {27,6},{27,3},{20,3},{20,3},{20,3},{20,3},{20,3},{14,3},{17,3},{22,3},
      {22,3},{22,3},{22,3},{22,3},{22,3},{20,3},{19,3},{24,3},
      {24,3},{24,3},{22,3},{21,3},{22,2},{10,3},{10,4},{10,4},{12,2},
      {27,2},{27,2},{22,2},{23,2},{22,2},{21,3},{21,3},{21,3},{21,3},
      {20,3},{20,4},{20,4},{19,3},{12,3},{10,2},{10,7},{10,4},{15,1}};

Musical notes and durations

damping for overtones:

g=1.2;

table of notes for treble staff (middle C plus two octaves
(1-C, 2-C#, 3-D, 4-D#, 5-E, 6-F, 7-F#, 8-G, 9-G#, 10-A, 11-A#, 12-B, 13-C', 14-C#', 15-D', 16-D#', 17-E', 18-F', 19-F#', 20-G', 21-G#', 22-A', 23-A#', 24-B', 25-C",26-C#'',27-break,28-B3)

note={};
For[n=1, n<27,n=n+1,
  {Clear[fre,p,w],p=(n-1)/12.;fre=261.6*2^p;w=2*Pi*fre;
   AppendTo[note,Exp[-g*t]*Sum[Sin[i*w*t]/i^2,{i,1,10}]];
    }];
    AppendTo[note,0.];AppendTo[note,Exp[-g*t]*Sum[Sin[i*2*Pi*261.6*2^(-1./12.)]/i^2,{i,1,10}]];

table of notes for bass staff (starting two octaves below middle C)
(1-C, 2-C#, 3-D, 4-D#, 5-E, 6-F, 7-F#, 8-G, 9-G#, 10-A, 11-A#, 12-B, 13-C', 14-C#', 15-D', 16-D#', 17-E', 18-F', 19-F#', 20-G', 21-G#', 22-A', 23-A#', 24-B', 25-C",26-C#'',27-break)

bnote={};
For[n=1, n<27,n=n+1,
  {Clear[fre,p,w],p=(n-1)/12.-2;fre=261.6*2^p;w=2.*Pi*fre;
   AppendTo[bnote,Exp[-g*t]*Sum[Sin[i*w*t]/i^2,{i,1,10}]];
    }];
    AppendTo[bnote,0.];

table for durations for base time
(1-whole, 2-half, 3-quarter, 4-eightth, 5-sixteenth, 6-half-dot, 7-quarter-dot, 8-eighth-dot)

base=2.3;
dur={};
For[n=1, n<6,n=n+1,
  { AppendTo[dur,base/(2^(n-1))]}];
  AppendTo[dur,2.5*base/4.];AppendTo[dur,2.5*base/8.];AppendTo[dur,2.5*base/16.];

Play the actual song

song={}
For[k=1,k<max+1,k=k+1,{
currs=aves[[k,1]];curra=avea[[k,1]];currt=avet[[k,1]];currb=aveb[[k,1]];
tim=aves[[k,2]];
AppendTo[song,Play[Evaluate[note[[currs]]+0.8*note[[curra]]+0.7*note[[currt]]+0.8*bnote[[currb]]],{t,0,dur[[tim]]},PlayRange->All]]}];
Export["aveverum.wav",song,"WAV"];