% Jordan Ramer
% ECE 301
% Homework 1
%%%%%Part 1%%%%%
delta = .00005; %step size
for m = 1:3 %cycles through parts a,b,c (starts with a)
spb = 60 / 112; % seconds per beat
if m==2 %part b
spb = spb / 2; % twice the speed
end
hlf = 0:delta:spb*2; % half note length
dtqtr = 0:delta:spb*1.5; % dotted quarter note length
qtr = 0:delta:spb*1; % quarter note length
eighth = 0:delta:spb/2; % eighth note length
%frequency of the notes used
rest = 0;
A = 440;
G = 2^(-2/12) * A;
Bfl = 2^(1/12)* A;
C = 2^(3/12) * A;
Dfl = 2 ^ (4/12) * A;
if m == 3 % part c
%doubled frequencies
A = A*2;
G = G*2;
Bfl = Bfl *2;
C = C*2;
Dfl = Dfl*2;
end
smoke = [G*qtr,Bfl*qtr,C*dtqtr,G*qtr,Bfl*qtr,Dfl*eighth,C*hlf,G*qtr,Bfl*qtr,C*dtqtr,Bfl*qtr,G*qtr,rest*eighth,rest*hlf]; %song notes
smoke = sin(2*pi*smoke); %converts notes to sine wave
sound(smoke,1/delta) % plays song
%write audio files for a,b, and c
if m==2 %part b
wavwrite(smoke,1/delta,'part_b.wav');
elseif m==3 %part c
wavwrite(smoke,1/delta,'part_c.wav');
else %part a
wavwrite(smoke,1/delta,'part_a.wav');
end
end
%%%%%Part 2%%%%%
% a) The repeated phrase is "number 9"
[beatles,fs] = wavread('Beatles.wav'); %extracts data and frequency
reverse = flipud(beatles); % reverses data
sound(reverse,fs); % plays reversed song
wavwrite(reverse,fs,'reverse.wav');
% b) I don't think there is a message if I had to pick something out
% maybe "here me yonder men"?
Sound Files
Media:part_a.wav
Media:part_b.wav
Media:part_c.wav
Media:Jmramer_reverse.wav