Line 1: Line 1:
 
%ECE 301 HW1
 
%ECE 301 HW1
 +
 
%Tridib K Saha
 
%Tridib K Saha
 +
 
%PUID 0023254379
 
%PUID 0023254379
  
 
%ORIGINAL SPEED
 
%ORIGINAL SPEED
 +
 
%speed: beats/min = 112  
 
%speed: beats/min = 112  
 +
 
%thus quarter note = .5357 sec
 
%thus quarter note = .5357 sec
  
 
delta = 0.00005;
 
delta = 0.00005;
 +
 
half = [0:delta:1.0714];
 
half = [0:delta:1.0714];
 +
 
d_quarter = [0:delta:0.8036];
 
d_quarter = [0:delta:0.8036];
 +
 
quarter = [0:delta:0.5357];
 
quarter = [0:delta:0.5357];
 +
 
eighth = [0:delta:0.26785];
 
eighth = [0:delta:0.26785];
  

Revision as of 17:14, 18 January 2011

%ECE 301 HW1

%Tridib K Saha

%PUID 0023254379

%ORIGINAL SPEED

%speed: beats/min = 112

%thus quarter note = .5357 sec

delta = 0.00005;

half = [0:delta:1.0714];

d_quarter = [0:delta:0.8036];

quarter = [0:delta:0.5357];

eighth = [0:delta:0.26785];

%notes required g_quar = sin(2*pi*(2^(-1/6)*440)*quarter); bf = sin(2*pi*(2^(1/12)*440)*quarter); c_d_quarter = sin(2*pi*(2^(1/4)*440)*d_quarter); df_eighth = sin(2*pi*(2^(1/3)*440)*eighth); c_half = sin(2*pi*(2^(1/4)*440)*half); g_half = sin(2*pi*(2^(-1/6)*440)*half);

%smoke on the water sequence smoke_on_the_water = [g_quar, bf, c_d_quarter , g_quar, bf, df_eighth, c_half, g_quar, bf, c_d_quarter , bf, g_half]; sound(smoke_on_the_water, 1/delta) wavwrite(smoke_on_the_water, 1/delta, 32, 'reg_song.wav'); pause(10)

%FAST SPEED delta = 0.00005; half = [0:delta:1.0714*.5]; d_quarter = [0:delta:0.8036*.5]; quarter = [0:delta:0.5357*.5]; eighth = [0:delta:0.26785*.5];

%new notes g_quar = sin(2*pi*(2^(-1/6)*440)*quarter); bf = sin(2*pi*(2^(1/12)*440)*quarter); c_d_quarter = sin(2*pi*(2^(1/4)*440)*d_quarter); df_eighth = sin(2*pi*(2^(1/3)*440)*eighth); c_half = sin(2*pi*(2^(1/4)*440)*half); g_half = sin(2*pi*(2^(-1/6)*440)*half);

%fast smoke on the water sequence fast_smoke_on_the_water = [g_quar, bf, c_d_quarter , g_quar, bf, df_eighth, c_half, g_quar, bf, c_d_quarter , bf, g_half]; sound(fast_smoke_on_the_water, 1/delta) wavwrite(fast_smoke_on_the_water, 1/delta, 32, 'fast_song.wav'); pause(5)

%HIGHER PITCH delta = 0.00005; half = [0:delta:1.0714*.5]; d_quarter = [0:delta:0.8036*.5]; quarter = [0:delta:0.5357*.5]; eighth = [0:delta:0.26785*.5];

% new notes g_quar = sin(4*pi*(2^(-1/6)*440)*quarter); bf = sin(4*pi*(2^(1/12)*440)*quarter); c_d_quarter = sin(4*pi*(2^(1/4)*440)*d_quarter); df_eighth = sin(4*pi*(2^(1/3)*440)*eighth); c_half = sin(4*pi*(2^(1/4)*440)*half); g_half = sin(4*pi*(2^(-1/6)*440)*half);

%high pitch smoke on the water sequence high_smoke_on_the_water = [g_quar, bf, c_d_quarter , g_quar, bf, df_eighth, c_half, g_quar, bf, c_d_quarter , bf, g_half]; sound(high_smoke_on_the_water, 1/delta) wavwrite(high_smoke_on_the_water, 1/delta, 32, 'highpitch_song.wav'); pause(5)

%Homework 1 part 2

[beatles, fs, bits] = wavread('Beatles.wav'); sound(beatles, fs, bits) pause(25)

% original file says 'number 9' over and over reverse = flipud(beatles); sound(reverse, fs, bits) wavwrite(reverse, fs, 32, 'reversebeatles.wav'); pause(25)

%reversed file says 'turn me on dead man'

Media:reg_song.wav Media:fast_song.wav Media:highpitch_song.wav Media:reversebeatles.wav

[1]

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn