Line 69: Line 69:
  
 
[[Media:Smokew_3.wav]]<br>
 
[[Media:Smokew_3.wav]]<br>
 +
 +
[[Media:Beatles_subliminal.wav]]<br>

Revision as of 09:07, 19 January 2011

%Written by: Justin Clark %Purpose: ECE 301 HW 1

%Task: 1a)Play smoke on the water

BPM = 112; %number of beats per minute

%conversion from BPM to length of duration [seconds] %conversionfrom http://bradthemad.org/guitar/tempo_explanation.php length = 60/112;


delta=0.0005;

fa = 440; %[Hz] fg = (2^((-2)/12)) * fa;%[Hz] fbf = (2^(1/12)) * fa;%[Hz] fc = (2^(3/12)) * fa;%[Hz] fdf = (2^(4/12)) * fa;%[Hz]


th = 0:delta:60/112*2; %half note duration [sec] tq = 0:delta:60/112; %quarter note duration [sec] te = 0:delta:60/112/2; %eighth note duration [sec] td = 0:delta:60/112*1.5; %dotted quarter note duration [sec]

g = sin(2*pi*fg*tq); hg = sin(2*pi*fg*th); bf = sin(2*pi*fbf*tq); dqc = sin(2*pi*fc*td); hc = sin(2*pi*fc*th); df = sin(2*pi*fdf*te);

smoke_on_the_water = [g,bf,dqc,g,bf,df,hc,g,bf,dqc,bf,g];

sound(smoke_on_the_water,1/delta);

wavwrite(smoke_on_the_water, 1/delta, 32, 'smokew.wav');

pause(1);

% %Task: 1b) play twice as fast

%cut time duration in half th2 = 0:delta:60/112; tq2 = 0:delta:60/112/2; te2 = 0:delta:60/112/4; td2 = 0:delta:60/112*1.5/2;

%rescale notes g2 = sin(2*pi*fg*tq2); hg2 = sin(2*pi*fg*th2); bf2 = sin(2*pi*fbf*tq2); dqc2 = sin(2*pi*fc*td2); hc2 = sin(2*pi*fc*th2); df2 = sin(2*pi*fdf*te2);

smoke_on_the_water_twice_speed = [g2,bf2,dqc2,g2,bf2,df2,hc2,g2,bf2,dqc2,bf2,g2];

sound(smoke_on_the_water_twice_speed,1/delta);

wavwrite(smoke_on_the_water_twice_speed, 1/delta, 'smokew_fast.wav');

pause(1);

%Task: 1c) rescale original song, x(t), to play as y(t) = x(2t)

th3 = (0:delta:60/112*2); %half note duration [sec] tq3 = (0:delta:60/112); %quarter note duration [sec] te3 = (0:delta:60/112/2); %eighth note duration [sec] td3 = (0:delta:60/112*1.5); %dotted quarter note duration [sec]

%rescale notes g3 = sin(2*pi*fg*tq3); hg3 = sin(2*pi*fg*th3); bf3 = sin(2*pi*fbf*tq3); dqc3 = sin(2*pi*fc*td3); hc3 = sin(2*pi*fc*th3); df3 = sin(2*pi*fdf*te3);

smoke_on_the_water_3 = [g3,bf3,dqc3,g3,bf3,df3,hc3,g3,bf3,dqc3,bf3,g3];

sound(smoke_on_the_water_3,1/(1/2*delta));

wavwrite(smoke_on_the_water_3, 1/(1/2*delta), 'smokew_3.wav');

pause(1);


 %Task: 2)

% What is the forward repeated phrase? "Number nine."

[Y, Fs] = wavread('Beatles.wav');

Y_Subliminal = flipud(Y);

sound(Y, Fs); sound(Y_Subliminal, Fs);

wavwrite(Y_Subliminal,1/delta, 'Beatles_subliminal.wav');


Media:Smokew.wav

Media:Smokew_fast.wav

Media:Smokew_3.wav

Media:Beatles_subliminal.wav

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn