Line 101: | Line 101: | ||
==Comments== | ==Comments== | ||
− | I'm not sure I got the the lengths of the different notes exactly right, but it' pretty close. The transformation y(t) = x(2t) doubles the frequency, which effectively bumps the tune up an octave. This result is demonstrated in the sound file above. | + | I'm not sure I got the the lengths of the different notes exactly right, but it' pretty close. The transformation y(t) = x(2t) doubles the frequency, which effectively bumps the tune up an octave. This result is demonstrated in the sound file above. The crackling sound between the notes is a little annoying. I'm guessing this is because of the abrupt transitions between notes. In "real" sound, the sounds that we are used to hearing everyday, the previous note would still be reverberating as the next note was being played, so the transition would be smooth. |
Latest revision as of 19:20, 3 September 2008
MATLAB Code
%Jacob Pfister %HW1.1 clear clc delta = 1/44100; sec = 1/delta; i = 1; %a) Hail, Hail to old Purdue for t = 0:delta:0.5 y(i) = sin(2*pi*264*t); i = i + 1; end for t = (0.5 + delta):delta:0.75 y(i) = sin(2*pi*297*t); i = i + 1; end for t = (0.75 + delta):delta:1 y(i) = sin(2*pi*330*t); i = i + 1; end for t = (1 + delta):delta:1.5 y(i) = sin(2*pi*352*t); i = i + 1; end for t = (1.5 + delta):delta:1.625 y(i) = sin(2*pi*396*t); i = i + 1; end for t = (1.625 + delta):delta:1.75 y(i) = sin(2*pi*440*t); i = i + 1; end %b) 2 Times faster for t = (1.75 + delta):delta:2 y(i) = sin(2*pi*264*t); i = i + 1; end for t = (2 + delta):delta:2.125 y(i) = sin(2*pi*297*t); i = i + 1; end for t = (2.125 + delta):delta:2.5 y(i) = sin(2*pi*330*t); i = i + 1; end for t = (2.5 + delta):delta:3 y(i) = sin(2*pi*352*t); i = i + 1; end for t = (3 + delta):delta:3.0625 y(i) = sin(2*pi*396*t); i = i + 1; end for t = (3.0625 + delta):delta:3.125 y(i) = sin(2*pi*440*t); i = i + 1; end %c) y(t) = x(2t) for t = 3.125:delta:3.625 y(i) = sin(4*pi*264*t); i = i + 1; end for t = (3.625 + delta):delta:3.875 y(i) = sin(4*pi*297*t); i = i + 1; end for t = (3.875 + delta):delta:4.125 y(i) = sin(4*pi*330*t); i = i + 1; end for t = (4.125 + delta):delta:4.625 y(i) = sin(4*pi*352*t); i = i + 1; end for t = (4.625 + delta):delta:4.75 y(i) = sin(4*pi*396*t); i = i + 1; end for t = (4.75 + delta):delta:4.875 y(i) = sin(4*pi*440*t); i = i + 1; end %play sound(y,44100); %write file wavwrite(y,44100,32,'HailPurdueRemix.wav');
Sound File
Media:HailPurdueRemix_ECE301Fall2008mboutin.wav
Comments
I'm not sure I got the the lengths of the different notes exactly right, but it' pretty close. The transformation y(t) = x(2t) doubles the frequency, which effectively bumps the tune up an octave. This result is demonstrated in the sound file above. The crackling sound between the notes is a little annoying. I'm guessing this is because of the abrupt transitions between notes. In "real" sound, the sounds that we are used to hearing everyday, the previous note would still be reverberating as the next note was being played, so the transition would be smooth.