Line 7: | Line 7: | ||
BPM = 112; % beats per minute | BPM = 112; % beats per minute | ||
BPS = 60/BPM; % beats per second | BPS = 60/BPM; % beats per second | ||
− | delta = 0.00005; | + | delta = 0.00005; % Time step |
Q = [0:delta:BPS]; | Q = [0:delta:BPS]; | ||
E = [0:delta:BPS/2]; | E = [0:delta:BPS/2]; |
Latest revision as of 10:48, 19 January 2011
% Hale Petersen % ECE 301 HW # 1
clc
% Q.1 - Part 1: original tempo BPM = 112; % beats per minute BPS = 60/BPM; % beats per second delta = 0.00005; % Time step Q = [0:delta:BPS]; E = [0:delta:BPS/2]; DQ = [0:delta:BPS*1.5]; H = [0:delta:BPS*2];
%Notes Q_G = sin(2*pi*(2^(-2/12)*440)*Q); Q_BF = sin(2*pi*(2^(1/12)*440)*Q); DQ_C = sin(2*pi*(2^(3/12)*440)*DQ); E_DF = sin(2*pi*(2^(4/12)*440)*E); H_C = sin(2*pi*(2^(3/12)*440)*H);
song1 = [Q_G, Q_BF, DQ_C, Q_G, Q_BF, E_DF, H_C, Q_G, Q_BF, DQ_C, Q_BF, Q_G]; sound(song1, 1/delta); pause(10);
% Part 2: 2 times faster by dividing the BPS by 2 Q = [0:delta:BPS/2]; E = [0:delta:BPS/4]; DQ = [0:delta:BPS*1.5/2]; H = [0:delta:BPS];
%Notes Q_G = sin(2*pi*(2^(-2/12)*440)*Q); Q_BF = sin(2*pi*(2^(1/12)*440)*Q); DQ_C = sin(2*pi*(2^(3/12)*440)*DQ); E_DF = sin(2*pi*(2^(4/12)*440)*E); H_C = sin(2*pi*(2^(3/12)*440)*H);
song2 = [Q_G, Q_BF, DQ_C, Q_G, Q_BF, E_DF, H_C, Q_G, Q_BF, DQ_C, Q_BF, Q_G]; sound(song2, 1/delta); pause(10);
% part 3: rescaling by doubling the frequency to 880 Q = [0:delta:BPS]; E = [0:delta:BPS/2]; DQ = [0:delta:BPS*1.5]; H = [0:delta:BPS*2];
%Notes Q_G = sin(2*pi*(2^(-2/12)*880)*Q); Q_BF = sin(2*pi*(2^(1/12)*880)*Q); DQ_C = sin(2*pi*(2^(3/12)*880)*DQ); E_DF = sin(2*pi*(2^(4/12)*880)*E); H_C = sin(2*pi*(2^(3/12)*880)*H);
song3 = [Q_G, Q_BF, DQ_C, Q_G, Q_BF, E_DF, H_C, Q_G, Q_BF, DQ_C, Q_BF, Q_G]; sound(song3, 1/delta); pause(10);
% Q.2 Hidden backward message [beatles, Fs] = wavread('Beatles.wav'); beatles_reverse = flipud(beatles); sound(beatles_reverse,Fs);
%Q.1 - The forward repeating phrase is "number nine" %Q.2 - I believe the reverse says "turn me on dead man"