Line 1: | Line 1: | ||
− | %Zach Bright | + | %Zach Bright %ECE 301 |
− | %ECE 301 | + | |
− | clc; | + | clc; clear all; |
− | clear all; | + | |
+ | <br> % PART 1 | ||
− | + | <br> delta = 0.00005; | |
+ | for var = 1:3 %beats per minute bpm = 112; | ||
− | + | if var ==2 | |
− | |||
− | |||
− | |||
− | |||
− | |||
bpm=112/2; | bpm=112/2; | ||
− | |||
− | + | end | |
− | + | ||
+ | % beats per second beat = bpm/60; | ||
− | %Eighth note | + | <br> %Eighth note E=0:delta:(beat/8); %Half note H=0:delta:(beat/2); %Dotted Quarter note Dq=0:delta:(beat*(3/8)); %Quarter note Q=0:delta:(beat/4); |
− | E=0:delta:(beat/8); | + | |
− | %Half note | + | |
− | H=0:delta:(beat/2); | + | |
− | %Dotted Quarter note | + | |
− | Dq=0:delta:(beat*(3/8)); | + | |
− | %Quarter note | + | |
− | Q=0:delta:(beat/4); | + | |
+ | <br> %G-note Freq G=391.995; %B-flat freq Bf=466.164; %C freq C=523.251; %D-flat freq Df=554.365; | ||
− | + | if var==3 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | |||
G=2*G; | G=2*G; | ||
− | + | Bf=2*Bf; | |
− | + | C=2*C; | |
− | + | Df=2*Df; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | end %Establish all notes used in the song %in the form of (Note Letter)_(Length Letter)_note=... G_Q_note=sin(2*pi*G*Q); Bf_Q_note=sin(2*pi*Bf*Q); C_Dq_note=sin(2*pi*C*Dq); C_H_note=sin(2*pi*C*H); Df_E_note=sin(2*pi*Df*E); | ||
− | %Song at normal speed | + | <br> %Song at normal speed smoke=[G_Q_note, Bf_Q_note, C_Dq_note, G_Q_note,Bf_Q_note, Df_E_note, C_H_note, G_Q_note, Bf_Q_note, C_Dq_note, Bf_Q_note, G_Q_note]; |
− | smoke=[G_Q_note, Bf_Q_note, C_Dq_note, G_Q_note,Bf_Q_note, Df_E_note, C_H_note, G_Q_note, Bf_Q_note, C_Dq_note, Bf_Q_note, G_Q_note]; | + | |
+ | <br> %create the normal tempo sound file if var==1 | ||
− | |||
− | |||
wavwrite(smoke,1/delta,'smoke_normal.wav'); | wavwrite(smoke,1/delta,'smoke_normal.wav'); | ||
− | %create the fast tempo sound file | + | |
− | elseif var==2 | + | %create the fast tempo sound file elseif var==2 |
+ | |||
wavwrite(smoke,1/delta,'smoke_fast.wav'); | wavwrite(smoke,1/delta,'smoke_fast.wav'); | ||
− | %create the high pitch sound file | + | |
− | else | + | %create the high pitch sound file else |
+ | |||
wavwrite(smoke,1/delta,'smoke_high_pitch.wav'); | wavwrite(smoke,1/delta,'smoke_high_pitch.wav'); | ||
− | |||
− | end | + | end |
− | + | ||
− | % PART 2 | + | end |
+ | |||
+ | % PART 2 | ||
− | % a) The forward meesage from the Beatles is "Number 9" | + | % a) The forward meesage from the Beatles is "Number 9" |
− | % reverse signal | + | % reverse signal [Beatles_normal, Fs]=wavread('Beatles.wav'); Beatles_reverse=flipud(Beatles_normal); wavwrite(Beatles_reverse,Fs,'backwards_Beatles') |
− | [Beatles_normal, Fs]=wavread('Beatles.wav'); | + | |
− | Beatles_reverse=flipud(Beatles_normal); | + | |
− | wavwrite(Beatles_reverse,Fs,'backwards_Beatles') | + | |
− | % b) In the past I have heard that peolpe | + | % b) In the past I have heard that peolpe think it is saying % "Turn me on dead man." And because of this previous knowledge % it sounds like this, but had I not known this, I probably would % not be able to make anything out. |
− | % | + | |
− | % | + | |
− | % | + |
Revision as of 07:21, 19 January 2011
%Zach Bright %ECE 301
clc; clear all;
% PART 1
delta = 0.00005;
for var = 1:3 %beats per minute bpm = 112;
if var ==2
bpm=112/2;
end
% beats per second beat = bpm/60;
%Eighth note E=0:delta:(beat/8); %Half note H=0:delta:(beat/2); %Dotted Quarter note Dq=0:delta:(beat*(3/8)); %Quarter note Q=0:delta:(beat/4);
%G-note Freq G=391.995; %B-flat freq Bf=466.164; %C freq C=523.251; %D-flat freq Df=554.365;
if var==3
G=2*G; Bf=2*Bf; C=2*C; Df=2*Df;
end %Establish all notes used in the song %in the form of (Note Letter)_(Length Letter)_note=... G_Q_note=sin(2*pi*G*Q); Bf_Q_note=sin(2*pi*Bf*Q); C_Dq_note=sin(2*pi*C*Dq); C_H_note=sin(2*pi*C*H); Df_E_note=sin(2*pi*Df*E);
%Song at normal speed smoke=[G_Q_note, Bf_Q_note, C_Dq_note, G_Q_note,Bf_Q_note, Df_E_note, C_H_note, G_Q_note, Bf_Q_note, C_Dq_note, Bf_Q_note, G_Q_note];
%create the normal tempo sound file if var==1
wavwrite(smoke,1/delta,'smoke_normal.wav');
%create the fast tempo sound file elseif var==2
wavwrite(smoke,1/delta,'smoke_fast.wav');
%create the high pitch sound file else
wavwrite(smoke,1/delta,'smoke_high_pitch.wav');
end
end
% PART 2
% a) The forward meesage from the Beatles is "Number 9"
% reverse signal [Beatles_normal, Fs]=wavread('Beatles.wav'); Beatles_reverse=flipud(Beatles_normal); wavwrite(Beatles_reverse,Fs,'backwards_Beatles')
% b) In the past I have heard that peolpe think it is saying % "Turn me on dead man." And because of this previous knowledge % it sounds like this, but had I not known this, I probably would % not be able to make anything out.