Wav Files

Matlab Code

%I-Cheng Chen
%09/05/08
%ECE301 hw1.1

% clear memory
clear;

% clear console
clc;

% PART A

delta = 0.0005;
H=0:delta: 1;          %half
Q=0:delta:0.5;         %quacter
DQ_time=0:delta:0.75;  %dotted quacter
EN=0:delta:0.25;       %one eighth

%Assign signals for each used note
C=sin(2*pi*264*Q);
C_high=sin(4*pi*264*Q);
CDQ=sin(2*pi*264*DQ_time);
CEN=sin(2*pi*264*EN);
D=sin(2*pi*297*Q);
DH=sin(2*pi*297*H);
E=sin(2*pi*330*Q);
EH=sin(2*pi*330*H);
F=sin(2*pi*352*Q);
FH=sin(2*pi*352*H);
G=sin(2*pi*396*Q);
A=sin(2*pi*440*Q);
BDQ_flat=sin(2*pi*466*DQ_time);
BEN_flat=sin(2*pi*466*EN);

%Happy Birthday Song
notes= [CDQ CEN D C F EH CDQ CEN D C G FH CDQ CEN C_high A F E DH BDQ_flat BEN_flat A F G FH ];

sound (notes,1/delta);
wavwrite(notes,1/delta,32,'music_a.wav');

% PART B

%2 time faster!!!
%cut the time in half
delta = 0.0005;
H=0:delta: 0.5;
Q=0:delta:0.25;
DQ_time=0:delta:0.375;
EN=0:delta:0.125;

%Assign signals for each used note
C=sin(2*pi*264*Q);
C_high=sin(4*pi*264*Q);
CDQ=sin(2*pi*264*DQ_time);
CEN=sin(2*pi*264*EN);
D=sin(2*pi*297*Q);
DH=sin(2*pi*297*H);
E=sin(2*pi*330*Q);
EH=sin(2*pi*330*H);
F=sin(2*pi*352*Q);
FH=sin(2*pi*352*H);
G=sin(2*pi*396*Q);
A=sin(2*pi*440*Q);
BDQ_flat=sin(2*pi*466*DQ_time);
BEN_flat=sin(2*pi*466*EN);

%Happy Birthday Song
notes= [CDQ CEN D C F EH CDQ CEN D C G FH CDQ CEN C_high A F E DH BDQ_flat BEN_flat A F G FH ];

sound (notes,1/delta);
wavwrite(notes,1/delta,32,'music_b.wav');

% PART C

%Make delta back to normal speed
delta = 0.0005;
H=0:delta: 1;
Q=0:delta:0.5;
DQ_time=0:delta:0.75;
EN=0:delta:0.25;

%Increaes the frequence, will increaes the pitch

C=sin(4*pi*264*Q);
C_high=sin(8*pi*264*Q);
CDQ=sin(4*pi*264*DQ_time);
CEN=sin(4*pi*264*EN);
D=sin(4*pi*297*Q);
DH=sin(4*pi*297*H);
E=sin(4*pi*330*Q);
EH=sin(4*pi*330*H);
F=sin(4*pi*352*Q);
FH=sin(4*pi*352*H);
G=sin(4*pi*396*Q);
A=sin(4*pi*440*Q);
BDQ_flat=sin(4*pi*466*DQ_time);
BEN_flat=sin(4*pi*466*EN);

%Happy Birthday Song
notes= [CDQ CEN D C F EH CDQ CEN D C G FH CDQ CEN C_high A F E DH BDQ_flat BEN_flat A F G FH ];

sound (notes,1/delta);
wavwrite(notes,1/delta,32,'music_c.wav');

Alumni Liaison

Sees the importance of signal filtering in medical imaging

Dhruv Lamba, BSEE2010