(New page: == Audio Files == purdue.wav purduex2.wav purdue(2t).wav == M-File ==) |
(→Audio Files) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Audio Files == | == Audio Files == | ||
− | [[ | + | *[[Media:purdue.wav _ECE301Fall2008mboutin| purdue]] |
− | [[ | + | *[[Media:purduex2.wav _ECE301Fall2008mboutin| purdue x2]] |
− | [[purdue(2t) | + | *[[Media:purdue(2t).wav _ECE301Fall2008mboutin| purdue (2t)]] |
+ | |||
+ | |||
+ | |||
+ | |||
+ | Only did the first few seconds of the song | ||
== M-File == | == M-File == | ||
+ | <pre> | ||
+ | % Aishwar Sabesan | ||
+ | % M-file for playing "Hail Purdue" song | ||
+ | % Homework 1.1 -- ECE301 | ||
+ | |||
+ | %Part (a) ---> Playing the song | ||
+ | delta = 0.000005; | ||
+ | x = 264; | ||
+ | C = x; | ||
+ | D = 9*x/8; | ||
+ | E = 5*x/4; | ||
+ | F = 4*x/3; | ||
+ | G = 3*x/2; | ||
+ | A = 5*x/3; | ||
+ | B = 15*x/8; | ||
+ | CH = 2*x; | ||
+ | Bb = ((B-A)/2)+A; | ||
+ | |||
+ | notes = [C, D, E, F, G, A, A, Bb, Bb, Bb, F, G, A]; | ||
+ | times = [1, 0.5, 0.5, 0.75, 0.25, 0.5, 0.5, 0.4, 0.2, 0.2, 0.5, 0.5, 1]; | ||
+ | purduebuff = []; | ||
+ | for ii = 1:length(notes) | ||
+ | t = 0:delta:times(ii); | ||
+ | purdue = sin(2*pi*t*notes(ii)); | ||
+ | purduebuff = [purduebuff; purdue(:)]; | ||
+ | end | ||
+ | |||
+ | sound(purduebuff,1/delta); | ||
+ | wavwrite(purduebuff, 1/delta, 16, 'purdue.wav'); | ||
+ | pause(7); | ||
+ | |||
+ | %Part (b) --> Playing the song at 2x | ||
+ | sound(purduebuff, 2/delta); | ||
+ | wavwrite(purduebuff,2/delta,16,'purduex2.wav'); | ||
+ | |||
+ | pause(5); | ||
+ | |||
+ | %Part (c) ---> Rescaling x(t) to x(2t) | ||
+ | purduebuff = []; | ||
+ | for nn = 1:length(notes) | ||
+ | t = 0:delta:times(nn); | ||
+ | purdue = sin(2*pi*2*t*notes(nn)); | ||
+ | purduebuff = [purduebuff;purdue(:)]; | ||
+ | end | ||
+ | sound(purduebuff,1/delta); | ||
+ | wavwrite(purduebuff,1/delta,16,'purdue(2t).wav'); | ||
+ | |||
+ | pause(3); | ||
+ | </pre> |
Latest revision as of 08:46, 2 September 2008
Audio Files
Only did the first few seconds of the song
M-File
% Aishwar Sabesan % M-file for playing "Hail Purdue" song % Homework 1.1 -- ECE301 %Part (a) ---> Playing the song delta = 0.000005; x = 264; C = x; D = 9*x/8; E = 5*x/4; F = 4*x/3; G = 3*x/2; A = 5*x/3; B = 15*x/8; CH = 2*x; Bb = ((B-A)/2)+A; notes = [C, D, E, F, G, A, A, Bb, Bb, Bb, F, G, A]; times = [1, 0.5, 0.5, 0.75, 0.25, 0.5, 0.5, 0.4, 0.2, 0.2, 0.5, 0.5, 1]; purduebuff = []; for ii = 1:length(notes) t = 0:delta:times(ii); purdue = sin(2*pi*t*notes(ii)); purduebuff = [purduebuff; purdue(:)]; end sound(purduebuff,1/delta); wavwrite(purduebuff, 1/delta, 16, 'purdue.wav'); pause(7); %Part (b) --> Playing the song at 2x sound(purduebuff, 2/delta); wavwrite(purduebuff,2/delta,16,'purduex2.wav'); pause(5); %Part (c) ---> Rescaling x(t) to x(2t) purduebuff = []; for nn = 1:length(notes) t = 0:delta:times(nn); purdue = sin(2*pi*2*t*notes(nn)); purduebuff = [purduebuff;purdue(:)]; end sound(purduebuff,1/delta); wavwrite(purduebuff,1/delta,16,'purdue(2t).wav'); pause(3);