(→Matlab code for HAIL PURDUE song) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Matlab code for HAIL PURDUE song== | ==Matlab code for HAIL PURDUE song== | ||
+ | <pre> | ||
%SOURBH RANKA | %SOURBH RANKA | ||
− | |||
%ece 301 | %ece 301 | ||
− | |||
%FOR NORMAL SPEED | %FOR NORMAL SPEED | ||
− | |||
clear;clc; | clear;clc; | ||
− | |||
delta=0.0005; | delta=0.0005; | ||
− | + | %defining time length | |
− | A=0:delta: 1; | + | A=0:delta: 1; %full l |
− | + | B=0:delta:0.5; %half | |
− | B=0:delta:0.5; | + | C=0:delta:0.75; %three quater |
− | + | D=0:delta:0.25; %quater | |
− | C=0:delta:0.75; | + | %define notes |
− | + | ||
− | D=0:delta:0.25; | + | |
− | + | ||
AA=sin(2*pi*220*A); | AA=sin(2*pi*220*A); | ||
− | |||
BB=sin(2*pi*240*B); | BB=sin(2*pi*240*B); | ||
− | |||
CC=1.05*sin(2*pi*275*B); | CC=1.05*sin(2*pi*275*B); | ||
− | |||
DD=1.05*sin(2*pi*295*C); | DD=1.05*sin(2*pi*295*C); | ||
− | + | EE=1.05*sin(2*pi*335*D); | |
− | EE=sin(2*pi* | + | FF=sin(2*pi*365*C); |
− | + | GG=sin(2*pi*400*B); | |
− | FF= | + | HH=sin(2*pi*400*D); |
− | + | II=sin(2*pi*295*B); | |
− | GG=sin(2*pi* | + | |
− | + | ||
− | HH=sin(2*pi*400* | + | |
− | + | ||
− | II=sin(2*pi* | + | |
− | + | ||
JJ= sin(2*pi*350*D); | JJ= sin(2*pi*350*D); | ||
− | |||
KK=sin(2*pi*375*D); | KK=sin(2*pi*375*D); | ||
− | + | tone=[AA BB CC DD EE FF FF GG HH HH II FF JJ KK]; | |
− | tone=[AA BB CC DD FF | + | |
− | + | ||
sound (tone,1/delta); | sound (tone,1/delta); | ||
Line 49: | Line 31: | ||
%FOR DOUBLE THE SPEED | %FOR DOUBLE THE SPEED | ||
− | |||
%JUST MULTIPLY THE 1/DELTA TERM BY TWO | %JUST MULTIPLY THE 1/DELTA TERM BY TWO | ||
− | |||
clear;clc; | clear;clc; | ||
− | |||
delta=0.0005; | delta=0.0005; | ||
− | + | A=0:delta: 1; %full | |
− | A=0:delta: 1; | + | B=0:delta:0.5; %half |
− | + | C=0:delta:0.75; %three quater | |
− | B=0:delta:0.5; | + | D=0:delta:0.25; %quater |
− | + | %defining notes | |
− | C=0:delta:0.75; | + | |
− | + | ||
− | D=0:delta:0.25; | + | |
− | + | ||
AA=sin(2*pi*220*A); | AA=sin(2*pi*220*A); | ||
− | |||
BB=sin(2*pi*240*B); | BB=sin(2*pi*240*B); | ||
− | |||
CC=1.05*sin(2*pi*275*B); | CC=1.05*sin(2*pi*275*B); | ||
− | |||
DD=1.05*sin(2*pi*295*C); | DD=1.05*sin(2*pi*295*C); | ||
− | |||
EE=sin(2*pi*295*B); | EE=sin(2*pi*295*B); | ||
− | |||
FF=1.05*sin(2*pi*335*D); | FF=1.05*sin(2*pi*335*D); | ||
− | |||
GG=sin(2*pi*365*C); | GG=sin(2*pi*365*C); | ||
− | |||
HH=sin(2*pi*400*B); | HH=sin(2*pi*400*B); | ||
− | |||
II=sin(2*pi*400*D); | II=sin(2*pi*400*D); | ||
− | |||
JJ= sin(2*pi*350*D); | JJ= sin(2*pi*350*D); | ||
− | |||
KK=sin(2*pi*375*D); | KK=sin(2*pi*375*D); | ||
− | |||
tone=[AA BB CC DD FF GG GG HH II II EE FF JJ KK]; | tone=[AA BB CC DD FF GG GG HH II II EE FF JJ KK]; | ||
− | |||
sound (tone,1/delta*2); | sound (tone,1/delta*2); | ||
− | |||
%FOR DOUBLE THE PITCH | %FOR DOUBLE THE PITCH | ||
− | |||
%JUST DOUBLE THE FREQUENCY OF EACH TERM | %JUST DOUBLE THE FREQUENCY OF EACH TERM | ||
− | |||
clear;clc; | clear;clc; | ||
− | |||
delta=0.0005; | delta=0.0005; | ||
− | + | %defining times | |
− | A=0:delta: 1; | + | A=0:delta: 1; %full |
− | + | B=0:delta:0.5; %half | |
− | B=0:delta:0.5; | + | C=0:delta:0.75; %three quater |
− | + | D=0:delta:0.25; %quater | |
− | C=0:delta:0.75; | + | %defining tones |
− | + | ||
− | D=0:delta:0.25; | + | |
− | + | ||
AA=sin(2*pi*220*2*A); | AA=sin(2*pi*220*2*A); | ||
− | |||
BB=sin(2*pi*240*2*B); | BB=sin(2*pi*240*2*B); | ||
− | |||
CC=1.05*sin(2*pi*275*2*B); | CC=1.05*sin(2*pi*275*2*B); | ||
− | |||
DD=1.05*sin(2*pi*295*2*C); | DD=1.05*sin(2*pi*295*2*C); | ||
− | |||
EE=sin(2*pi*295*2*B); | EE=sin(2*pi*295*2*B); | ||
− | |||
FF=1.05*sin(2*pi*335*2*D); | FF=1.05*sin(2*pi*335*2*D); | ||
− | |||
GG=sin(2*pi*365*2*C); | GG=sin(2*pi*365*2*C); | ||
− | |||
HH=sin(2*pi*400*2*B); | HH=sin(2*pi*400*2*B); | ||
− | |||
II=sin(2*pi*400*2*D); | II=sin(2*pi*400*2*D); | ||
− | |||
JJ= sin(2*pi*350*2*D); | JJ= sin(2*pi*350*2*D); | ||
− | |||
KK=sin(2*pi*375*2*D); | KK=sin(2*pi*375*2*D); | ||
− | |||
tone=[AA BB CC DD FF GG GG HH II II EE FF JJ KK]; | tone=[AA BB CC DD FF GG GG HH II II EE FF JJ KK]; | ||
− | |||
sound (tone,1/delta); | sound (tone,1/delta); | ||
+ | </pre> |
Latest revision as of 13:41, 5 September 2008
Matlab code for HAIL PURDUE song
%SOURBH RANKA %ece 301 %FOR NORMAL SPEED clear;clc; delta=0.0005; %defining time length A=0:delta: 1; %full l B=0:delta:0.5; %half C=0:delta:0.75; %three quater D=0:delta:0.25; %quater %define notes AA=sin(2*pi*220*A); BB=sin(2*pi*240*B); CC=1.05*sin(2*pi*275*B); DD=1.05*sin(2*pi*295*C); EE=1.05*sin(2*pi*335*D); FF=sin(2*pi*365*C); GG=sin(2*pi*400*B); HH=sin(2*pi*400*D); II=sin(2*pi*295*B); JJ= sin(2*pi*350*D); KK=sin(2*pi*375*D); tone=[AA BB CC DD EE FF FF GG HH HH II FF JJ KK]; sound (tone,1/delta); %FOR DOUBLE THE SPEED %JUST MULTIPLY THE 1/DELTA TERM BY TWO clear;clc; delta=0.0005; A=0:delta: 1; %full B=0:delta:0.5; %half C=0:delta:0.75; %three quater D=0:delta:0.25; %quater %defining notes AA=sin(2*pi*220*A); BB=sin(2*pi*240*B); CC=1.05*sin(2*pi*275*B); DD=1.05*sin(2*pi*295*C); EE=sin(2*pi*295*B); FF=1.05*sin(2*pi*335*D); GG=sin(2*pi*365*C); HH=sin(2*pi*400*B); II=sin(2*pi*400*D); JJ= sin(2*pi*350*D); KK=sin(2*pi*375*D); tone=[AA BB CC DD FF GG GG HH II II EE FF JJ KK]; sound (tone,1/delta*2); %FOR DOUBLE THE PITCH %JUST DOUBLE THE FREQUENCY OF EACH TERM clear;clc; delta=0.0005; %defining times A=0:delta: 1; %full B=0:delta:0.5; %half C=0:delta:0.75; %three quater D=0:delta:0.25; %quater %defining tones AA=sin(2*pi*220*2*A); BB=sin(2*pi*240*2*B); CC=1.05*sin(2*pi*275*2*B); DD=1.05*sin(2*pi*295*2*C); EE=sin(2*pi*295*2*B); FF=1.05*sin(2*pi*335*2*D); GG=sin(2*pi*365*2*C); HH=sin(2*pi*400*2*B); II=sin(2*pi*400*2*D); JJ= sin(2*pi*350*2*D); KK=sin(2*pi*375*2*D); tone=[AA BB CC DD FF GG GG HH II II EE FF JJ KK]; sound (tone,1/delta);