%Artyom Melanich %ECE301 homework#1 clc clear %part A %question 1 (original track)

% constants fA = 440; %frequency in HZ of 4th note delta = .0001; % step of the time temp = 112/60; % beats per second

% defining all notes frequencies in Hz

Bflat = (2^(1/12))*fA; % B-flat note frequency in Hz Dflat = (2^(4/12))*fA; % D-flat note frequency in Hz C_note = (2^(3/12))*fA; % C note frequency in Hz G_note = (2^(-2/12))*fA; % G note frequency in Hz

% duration of every note and temp

beat_len = 1/temp; % length of the full beat Half = 0:delta:(beat_len*2); % duration of the half note Quarter = 0:delta:beat_len; % duration of the quarter note Eigth = 0:delta:(beat_len/2); % duration of the eigth note Dotted = 0:delta:(beat_len*3/2); % duration of the dotted note

% notes with certain durations

Quarter_Bflat = sin(2*pi*Bflat*Quarter); % Quarter B-flat note Half_C_note = sin(2*pi*C_note*Half); % Half C note Eigth_Dflat = sin(2*pi*Dflat*Eigth); % Eigth D-flat note Quarter_G_note = sin(2*pi*G_note*Quarter); % Quarter G note Dotted_Quater_C_note = sin(2*pi*C_note*Dotted); % Dotted quarter C note

% Track operations

track = [Quarter_G_note,Quarter_Bflat,Dotted_Quater_C_note,Quarter_G_note,Quarter_Bflat,Eigth_Dflat,Half_C_note,Quarter_G_note,Quarter_Bflat,Dotted_Quater_C_note,Quarter_Bflat,Quarter_G_note]; % Creates the track linearly sound(track,1/delta) % plays created track wavwrite(track, 1/delta, 'Smoke on Water-Deep Purple (original)'); % Creates a 'Smoke on Water-Deep Purple (original)' file

% question 2 (faster track)

fA = 440; %frequency in HZ of 4th note temp = 2*112/60; % beats per second beat_len = 1/temp; % length of the full beat delta = .0001; % step of the time

% defining all notes frequencies in Hz

Bflat = 2^(1/12)*fA; % B-flat note frequency in Hz Dflat = 2^(6/12)*fA; % D-flat note frequency in Hz C_note = 2^(3/12)*fA; % C note frequency in Hz G_note = 2^(-2/12)*fA; % G note frequency in Hz

% duration of every note and temp

beat_len = 1/temp; % length of the full beat Half = 0:delta:(beat_len*2); % duration of the half note Quarter = 0:delta:beat_len; % duration of the quarter note Eigth = 0:delta:(beat_len/2); % duration of the eigth note Dotted = 0:delta:(beat_len*3/2); % duration of the dotted note

% notes with certain durations

Quarter_Bflat = sin(2*pi*Bflat*Quarter); % Quarter B-flat note Half_C_note = sin(2*pi*C_note*Half); % Half C note Eigth_Dflat = sin(2*pi*Dflat*Eigth); % Eigth D-flat note Quarter_G_note = sin(2*pi*G_note*Quarter); % Quarter G note Dotted_Quater_C_note = sin(2*pi*C_note*Dotted); % Dotted quarter C note

% Track operations

track_f = [Quarter_G_note,Quarter_Bflat,Dotted_Quater_C_note,Quarter_G_note,Quarter_Bflat,Eigth_Dflat,Half_C_note,Quarter_G_note,Quarter_Bflat,Dotted_Quater_C_note,Quarter_Bflat,Quarter_G_note]; % Creates the track linearly sound(track_f,1/delta) % plays created track_f wavwrite(track_f, 1/delta, 'Smoke on Water-Deep Purple (faster)'); % Creates a 'Smoke on Water-Deep Purple (faster)' faster file

% question 3 (modified track)

% constants fA = 2*440; %frequency in HZ of 4th note delta = .0001; % step of the time temp = 112/60; % beats per second

% defining all notes frequencies in Hz

Bflat = 2^(1/12)*fA; % B-flat note frequency in Hz Dflat = 2^(6/12)*fA; % D-flat note frequency in Hz C_note = 2^(3/12)*fA; % C note frequency in Hz G_note = 2^(-2/12)*fA; % G note frequency in Hz

% duration of every note and temp

beat_len = 1/temp; % length of the full beat Half = 0:delta:(beat_len*2); % duration of the half note Quarter = 0:delta:beat_len; % duration of the quarter note Eigth = 0:delta:(beat_len/2); % duration of the eigth note Dotted = 0:delta:(beat_len*3/2); % duration of the dotted note

% notes with certain durations

Quarter_Bflat = sin(2*pi*Bflat*Quarter); % Quarter B-flat note Half_C_note = sin(2*pi*C_note*Half); % Half C note Eigth_Dflat = sin(2*pi*Dflat*Eigth); % Eigth D-flat note Quarter_G_note = sin(2*pi*G_note*Quarter); % Quarter G note Dotted_Quater_C_note = sin(2*pi*C_note*Dotted); % Dotted quarter C note

% Track operations

track_mod = [Quarter_G_note,Quarter_Bflat,Dotted_Quater_C_note,Quarter_G_note,Quarter_Bflat,Eigth_Dflat,Half_C_note,Quarter_G_note,Quarter_Bflat,Dotted_Quater_C_note,Quarter_Bflat,Quarter_G_note]; % Creates the track linearly sound(track_mod,1/delta) % plays created track wavwrite(track_mod, 1/delta, 'Smoke on Water-Deep Purple (modified)'); % Creates a 'Smoke on Water-Deep Purple (modified)' modified file


% Artyom Melanich % ECE 301 % part2 question 1 (to get the message from the flipped song of Beatles)

clc clear

[track, Fs]=wavread('Beatles.wav'); % function that opens the file

sound(track, Fs); % plays the original song forward

track = flipud(track); % flips the song

sound(track, Fs); % plays the flipped song

wavwrite(track, Fs,'Beatles_back_amelanic'); % creates wav file for the flipped song

fprintf('Forward message is Number nine constantly\n'); % prints the forward message fprintf('Backward message sounds like Let me on dead man constantly\n'); % prints the backward message Media:Smoke on Water-Deep Purple (original).wav Media:Smoke on Water-Deep Purple (faster).wav Media:Smoke on Water-Deep Purple (modified).wav Media:Beatles_back_amelanic.wav

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn