(One intermediate revision by the same user not shown) | |||
Line 42: | Line 42: | ||
%"Number Nine." When reversed, the new file sounds like a man saying "turn | %"Number Nine." When reversed, the new file sounds like a man saying "turn | ||
%me on edmon" or something along those lines. | %me on edmon" or something along those lines. | ||
+ | |||
+ | [[Media:1A.wav]] | ||
+ | [[Media:1B.wav]] | ||
+ | [[Media:1C.wav]] | ||
+ | [[Media:Beatles_Flipped.wav]] |
Latest revision as of 08:25, 19 January 2011
%Shishir Biswas %ECE 301: Signals and Systems %Professor Boutin %Assignment 1 %1/18/2011
clc; clear;
%PART 1 bpm = 112; %Beats per minute bps = 112 / 60; %Beats per second deltat = 5e-5; %Time increment
eighth = 0:deltat:(.5 / bps); %Duration of an eigth note quarter = 0:deltat:(1 / bps); %Duration of a quarter note d_quarter = 0:deltat:(1.5 / bps); %Duration of a dotted quarter note half = 0:deltat:(2 / bps); %Duration of a half note
A = 440; %Frequency of middle A (given) G = (2 ^ (-2 / 12)) * A; %Frequency of G B_flat = (2 ^ (1 / 12)) * A; %Frequency of B flat C = (2 ^ (3 / 12)) * A; %Frequency of C D_flat = (2 ^ (4 / 12)) * A; %Frequency of D flat
melody_1 = [sin(2 * pi * G * quarter), sin(2 * pi * B_flat * quarter), sin(2 * pi * C * d_quarter), sin(2 * pi * G * quarter), sin(2 * pi * B_flat * quarter), sin(2 * pi * D_flat * eighth), sin(2 * pi * C * half), sin(2 * pi * G * quarter), sin(2 * pi * B_flat * quarter), sin(2 * pi * C * d_quarter), sin(2 * pi * B_flat * quarter), sin(2 * pi * G * quarter), sin(0 * half)]; %Pieces together the notes with appropriate durations of the melody wavplay(melody_1, 1 / deltat); %Plays melody wavplay(melody_1, 2 / deltat); %Plays melody twice as fast
melody_2 = [sin(4 * pi * G * quarter), sin(4 * pi * B_flat * quarter), sin(4 * pi * C * d_quarter), sin(4 * pi * G * quarter), sin(4 * pi * B_flat * quarter), sin(4 * pi * D_flat * eighth), sin(4 * pi * C * half), sin(4 * pi * G * quarter), sin(4 * pi * B_flat * quarter), sin(4 * pi * C * d_quarter), sin(4 * pi * B_flat * quarter), sin(4 * pi * G * quarter), sin(0 * half)];%Pieces together the notes with appropriate durations of the melody with the transformation x(2t) wavplay(melody_2, 1 / deltat); %Plays melody
wavwrite(melody_1, 1 / deltat, '1A'); wavwrite(melody_1, 2 / deltat, '1B'); wavwrite(melody_2, 1 / deltat, '1C');
%PART 2 [X, f] = wavread('Beatles.wav'); %Reads the sound file Y = flipud(X); %Reverses the sound file wavwrite(Y, f, 'Beatles_Flipped'); %Writes the reversed sound file into a folder %When played normally, the file sounds like a man repeating the words %"Number Nine." When reversed, the new file sounds like a man saying "turn %me on edmon" or something along those lines.
Media:1A.wav Media:1B.wav Media:1C.wav Media:Beatles_Flipped.wav