(3 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
beats = 60 / 112; %Length of each beat based off 112 beats per minute | beats = 60 / 112; %Length of each beat based off 112 beats per minute | ||
+ | |||
d = 0.00005; %Delta which describes how many timeframes there are | d = 0.00005; %Delta which describes how many timeframes there are | ||
+ | |||
%Defining length of beat | %Defining length of beat | ||
+ | |||
Q = 0:d:beats; % Quarter Note | Q = 0:d:beats; % Quarter Note | ||
+ | |||
H = 0:d:beats * 2; % Half Note | H = 0:d:beats * 2; % Half Note | ||
+ | |||
E = 0:d:beats * (1/2); % Eighth Note | E = 0:d:beats * (1/2); % Eighth Note | ||
+ | |||
DQ = 0:d:beats * (3/2); % Dotted Quarter Note | DQ = 0:d:beats * (3/2); % Dotted Quarter Note | ||
+ | |||
%Relating notes to A4 and associating notes to appropriate length | %Relating notes to A4 and associating notes to appropriate length | ||
+ | |||
note_G = sin(2 * pi * 2 ^ ((-2) / 12) * 440 * Q); %Quarter G note | note_G = sin(2 * pi * 2 ^ ((-2) / 12) * 440 * Q); %Quarter G note | ||
+ | |||
note_Bflat = sin(2 * pi * 2 ^ ((1) / 12) * 440 * Q); %Quarter Bflat note | note_Bflat = sin(2 * pi * 2 ^ ((1) / 12) * 440 * Q); %Quarter Bflat note | ||
+ | |||
note_C1 = sin(2* pi * 2 ^ (3 / 12) * 440 * DQ); %Dotted quarter C note | note_C1 = sin(2* pi * 2 ^ (3 / 12) * 440 * DQ); %Dotted quarter C note | ||
+ | |||
note_C2 = sin(2* pi * 2 ^ (3 / 12) * 440 * H); %Half C note | note_C2 = sin(2* pi * 2 ^ (3 / 12) * 440 * H); %Half C note | ||
+ | |||
note_Dflat = sin(2 * pi * 2 ^ (4 / 12) * 440 * E); %Eighth Dflat note | note_Dflat = sin(2 * pi * 2 ^ (4 / 12) * 440 * E); %Eighth Dflat note | ||
+ | |||
%Transforming the sound(q denotes quicker) | %Transforming the sound(q denotes quicker) | ||
+ | |||
q_note_G = sin(2 * pi * 2 ^ ((-2) / 12) * 440 * Q * 2); | q_note_G = sin(2 * pi * 2 ^ ((-2) / 12) * 440 * Q * 2); | ||
+ | |||
q_note_Bflat = sin(2 * pi * 2 ^ ((1) / 12) * 440 * Q * 2); | q_note_Bflat = sin(2 * pi * 2 ^ ((1) / 12) * 440 * Q * 2); | ||
+ | |||
q_note_C1 = sin(2* pi * 2 ^ (3 / 12) * 440 * DQ * 2); | q_note_C1 = sin(2* pi * 2 ^ (3 / 12) * 440 * DQ * 2); | ||
+ | |||
q_note_C2 = sin(2* pi * 2 ^ (3 / 12) * 440 * H * 2); | q_note_C2 = sin(2* pi * 2 ^ (3 / 12) * 440 * H * 2); | ||
+ | |||
q_note_Dflat = sin(2 * pi * 2 ^ (4 / 12) * 440 * E * 2); | q_note_Dflat = sin(2 * pi * 2 ^ (4 / 12) * 440 * E * 2); | ||
+ | |||
%Arranging the notes into their respective order | %Arranging the notes into their respective order | ||
− | Score1 = [note_G, note_Bflat, note_C1, note_G, note_Bflat, note_Dflat, note_C2, note_G, note_Bflat, note_C1, note_Bflat, note_G]; | + | |
+ | Score1 = [note_G, note_Bflat, note_C1, note_G, note_Bflat, note_Dflat, note_C2, note_G, note_Bflat, note_C1, | ||
+ | note_Bflat, note_G]; | ||
+ | |||
Score2 = [note_G, note_Bflat, note_C1, note_G, note_Bflat, note_Dflat, note_C2, note_G, note_Bflat, note_C1, note_Bflat, note_G]; | Score2 = [note_G, note_Bflat, note_C1, note_G, note_Bflat, note_Dflat, note_C2, note_G, note_Bflat, note_C1, note_Bflat, note_G]; | ||
+ | |||
Score3 = [q_note_G, q_note_Bflat, q_note_C1, q_note_G, q_note_Bflat, q_note_Dflat, q_note_C2, q_note_G, q_note_Bflat, q_note_C1, q_note_Bflat, q_note_G]; | Score3 = [q_note_G, q_note_Bflat, q_note_C1, q_note_G, q_note_Bflat, q_note_Dflat, q_note_C2, q_note_G, q_note_Bflat, q_note_C1, q_note_Bflat, q_note_G]; | ||
+ | |||
%Playing the song | %Playing the song | ||
+ | |||
sound(Score1,1/d) %At original tempo | sound(Score1,1/d) %At original tempo | ||
+ | |||
sound(Score2,2/d) %Twice as fast | sound(Score2,2/d) %Twice as fast | ||
+ | |||
sound(Score3,1/d) %Transformed | sound(Score3,1/d) %Transformed | ||
wavwrite(Score1,1/d,'Hw_1_ECE301_Comasco_Orig_Tempo') | wavwrite(Score1,1/d,'Hw_1_ECE301_Comasco_Orig_Tempo') | ||
+ | |||
wavwrite(Score2,2/d,'Hw_1_ECE301_Comasco_Two_Times') | wavwrite(Score2,2/d,'Hw_1_ECE301_Comasco_Two_Times') | ||
+ | |||
wavwrite(Score3,1/d,'Hw_1_ECE301_Comasco_x(2t)') | wavwrite(Score3,1/d,'Hw_1_ECE301_Comasco_x(2t)') | ||
Line 60: | Line 89: | ||
%Reading the Beatles File | %Reading the Beatles File | ||
+ | |||
[Y,Fs] = wavread('Beatles.wav'); | [Y,Fs] = wavread('Beatles.wav'); | ||
+ | |||
%Flipping the file backwards | %Flipping the file backwards | ||
+ | |||
X = flipud(Y); | X = flipud(Y); | ||
+ | |||
%Playing the reversed message | %Playing the reversed message | ||
+ | |||
sound(30 * X,Fs) | sound(30 * X,Fs) | ||
Latest revision as of 16:14, 18 January 2011
% Michael Comasco % ECE 301 % Homework 1 % January 19, 2010
clear all clc
% Part 1 - "Smoke on the Water"
beats = 60 / 112; %Length of each beat based off 112 beats per minute
d = 0.00005; %Delta which describes how many timeframes there are
%Defining length of beat
Q = 0:d:beats; % Quarter Note
H = 0:d:beats * 2; % Half Note
E = 0:d:beats * (1/2); % Eighth Note
DQ = 0:d:beats * (3/2); % Dotted Quarter Note
%Relating notes to A4 and associating notes to appropriate length
note_G = sin(2 * pi * 2 ^ ((-2) / 12) * 440 * Q); %Quarter G note
note_Bflat = sin(2 * pi * 2 ^ ((1) / 12) * 440 * Q); %Quarter Bflat note
note_C1 = sin(2* pi * 2 ^ (3 / 12) * 440 * DQ); %Dotted quarter C note
note_C2 = sin(2* pi * 2 ^ (3 / 12) * 440 * H); %Half C note
note_Dflat = sin(2 * pi * 2 ^ (4 / 12) * 440 * E); %Eighth Dflat note
%Transforming the sound(q denotes quicker)
q_note_G = sin(2 * pi * 2 ^ ((-2) / 12) * 440 * Q * 2);
q_note_Bflat = sin(2 * pi * 2 ^ ((1) / 12) * 440 * Q * 2);
q_note_C1 = sin(2* pi * 2 ^ (3 / 12) * 440 * DQ * 2);
q_note_C2 = sin(2* pi * 2 ^ (3 / 12) * 440 * H * 2);
q_note_Dflat = sin(2 * pi * 2 ^ (4 / 12) * 440 * E * 2);
%Arranging the notes into their respective order
Score1 = [note_G, note_Bflat, note_C1, note_G, note_Bflat, note_Dflat, note_C2, note_G, note_Bflat, note_C1, note_Bflat, note_G];
Score2 = [note_G, note_Bflat, note_C1, note_G, note_Bflat, note_Dflat, note_C2, note_G, note_Bflat, note_C1, note_Bflat, note_G];
Score3 = [q_note_G, q_note_Bflat, q_note_C1, q_note_G, q_note_Bflat, q_note_Dflat, q_note_C2, q_note_G, q_note_Bflat, q_note_C1, q_note_Bflat, q_note_G];
%Playing the song
sound(Score1,1/d) %At original tempo
sound(Score2,2/d) %Twice as fast
sound(Score3,1/d) %Transformed
wavwrite(Score1,1/d,'Hw_1_ECE301_Comasco_Orig_Tempo')
wavwrite(Score2,2/d,'Hw_1_ECE301_Comasco_Two_Times')
wavwrite(Score3,1/d,'Hw_1_ECE301_Comasco_x(2t)')
Media:Hw_1_ECE301_Comasco_Orig_Tempo.wav
Media:Hw_1_ECE301_Comasco_Two_Times.wav
Media:Hw_1_ECE301_Comasco_x(2t).wav
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Part 2 - Hidden Backward Message
%Reading the Beatles File
[Y,Fs] = wavread('Beatles.wav');
%Flipping the file backwards
X = flipud(Y);
%Playing the reversed message
sound(30 * X,Fs)
wavwrite(30 * X,Fs,'Hw_1_ECE301_Comasco_Sublim_Message')
Media:Hw_1_ECE301_Comasco_Sublim_Message.wav
%%%%%%%%%%%% %The reversed song does contain a message. It sounds as if the words "Number %Nine" bacwards speak the words "Turn Me On Dead Mend," which would make %that the subliminal message!