Line 26: | Line 26: | ||
tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];<br> | tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];<br> | ||
sound(tune,1/T)<br> | sound(tune,1/T)<br> | ||
− | wavwrite(tune,1/T,8,'[[hw1_ECE301S11_Prof_Boutin_1_a.wav|1_a.wav]]')<br><br> | + | wavwrite(tune,1/T,8,'[[Media:hw1_ECE301S11_Prof_Boutin_1_a.wav|1_a.wav]]')<br><br> |
</li> | </li> | ||
<li> | <li> | ||
Line 52: | Line 52: | ||
tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];<br> | tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];<br> | ||
sound(tune,1/T)<br> | sound(tune,1/T)<br> | ||
− | wavwrite(tune,1/T,8,'[[hw1_ECE301S11_Prof_Boutin_1_b.wav|1_b.wav]]')<br><br> | + | wavwrite(tune,1/T,8,'[[Media:hw1_ECE301S11_Prof_Boutin_1_b.wav|1_b.wav]]')<br><br> |
</li> | </li> | ||
Line 79: | Line 79: | ||
tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];<br> | tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];<br> | ||
sound(tune,1/T)<br> | sound(tune,1/T)<br> | ||
− | wavwrite(tune,1/T,8,'[[hw1_ECE301S11_Prof_Boutin_1_c.wav|1_c.wav]]')<br><br> | + | wavwrite(tune,1/T,8,'[[Media:hw1_ECE301S11_Prof_Boutin_1_c.wav|1_c.wav]]')<br><br> |
</li> | </li> | ||
</ol> | </ol> | ||
Line 85: | Line 85: | ||
<ol type="a"> | <ol type="a"> | ||
<li> | <li> | ||
− | The forward phrase is " | + | The forward phrase is "Number nine". |
</li> | </li> | ||
<li> | <li> | ||
Line 91: | Line 91: | ||
[song Fs nbits] = wavread('Beatles.wav');<br> | [song Fs nbits] = wavread('Beatles.wav');<br> | ||
song = flipud(song);<br> | song = flipud(song);<br> | ||
− | wavwrite(song, Fs, nbits,'[[hw1_ECE301S11_Prof_Boutin_2_b.wav|2_b.wav]]')<br><br> | + | wavwrite(song, Fs, nbits,'[[Media:hw1_ECE301S11_Prof_Boutin_2_b.wav|2_b.wav]]')<br><br> |
− | Yes, there is a subliminal message in this extract. The message is "Turn me on, dead man". | + | Yes, there is a subliminal message in this extract. The subliminal message is "Turn me on, dead man". |
Revision as of 17:38, 22 January 2011
Homework 1 Solution
-
-
Below is a Matlab code that plays the melody of the song "Smoke on the Water" by Deep Purple at original tempo:
% Defining sampling period and duration of a quarter note
T=0.00001;
BPM=112;
dur=1/(BPM/60);
% Defining note durations
haft=0:T:dur*2;
dotted_quart=0:T:dur*1.5;
quart=0:T:dur;
eighth=0:T:dur/2;
% Defining notes of the melody
g=sin(2*pi*392*quart);
b_flat=sin(2*pi*466.16*quart);
c_dq=sin(2*pi*523.25*dotted_quart);
c_h=sin(2*pi*523.25*haft);
d_flat=sin(2*pi*554.37*eighth);
% Creating, playing, and saving melody into a wave file
tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];
sound(tune,1/T)
wavwrite(tune,1/T,8,'1_a.wav')
-
Below is a Matlab code that plays the melody at twice original tempo:
% Defining sampling period and duration of a quarter note
% The tempo of the song is increased by a factor of 2 by modifying the variable BMP accordingly
T=0.00001;
BPM=2*112;
dur=1/(BPM/60);
% Defining note durations
haft=0:T:dur*2;
dotted_quart=0:T:dur*1.5;
quart=0:T:dur;
eighth=0:T:dur/2;
% Defining notes of the melody
g=sin(2*pi*392*quart);
b_flat=sin(2*pi*466.16*quart);
c_dq=sin(2*pi*523.25*dotted_quart);
c_h=sin(2*pi*523.25*haft);
d_flat=sin(2*pi*554.37*eighth);
% Creating, playing, and saving melody into a wave file
tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];
sound(tune,1/T)
wavwrite(tune,1/T,8,'1_b.wav')
-
Below is a Matlab code that plays the melody after applying the transformation $ y(t)=x(2t) $:
% Defining sampling period and duration of a quarter note
T=0.00001;
BPM=112;
dur=1/(BPM/60);
% Defining note durations
haft=0:T:dur*2;
dotted_quart=0:T:dur*1.5;
quart=0:T:dur;
eighth=0:T:dur/2;
% Defining notes of the melody
% y(t)=x(2t) transformation is applied by multiplying the value inside the sine waves by a factor of 2
g=sin(2*pi*2**392*quart);
b_flat=sin(2*pi*2*466.16*quart);
c_dq=sin(2*pi*2*523.25*dotted_quart);
c_h=sin(2*pi*2*523.25*haft);
d_flat=sin(2*pi*2*554.37*eighth);
% Creating, playing, and saving melody into a wave file
tune=[g b_flat c_dq g b_flat d_flat c_h g b_flat c_dq b_flat g];
sound(tune,1/T)
wavwrite(tune,1/T,8,'1_c.wav')
-
Below is a Matlab code that plays the melody of the song "Smoke on the Water" by Deep Purple at original tempo:
-
- The forward phrase is "Number nine".
-
Below is a Matlab code that plays the extract backwards:
[song Fs nbits] = wavread('Beatles.wav');
song = flipud(song);
wavwrite(song, Fs, nbits,'2_b.wav')
Yes, there is a subliminal message in this extract. The subliminal message is "Turn me on, dead man".