Line 33: | Line 33: | ||
% The normal Song says 'number nine' over and over again<br>% The reversed Song Says "let me on the money" | % The normal Song says 'number nine' over and over again<br>% The reversed Song Says "let me on the money" | ||
− | <br> | + | <br> |
+ | |||
+ | https://www.projectrhea.org/rhea/images/e/ee/Song_%28normal%29.ogg | ||
+ | |||
+ | https://www.projectrhea.org/rhea/images/0/0f/Smoke_on_Water_(Faster).wav<br> | ||
+ | |||
+ | https://www.projectrhea.org/rhea/images/2/24/Smoke_on_Water_%28Transformed%29.wav<br> |
Revision as of 14:22, 18 January 2011
clc
clear all
close all
%%%%%%%%%%%%%%%%%%%%%%% Part 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Part a
%Note Frequencies in Hzs
B_flat = 2^(1/12)*440; % B Flat Frequency (Hz)
C = 2^(3/12)*440; % C Frequency (Hz)
D_flat = 2^(6/12)*440; % D Flat Frequency (Hz)
G = 2^(-2/12)*440; % G Frequecny (Hz)
% Length of each type of note
beats_per_min = 112; % The given timing of the song
beats_per_second = beats_per_min / 60; % The timing of the song in seconds
length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song
delta = .0005; % Step size
quarter_note = 0:delta:length_of_full_beat; %length of quarter note
half_note = 0:delta:(length_of_full_beat*2); %length of half note
eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note
dotted_quarter_note = 0:delta:(length_of_full_beat*1.5); %length of dotted quarter note
song = [sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*C*dotted_quarter_note),sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*D_flat*eighth_note),sin(2*pi*C*half_note),sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*C*dotted_quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*G*quarter_note)]; % Creates the Song using vectors
sound(song,1/delta)%plays orginal song
wavwrite(song,1/delta,'Smoke on Water (Normal)'); %Writes song to file
%Part b
beats_per_min = 112*2; % The given timing of the song
beats_per_second = beats_per_min / 60; % The timing of the song in seconds
length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song
delta = .0005; % Step size
quarter_note = 0:delta:length_of_full_beat; %length of quarter note
half_note = 0:delta:(length_of_full_beat*2); %length of half note
eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note
dotted_quarter_note = 0:delta:(length_of_full_beat*1.5); %length of dotted quarter note
song_fast = [sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*C*dotted_quarter_note),sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*D_flat*eighth_note),sin(2*pi*C*half_note),sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*C*dotted_quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*G*quarter_note)]; % Creates the Song using vectors
sound(song_fast,1/delta)%Plays Song twice as fast
wavwrite(song_fast,1/delta,'Smoke on Water (Faster)'); %Writes song to file
%Part C
beats_per_min = 112; % The given timing of the song
beats_per_second = beats_per_min / 60; % The timing of the song in seconds
length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song
delta = .0005; % Step size
quarter_note = 0:delta:length_of_full_beat; %length of quarter note
half_note = 0:delta:(length_of_full_beat*2); %length of half note
eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note
dotted_quarter_note = 0:delta:(length_of_full_beat*1.5); %length of dotted quarter note
song_transformed = [sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*C*dotted_quarter_note),sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*D_flat*eighth_note),sin(2*pi*C*half_note),sin(2*pi*G*quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*C*dotted_quarter_note),sin(2*pi*B_flat*quarter_note),sin(2*pi*G*quarter_note)]; % Creates the Song using vectors
sound(song_transformed,2/delta)%Plays Song transformes
wavwrite(song_transformed,2/delta,'Smoke on Water (Transformed)'); %Writes song to file
%%%%%%%%%%%%%%%%%%%% Part 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[The_Beatles,Fs] = wavread('Beatles.wav');%Reads the song from the file
sound(The_Beatles,Fs) % Plays the song
The_Beatles_reversed = flipud(The_Beatles); % flips the song file
pause(30) %pauses the songs so they dont overlap
sound(The_Beatles_reversed,Fs) % Plays the new song
wavwrite(The_Beatles_reversed,Fs,'The Beatles (reversed)') %writes the new song to a file
% The normal Song says 'number nine' over and over again
% The reversed Song Says "let me on the money"
https://www.projectrhea.org/rhea/images/e/ee/Song_%28normal%29.ogg
https://www.projectrhea.org/rhea/images/0/0f/Smoke_on_Water_(Faster).wav
https://www.projectrhea.org/rhea/images/2/24/Smoke_on_Water_%28Transformed%29.wav