(→Code) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
%Miles Whittaker | %Miles Whittaker | ||
%ECE301 | %ECE301 | ||
+ | %HW1.1 | ||
clear | clear | ||
Line 9: | Line 10: | ||
%Frequencies for notes used | %Frequencies for notes used | ||
A = 220; | A = 220; | ||
− | B = | + | B = 247; |
− | Db = 277 | + | Db = 277; |
− | D = | + | D = 294; |
− | E = | + | E = 330; |
− | F = 349 | + | F = 349; |
− | Gb = | + | Gb = 370; |
− | G = | + | G = 392; |
%Hail Hail to Old Purdue | %Hail Hail to Old Purdue | ||
Line 26: | Line 27: | ||
for N = 1 : length(hail_hail) | for N = 1 : length(hail_hail) | ||
song = sin(2 * pi * t * hail_hail(N)); | song = sin(2 * pi * t * hail_hail(N)); | ||
− | + | wavplay(song,1/delta); | |
end | end | ||
− | + | wavwrite(song,1/delta,32,'R:\My Documents\Purdue\ECE301\hail_hail.wav'); | |
pause(1); | pause(1); | ||
Line 34: | Line 35: | ||
for T = 1 : length(hail_hail) | for T = 1 : length(hail_hail) | ||
song = sin(2 * pi * t * hail_hail(T)); | song = sin(2 * pi * t * hail_hail(T)); | ||
− | + | wavplay(song,1/delta); | |
end | end | ||
− | + | wavwrite(song,1/delta,32,'R:\My Documents\Purdue\ECE301\fast_hail_hail.wav'); | |
pause(1); | pause(1); | ||
Line 42: | Line 43: | ||
for T = 1 : length(hail_hail) | for T = 1 : length(hail_hail) | ||
song = sin(4 * pi * t * hail_hail(T)); | song = sin(4 * pi * t * hail_hail(T)); | ||
− | + | wavplay(song,1/delta); | |
end | end | ||
+ | wavwrite(song,1/delta,32,'R:\My Documents\Purdue\ECE301\high_pitch_hail_hail.wav'); | ||
</pre> | </pre> | ||
+ | |||
+ | == Audio == | ||
+ | |||
+ | [[Media:Hail_hail_ECE301Fall2008mboutin.wav]] | ||
+ | |||
+ | [[Media:Fast_hail_hail_ECE301Fall2008mboutin.wav]] | ||
+ | |||
+ | [[Media:High_pitch_hail_hail_ECE301Fall2008mboutin.wav]] |
Latest revision as of 03:42, 5 September 2008
Code
%Miles Whittaker %ECE301 %HW1.1 clear clc %Frequencies for notes used A = 220; B = 247; Db = 277; D = 294; E = 330; F = 349; Gb = 370; G = 392; %Hail Hail to Old Purdue hail_hail = [A, B, Db, D, E, Gb, Gb, G, G, G, D, E, F, Gb]; delta = 0.0005; Finish = 0.4; t = 0:delta:Finish; for N = 1 : length(hail_hail) song = sin(2 * pi * t * hail_hail(N)); wavplay(song,1/delta); end wavwrite(song,1/delta,32,'R:\My Documents\Purdue\ECE301\hail_hail.wav'); pause(1); t = 0:delta:Finish/2; for T = 1 : length(hail_hail) song = sin(2 * pi * t * hail_hail(T)); wavplay(song,1/delta); end wavwrite(song,1/delta,32,'R:\My Documents\Purdue\ECE301\fast_hail_hail.wav'); pause(1); t = 0:delta:Finish; for T = 1 : length(hail_hail) song = sin(4 * pi * t * hail_hail(T)); wavplay(song,1/delta); end wavwrite(song,1/delta,32,'R:\My Documents\Purdue\ECE301\high_pitch_hail_hail.wav');
Audio
Media:Hail_hail_ECE301Fall2008mboutin.wav