(→Matlab File) |
(→Matlab File) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[hail_purdue_ECE301Fall2008mboutin.wav]] | [[hail_purdue_ECE301Fall2008mboutin.wav]] | ||
+ | |||
+ | Please ignore the link above and use the link below instead to get access to the file. | ||
==Matlab File== | ==Matlab File== | ||
Line 45: | Line 47: | ||
%increases, the tune of the song is higher | %increases, the tune of the song is higher | ||
</pre> | </pre> | ||
+ | |||
+ | [[Media:hail_purdue_ECE301Fall2008mboutin.wav]] |
Latest revision as of 16:48, 4 September 2008
hail_purdue_ECE301Fall2008mboutin.wav
Please ignore the link above and use the link below instead to get access to the file.
Matlab File
%Bavorndej Chanyasak %ECE 301 hw1.1 %Problem 1a clear clc %According to the scale from Pythagoras, the following notes are G,G,A,B,C %letting C = 264 Notes = [396, 396, 440, 495, 528]; %This is the duration of each note in the phrase 'Hail Hail to old Purdue' time = [1.4, 0.4, 0.9, 0.7, 0.9]; song = ones(1); for i = 1:5 %5 corresponds to the number of notes played delta = 0.00005; t = 0:delta:time(i) ; y = sin(2*pi*Notes(i)*t); sound (y, 1/delta); song = [song, y]; end %Problem 1b (play twice as fast) for i = 1:5 delta = 0.00005; t = 0:delta:time(i)*0.5 ; y = sin(2*pi*Notes(i)*t); sound (y, 1/delta); song = [song, y]; end %Problem 1c (scaled to y = x(2t) for i = 1:5 delta = 0.00005; t = 0:delta:time(i) ; y = sin(2*pi*Notes(i)*2*t); sound (y, 1/delta); song = [song, y]; end wavwrite(song, 44100, 32, 'hail_purdue.wav') %when the time is decreased, the song is faster, and when the frequency %increases, the tune of the song is higher