%Michaela Carrieres %HW#1
clear; clc;
%SMOKE ON THE WATER
delta = 0.00005;
bpm = 112; %beats per minute
bps = bpm/60; %beats per second
z = zeros(2/delta,1); %silence
%frequencies
freqG = 440*(2^(-2/12)); %frequency of the G note
freqBflat = 440*(2^(1/12)); %frequency of the Bflat note
freqC = 440*(2^(3/12)); %frequency of the C note
freqDflat = 440*(2^(4/12)); %frequency of the Dflat note
%note durations part 1a
durquarter1 = 0:delta:bps/4;%duration of a quarter note
durhalf1 = 0:delta:bps/2;%duration of a half note
durqdot1 = 0:delta:((bps/4) + (bps/8));%duration of a dotted quarter note
dureighth1 = 0:delta:bps/8;%duration of an eighth note
%note durations part 1b
durquarter2 = 0:delta:bps/8; %duration of a quarter note sped up
durhalf2 = 0:delta:bps/4; %duration of a half note sped up
durqdot2 = 0:delta:((bps/4) + (bps/8))/2; %duration of a dotted quarter note sped up
dureighth2 = 0:delta:bps/16; %duration of an eighth note sped up
%notes for song part 1a
G = sin(2*pi*freqG*durquarter1);
Bflat = sin(2*pi*freqBflat*durquarter1);
Cdot = sin(2*pi*freqC*durqdot1);
Dfeight = sin(2*pi*freqDflat*dureighth1);
Chalf = sin(2*pi*freqC*durhalf1);
song1 = [G,Bflat,Cdot,G,Bflat,Dfeight,Chalf,G,Bflat,Cdot,Bflat,G];
sound(song1,1/delta)
sound(z,1/delta)
wavwrite(song1,1/delta,'SmokeOnTheWater_normal');
%notes for song part 1b
G = sin(2*pi*2*freqG*durquarter2);
Bflat = sin(2*pi*2*freqBflat*durquarter2);
Cdot = sin(2*pi*2*freqC*durqdot2);
Dfeight = sin(2*pi*2*freqDflat*dureighth2);
Chalf = sin(2*pi*2*freqC*durhalf2);
song2 = [G,Bflat,Cdot,G,Bflat,Dfeight,Chalf,G,Bflat,Cdot,Bflat,G];
sound(song2,1/delta)
sound(z,1/delta)
wavwrite(song2,1/delta,'SmokeOnTheWater_higherandfaster');
%notes for song part 1c
G = sin(2*2*pi*freqG*durquarter1);
Bflat = sin(2*2*pi*freqBflat*durquarter1);
Cdot = sin(2*2*pi*freqC*durqdot1);
Dfeight = sin(2*2*pi*freqDflat*dureighth1);
Chalf = sin(2*2*pi*freqC*durhalf1);
song3 = [G,Bflat,Cdot,G,Bflat,Dfeight,Chalf,G,Bflat,Cdot,Bflat,G];
sound(song3,1/delta)
sound(z,1/delta)
wavwrite(song3,1/delta,'SmokeOnTheWater_higher');
%BEATLES SONG
[beatles,Fs] = wavread('Beatles.wav');
revbeatles = flipud(beatles); %reversing the clip from the Beatle's song
sound(revbeatles,Fs) %playing the reversed clip
wavwrite(revbeatles, Fs, 'Reversed Beatles');
%Played normally, the song says "number nine"
%Played in reverse, the song sounds like it says "Turn me on done men"
Media:SmokeOnTheWater_normal.wav
Media:SmokeOnTheWater_higherandfaster.wav