(New page: ==MATLAB Code== <pre> %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; ...)
 
Line 96: Line 96:
 
wavwrite(y,44100,32,'HailPurdue.wav');
 
wavwrite(y,44100,32,'HailPurdue.wav');
 
</pre>
 
</pre>
 +
 +
==Sound File==

Revision as of 19:08, 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,'HailPurdue.wav');

Sound File

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang