(* Example how to mix two sounds with Mathematica         *) 
(* Oliver Knill,  Harvard University, Math21b, Fall, 2004 *) 

a=Import["scherzo.wav"]; b=Import["wirke.wav"];
type=a[[1,2]]; n=Length[a[[1,1,1]]]; m=Length[b[[1,1,1]]]; nm=Min[n,m];

song={
   Table[(a[[1,1,1,k]]+b[[1,1,1,k]])/2,{k,nm}],
   Table[(a[[1,1,2,k]]+b[[1,1,2,k]])/2,{k,nm}]
};

c=Sound[SampledSoundList[song,type]];
Export["mix.wav",c,"WAV"]
