(New page: %Steve Anderson %September 5, 2009 %ECE 301 Homework 1 %Hail purdue - Beginning of the song at normal speed clear; clc; Song = ones(1); Song2 = ones(1); Song3 = ones(1); %De...) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | == Sound Files == | ||
+ | |||
+ | |||
+ | |||
+ | == Matlab code == | ||
+ | |||
%Steve Anderson | %Steve Anderson | ||
%September 5, 2009 | %September 5, 2009 | ||
%ECE 301 Homework 1 | %ECE 301 Homework 1 | ||
− | %Hail purdue - Beginning of the song | + | %Hail purdue - Beginning of the song |
clear; | clear; | ||
clc; | clc; | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
%Definitions of Note Frequencies | %Definitions of Note Frequencies | ||
A = 220; | A = 220; |
Latest revision as of 06:19, 5 September 2008
Sound Files
Matlab code
%Steve Anderson %September 5, 2009 %ECE 301 Homework 1 %Hail purdue - Beginning of the song clear; clc; %Definitions of Note Frequencies A = 220; Bf = 233; B = 247; C = 262; Df = 277; D = 294; Ef = 311; E = 330; F = 349; G = 392; Af = 415; A2 = A *2; Bf2 = Bf * 2; B2 = B * 2; C2 = C * 2; Df2 = Df * 2; D2 = D * 2; Ef2 = Ef * 2; E2 = E * 2; F2 = F * 2; G2 = G * 2; Af2 = Af * 2; %length of each kind of note (assuming 180 beats per minute) Rest = 0; Q = 60/180; Ei = Q / 2; H = Q * 2; DQ = Q + Ei; DH = H + Q; %sampling frequency Delta = 0.00005; %array of notes in order of song Songnote = [Ef, F, G, Af2, Bf2, C2, C2, Df2, Df2, Df2, Af, Bf2, B2, C2, Rest, C2, C2, Bf2, Af2, Bf2, C2, C2, Bf2, F, G, Af2, G, F, Bf2]; %array of lengths of notes in order of song Notelength = [H, Q, Q, DQ, Ei, Q, Q, Q, Ei, Ei, Q, Ei, Ei, DH, Q, H, Q, Q, DQ, Ei, Q, Q, Q, Ei, Ei, Q, Ei, Ei, DH]; for i = 1:length(Notelength) t = 0:Delta:Notelength(i); normal = sin(2*pi*Songnote(i)*t); sound(normal, 1/Delta); end for i = 1:length(Notelength) t = 0:Delta:0.5*Notelength(i); twice = sin(2*pi*Songnote(i)*t); sound(normal, 1/Delta); end for i = 1:length(Notelength) t = 0:Delta:Notelength(i); partc = sin(2*2*pi*Songnote(i)*t); sound(normal, 1/Delta); end