(New page: == Code == <nowiki> %Miles Whittaker %ECE301 clear clc %Frequencies for notes used A = 220; B = 246.942; Db = 277.183; D = 293.665; E = 329.628; F = 349.228; Gb = 369.994; G = 391.995; ...) |
|||
Line 1: | Line 1: | ||
== Code == | == Code == | ||
− | < | + | <pre> |
%Miles Whittaker | %Miles Whittaker | ||
%ECE301 | %ECE301 | ||
Line 44: | Line 44: | ||
sound(song, 1/delta); | sound(song, 1/delta); | ||
end | end | ||
− | </ | + | </pre> |
Revision as of 13:33, 4 September 2008
Code
%Miles Whittaker %ECE301 clear clc %Frequencies for notes used A = 220; B = 246.942; Db = 277.183; D = 293.665; E = 329.628; F = 349.228; Gb = 369.994; G = 391.995; %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)); sound(song, 1/delta); end pause(1); t = 0:delta:Finish/2; for T = 1 : length(hail_hail) song = sin(2 * pi * t * hail_hail(T)); sound(song, 1/delta); end pause(1); t = 0:delta:Finish; for T = 1 : length(hail_hail) song = sin(4 * pi * t * hail_hail(T)); sound(song, 1/delta); end