clear
clc
%Global Variables
Gfreq = 2^(-2/12)*440; %Frequency of a G
Bbfreq = 2^(1/12)*440; %Frequency of a B flat
Cfreq = 2^(3/12)*440; %Frequency of a C
Dbfreq = 2^(4/12)*440; %Frequency of a D flat
delta = 1/8192; %Sampling Frequency
bpm = 112; %Beat per minute
bps = bpm/60; %Beats per second
Qnote = 1/bps; %Length of a quater note in seconds
Qlength = 0:delta:Qnote; %Array for a quater note
Elength = 0:delta:Qnote/2; %Array for an eighth note
DQlength = 0:delta:Qnote*1.5; %Array for a dotted quater note
Hlength = 0:delta:Qnote*2; %Array for a half note
%Song
GQnote = sin(2*pi*Gfreq*Qlength); %G with a quater note length
BbQnote = sin(2*pi*Bbfreq*Qlength); %G with a quater note length
CDQnote = sin(2*pi*Cfreq*DQlength); %G with a quater note length
DbEnote = sin(2*pi*Dbfreq*Elength); %G with a quater note length
CHnote = sin(2*pi*Cfreq*Hlength); %G with a quater note length
Erest = 0*Elength; %G with a quater note length
Hrest = 0*Hlength; %G with a quater note length
SotW = [GQnote,BbQnote,CDQnote,GQnote,BbQnote,DbEnote,CHnote,GQnote,BbQnote,CDQnote,BbQnote,GQnote,Erest,Hrest];
%Song
sound(SotW,1/delta) %Regular speed
wavwrite(SotW,1/delta,'Smoke Regular'); %Regular speed
Qnote = 1/(2*bps); %Length of a quater note in seconds
Qlength = 0:delta:Qnote; %Array for a quater note
Elength = 0:delta:Qnote/2; %Array for an eighth note
DQlength = 0:delta:Qnote*1.5; %Array for a dotted quater note
Hlength = 0:delta:Qnote*2; %Array for a half note
%Song
GQnote = sin(2*pi*Gfreq*Qlength); %G with a quater note length
BbQnote = sin(2*pi*Bbfreq*Qlength); %G with a quater note length
CDQnote = sin(2*pi*Cfreq*DQlength); %G with a quater note length
DbEnote = sin(2*pi*Dbfreq*Elength); %G with a quater note length
CHnote = sin(2*pi*Cfreq*Hlength); %G with a quater note length
Erest = 0*Elength; %G with a quater note length
Hrest = 0*Hlength; %G with a quater note length
SotW = [GQnote,BbQnote,CDQnote,GQnote,BbQnote,DbEnote,CHnote,GQnote,BbQnote,CDQnote,BbQnote,GQnote,Erest,Hrest];
%Song
sound(SotW,1/delta) %Twice the Speed
wavwrite(SotW,1/delta,'Smoke Twice Speed'); %Twice the Speed
Qnote = 2/bps; %Length of a quater note in seconds
Qlength = 0:delta:Qnote; %Array for a quater note
Elength = 0:delta:Qnote/2; %Array for an eighth note
DQlength = 0:delta:Qnote*1.5; %Array for a dotted quater note
Hlength = 0:delta:Qnote*2; %Array for a half note
%Song
GQnote = sin(2*pi*Gfreq*Qlength); %G with a quater note length
BbQnote = sin(2*pi*Bbfreq*Qlength); %G with a quater note length
CDQnote = sin(2*pi*Cfreq*DQlength); %G with a quater note length
DbEnote = sin(2*pi*Dbfreq*Elength); %G with a quater note length
CHnote = sin(2*pi*Cfreq*Hlength); %G with a quater note length
Erest = 0*Elength; %G with a quater note length
Hrest = 0*Hlength; %G with a quater note length
SotW = [GQnote,BbQnote,CDQnote,GQnote,BbQnote,DbEnote,CHnote,GQnote,BbQnote,CDQnote,BbQnote,GQnote,Erest,Hrest];
%Song
sound(SotW,1/delta) %Twice the Length
wavwrite(SotW,1/delta,'Smoke Half Speed'); %Twice the Length
[Beatles,Fs] = wavread('Beatles.wav'); %Creating an array of the Beatles Song
Bealtesrev = flipud(Beatles); %Reversing the Song
sound(Beatlesrev,Fs)
wavwrite(Beatlesrev,Fs,'Bealtes song backwards');
%Fowards is Number Nine and reverse is Turn me on dead man
I could not attach sound files due to the fact that Purdue Computers do not allow you to access files that are saved to the Q: (default) drive.