(New page: clc<br>clear all<br>close all %%%%%%%%%%%%%%%%%%%%%%% Part 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Part a<br>%Note Frequencies in Hzs B_flat = 2^(1/12)*440; % B Flat Frequency (H...) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | clc<br>clear all<br>close all | + | clc<br>clear all<br>close all |
− | %%%%%%%%%%%%%%%%%%%%%%% Part 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | + | %%%%%%%%%%%%%%%%%%%%%%% Part 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
− | %Part a<br>%Note Frequencies in Hzs | + | %Part a<br>%Note Frequencies in Hzs |
− | B_flat = 2^(1/12)*440; % B Flat Frequency (Hz)<br>C = 2^(3/12)*440; % C Frequency (Hz)<br>D_flat = 2^(6/12)*440; % D Flat Frequency (Hz)<br>G = 2^(-2/12)*440; % G Frequecny (Hz) | + | B_flat = 2^(1/12)*440; % B Flat Frequency (Hz)<br>C = 2^(3/12)*440; % C Frequency (Hz)<br>D_flat = 2^(6/12)*440; % D Flat Frequency (Hz)<br>G = 2^(-2/12)*440; % G Frequecny (Hz) |
− | % Length of each type of note<br>beats_per_min = 112; % The given timing of the song<br>beats_per_second = beats_per_min / 60; % The timing of the song in seconds<br>length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song<br>delta = .0005; % Step size | + | % Length of each type of note<br>beats_per_min = 112; % The given timing of the song<br>beats_per_second = beats_per_min / 60; % The timing of the song in seconds<br>length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song<br>delta = .0005; % Step size |
− | quarter_note = 0:delta:length_of_full_beat; %length of quarter note<br>half_note = 0:delta:(length_of_full_beat*2); %length of half note<br>eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note<br>dotted_quarter_note = 0:delta:(length_of_full_beat*1.5); %length of dotted quarter note | + | quarter_note = 0:delta:length_of_full_beat; %length of quarter note<br>half_note = 0:delta:(length_of_full_beat*2); %length of half note<br>eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note<br>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<br>sound(song,1/delta)%plays orginal song | + | 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<br>sound(song,1/delta)%plays orginal song |
− | wavwrite(song,1/delta,'Smoke on Water (Normal)'); %Writes song to file | + | wavwrite(song,1/delta,'Smoke on Water (Normal)'); %Writes song to file |
− | %Part b <br>beats_per_min = 112*2; % The given timing of the song<br>beats_per_second = beats_per_min / 60; % The timing of the song in seconds<br>length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song<br>delta = .0005; % Step size | + | %Part b <br>beats_per_min = 112*2; % The given timing of the song<br>beats_per_second = beats_per_min / 60; % The timing of the song in seconds<br>length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song<br>delta = .0005; % Step size |
− | quarter_note = 0:delta:length_of_full_beat; %length of quarter note<br>half_note = 0:delta:(length_of_full_beat*2); %length of half note<br>eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note<br>dotted_quarter_note = 0:delta:(length_of_full_beat*1.5); %length of dotted quarter note<br>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<br>sound(song_fast,1/delta)%Plays Song twice as fast<br>wavwrite(song_fast,1/delta,'Smoke on Water (Faster)'); %Writes song to file | + | quarter_note = 0:delta:length_of_full_beat; %length of quarter note<br>half_note = 0:delta:(length_of_full_beat*2); %length of half note<br>eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note<br>dotted_quarter_note = 0:delta:(length_of_full_beat*1.5); %length of dotted quarter note<br>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<br>sound(song_fast,1/delta)%Plays Song twice as fast<br>wavwrite(song_fast,1/delta,'Smoke on Water (Faster)'); %Writes song to file |
− | %Part C<br>beats_per_min = 112; % The given timing of the song<br>beats_per_second = beats_per_min / 60; % The timing of the song in seconds<br>length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song<br>delta = .0005; % Step size | + | %Part C<br>beats_per_min = 112; % The given timing of the song<br>beats_per_second = beats_per_min / 60; % The timing of the song in seconds<br>length_of_full_beat = 1 / beats_per_second; % the lenght of a measure of the song<br>delta = .0005; % Step size |
− | quarter_note = 0:delta:length_of_full_beat; %length of quarter note<br>half_note = 0:delta:(length_of_full_beat*2); %length of half note<br>eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note<br>dotted_quarter_note = 0:delta:(length_of_full_beat*1.5); %length of dotted quarter note | + | quarter_note = 0:delta:length_of_full_beat; %length of quarter note<br>half_note = 0:delta:(length_of_full_beat*2); %length of half note<br>eighth_note = 0:delta:(length_of_full_beat/2); % length of eight note<br>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<br>sound(song_transformed,2/delta)%Plays Song transformes | + | 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<br>sound(song_transformed,2/delta)%Plays Song transformes |
− | wavwrite(song_transformed,2/delta,'Smoke on Water (Transformed)'); %Writes song to file | + | wavwrite(song_transformed,2/delta,'Smoke on Water (Transformed)'); %Writes song to file |
− | %%%%%%%%%%%%%%%%%%%% Part 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | + | %%%%%%%%%%%%%%%%%%%% Part 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
− | [The_Beatles,Fs] = wavread('Beatles.wav');%Reads the song from the file<br>sound(The_Beatles,Fs) % Plays the song<br>The_Beatles_reversed = flipud(The_Beatles); % flips the song file<br>pause(30) %pauses the songs so they dont overlap<br>sound(The_Beatles_reversed,Fs) % Plays the new song<br>wavwrite(The_Beatles_reversed,Fs,'The Beatles (reversed)') %writes the new song to a file | + | [The_Beatles,Fs] = wavread('Beatles.wav');%Reads the song from the file<br>sound(The_Beatles,Fs) % Plays the song<br>The_Beatles_reversed = flipud(The_Beatles); % flips the song file<br>pause(30) %pauses the songs so they dont overlap<br>sound(The_Beatles_reversed,Fs) % Plays the new song<br>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<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> | ||
+ | |||
+ | 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 | ||
+ | |||
+ | https://www.projectrhea.org/rhea/images/2/27/The_Beatles_(reversed).wav |
Latest 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
https://www.projectrhea.org/rhea/images/2/27/The_Beatles_(reversed).wav