(2 intermediate revisions by the same user not shown) | |||
Line 15: | Line 15: | ||
if i == 1<br>wavwrite(tune, 1/delta, 32, 'smoke1a_kellsper')<br>elseif i == 2<br>wavwrite(tune, 1/delta, 32, 'smoke1b_kellsper')<br>else<br>wavwrite(tune, 1/delta, 32, 'smoke1c_kellsper')<br>end | if i == 1<br>wavwrite(tune, 1/delta, 32, 'smoke1a_kellsper')<br>elseif i == 2<br>wavwrite(tune, 1/delta, 32, 'smoke1b_kellsper')<br>else<br>wavwrite(tune, 1/delta, 32, 'smoke1c_kellsper')<br>end | ||
− | |||
end | end | ||
Line 25: | Line 24: | ||
% b.) The backward repeated phrase sounds like "Turn me on, Levmond", if<br>% "Levmond" could be a name. | % b.) The backward repeated phrase sounds like "Turn me on, Levmond", if<br>% "Levmond" could be a name. | ||
+ | |||
+ | |||
+ | [[Image:smoke1a_kellsper.wav]] | ||
+ | |||
+ | [[Image:smoke1b_kellsper.wav]] | ||
+ | |||
+ | [[Image:smoke1c_kellsper.wav]] | ||
+ | |||
+ | [[Image:Beatles_rev_kellsper.wav]] |
Latest revision as of 04:21, 19 January 2011
%Kara Ellspermann
%ECE 301 HW 1
%PART 1, PLAYING MUSIC
for i = 1:3 %loops through for cases a-c
%If a quarter note = 1 beat, a quarter note is the inverse of beats per
%second (beats per minute * 60 seconds)
if i == 2
tempo = 224; %tempo in beats per minute
else
tempo = 112; %tempo in beats per minute
end
beat = 60/tempo; %length of quarter note, in seconds
delta = .00005; %length between steps in matrix
%Note lengths
Q = 0:delta:beat; %length of quarter note
H = 0:delta:2*beat; %length of half note
QD = 0:delta:1.5*beat; %length of quarter dot
E = 0:delta:beat/2; %length of eighth note
%Note frequencies
if i == 3
fA = 880; %frequency of A, reference, in Hz
else
fA = 440; %frequency of A, reference, in Hz
end
fG = 2^(-2/12)*fA; %frequency of G, in Hz
fBb = 2^(1/12)*fA; %frequency of B flat, in Hz
fC = 2^(3/12)*fA; %frequency of C, in Hz
fDb = 2^(4/12)*fA; %frequency of D flat, in Hz
%Notes used
Q_G = sin(2*pi*fG*Q); %quarter note, G
Q_Bb = sin(2*pi*fBb*Q); %quarter note, B flat
QD_C = sin(2*pi*fC*QD); %dotted quarter note, C
E_Db = sin(2*pi*fDb*E); %eighth note, D flat
H_C = sin(2*pi*fC*H); %half note, C
tune = [Q_G,Q_Bb,QD_C,Q_G,Q_Bb,E_Db,H_C,Q_G,Q_Bb,QD_C,Q_Bb,Q_G];
sound(tune, 1/delta)
if i == 1
wavwrite(tune, 1/delta, 32, 'smoke1a_kellsper')
elseif i == 2
wavwrite(tune, 1/delta, 32, 'smoke1b_kellsper')
else
wavwrite(tune, 1/delta, 32, 'smoke1c_kellsper')
end
end
% PART 2, HIDDEN BACKWARD MESSAGE
% a.) The forward repeated phrase is "Number 9".
%Reversing the signal
[Y, Fs] = wavread('Beatles.wav');
Ynew = flipud(Y);
wavwrite(Ynew, Fs, 32, 'Beatles_reversed_kellsper')
sound(Ynew, Fs)
% b.) The backward repeated phrase sounds like "Turn me on, Levmond", if
% "Levmond" could be a name.