ECE 301: HW1
David Baer
1/19/2011
Question 1: Part 1
The following is the chromatic scale starting on an A:
A, A#/Bb, B, B#/C, C#/Db, D, D#/Eb, E, F, F#/Gb, G, G#/Ab, A
Using this chromatic scale the number of half steps from an A for each of the twelve notes used in the song can be found.
Table 1: Notes and frequencies used in smoke on the water
Note # Note Number of Half steps from A Frequency (Hz)
1 G -2 392
2 Bb 1 466.16
3 C 3 523.25
4 G -2 392
5 Bb 1 466.16
6 Db 4 554.37
7 C 3 523.25
8 G -2 392
9 Bb 1 466.16
10 C 3 523.25
11 Bb 1 466.16
12 G -2 392
Next the length of each note must be found. To do this the number of seconds per beat must be determined. This can be done using the following formula:
Seconds per beat=1/BPM*60Sec/Min=60/112=.5357Sec/Beat
With this information the lengths of each of the four length notes used in the song can be found:
Table 2: Length of time of each note type
Note Name Number of Beats Length of Time Note Numbers Affected
Eighth .5 .2679 6
Quarter 1 .5357 1, 2, 4, 5, 8, 9, 11, 12
Dotted Quarter 1.5 .8036 3, 10
Half 2 1.0714 7
Using this information the following matlab code can be created in order to play the song Smoke on the Water.
% ECE 301 Homework 1
% Code to play the song Smoke on the Water at the correct tempo
% David Baer
clear
clc
Delta = .00001; % The speed at which the sound waves are sampled
%Initializing vectors for each of the four types of notes
Eighth_Length = [0:Delta: .2679];
Quarter_Length = [0: Delta: .5357];
Dotted_Quarter_Length = [0: Delta: .8036];
Half_Length = [0: Delta: 1.0714];
%Creating Vectors for each of the twelve notes used in the song
Note_1 = sin(2*pi*392*Quarter_Length);
Note_2 = sin(2*pi*466.16*Quarter_Length);
Note_3 = sin(2*pi*523.25*Dotted_Quarter_Length);
Note_4 = sin(2*pi*392*Quarter_Length);
Note_5 = sin(2*pi*466.16*Quarter_Length);
Note_6 = sin(2*pi*554.37*Eighth_Length);
Note_7 = sin(2*pi*523.25*Half_Length);
Note_8 = sin(2*pi*392*Quarter_Length);
Note_9 = sin(2*pi*466.16*Quarter_Length);
Note_10 = sin(2*pi*523.25*Dotted_Quarter_Length);
Note_11 = sin(2*pi*466.16*Quarter_Length);
Note_12 = sin(2*pi*392*Quarter_Length);
Song = [Note_1, Note_2, Note_3, Note_4, Note_5, Note_6, Note_7, Note_8, Note_9, Note_10, Note_11, Note_12];
%Playing and writing the song
sound(Song, 1/Delta)
wavwrite(Song, 1/Delta, 'SOTW_Normal.wav')
Question 1: Part 2:
In this part the only difference is that the song will be played two times faster; however, the pitches will be the same.
% ECE 301 Homework 1
% Code to play the song Smoke on the Water at the faster tempo
% David Baer
clear
clc
Delta = .00001; % The speed at which the sound waves are sampled
%Initializing vectors for each of the four types of notes
% This is the only part of the code that is different from the previous
% part
Eighth_Length = [0:Delta: .2679/2];
Quarter_Length = [0: Delta: .5357/2];
Dotted_Quarter_Length = [0: Delta: .8036/2];
Half_Length = [0: Delta: 1.0714/2];
%Creating Vectors for each of the twelve notes used in the song
Note_1 = sin(2*pi*392*Quarter_Length);
Note_2 = sin(2*pi*466.16*Quarter_Length);
Note_3 = sin(2*pi*523.25*Dotted_Quarter_Length);
Note_4 = sin(2*pi*392*Quarter_Length);
Note_5 = sin(2*pi*466.16*Quarter_Length);
Note_6 = sin(2*pi*554.37*Eighth_Length);
Note_7 = sin(2*pi*523.25*Half_Length);
Note_8 = sin(2*pi*392*Quarter_Length);
Note_9 = sin(2*pi*466.16*Quarter_Length);
Note_10 = sin(2*pi*523.25*Dotted_Quarter_Length);
Note_11 = sin(2*pi*466.16*Quarter_Length);
Note_12 = sin(2*pi*392*Quarter_Length);
Song = [Note_1, Note_2, Note_3, Note_4, Note_5, Note_6, Note_7, Note_8, Note_9, Note_10, Note_11, Note_12];
%Playing the song
sound(Song, 1/Delta)
wavwrite(Song, 1/Delta, 'SOTW_Fast.wav')
Question 1: Part 3:
In this part the output follows the formula y(t) = x(2t). This means the effect will be that the output will be double the speed of the input song and it will also be much higher.
% ECE 301 Homework 1
% Code to play the song Smoke on the Water higher and at the faster tempo
% David Baer
clear
clc
Delta = .00001; % The speed at which the sound waves are sampled
%Initializing vectors for each of the four types of notes
Eighth_Length = [0:Delta: .2679];
Quarter_Length = [0: Delta: .5357];
Dotted_Quarter_Length = [0: Delta: .8036];
Half_Length = [0: Delta: 1.0714];
%Creating Vectors for each of the twelve notes used in the song
Note_1 = sin(2*pi*392*Quarter_Length);
Note_2 = sin(2*pi*466.16*Quarter_Length);
Note_3 = sin(2*pi*523.25*Dotted_Quarter_Length);
Note_4 = sin(2*pi*392*Quarter_Length);
Note_5 = sin(2*pi*466.16*Quarter_Length);
Note_6 = sin(2*pi*554.37*Eighth_Length);
Note_7 = sin(2*pi*523.25*Half_Length);
Note_8 = sin(2*pi*392*Quarter_Length);
Note_9 = sin(2*pi*466.16*Quarter_Length);
Note_10 = sin(2*pi*523.25*Dotted_Quarter_Length);
Note_11 = sin(2*pi*466.16*Quarter_Length);
Note_12 = sin(2*pi*392*Quarter_Length);
Song = [Note_1, Note_2, Note_3, Note_4, Note_5, Note_6, Note_7, Note_8, Note_9, Note_10, Note_11, Note_12];
%Playing the song
% This is the only part of the code that has changed from the initial part
sound(Song, 2/Delta)
wavwrite(Song, 2/Delta, 'SOTW_High.wav')
Question 2:
When the segment of the song is played forward it sounds like they are saying ‘Number 9’ many times. The following piece of code will reverse the song and write it to a new file so that it can be listened to.
% ECE Homework 1
% Code to read a .wav file, reverse it, and finally write a new .wav file
% David Baer
clear
clc
[Song, fs] = wavread('Beatles');
Reversed_Song = flipud(Song);
wavwrite(Reversed_Song, fs, 'Reversed_Beatles.wav')
There is definitely a message here however it is hard to tell what it actually is. To me it sounds like it is saying ‘put me on the mund’ over and over again and then right at the end someone says ‘shh’.
Media:SOTW_Normal.wav