Line 1: Line 1:
<p>%HW 1 ECE 301
+
<p>%HW 1 ECE 301  
+
 
%Jeff Gaines
 
%Jeff Gaines
 
 
%REGULAR SPEED
 
%REGULAR SPEED
 
 
%bpm = 112 = 1.867 bps
 
%bpm = 112 = 1.867 bps
 
 
delta = 0.00005;
 
delta = 0.00005;
 
 
half = [0:delta:0.933];
 
half = [0:delta:0.933];
  

Revision as of 15:02, 11 January 2011

%HW 1 ECE 301 %Jeff Gaines %REGULAR SPEED %bpm = 112 = 1.867 bps delta = 0.00005; half = [0:delta:0.933]; dottedquarter = [0:delta:0.7]; quarter = [0:delta:0.4666]; eighth = [0:delta:0.2333];

%Notes used

quarter_g = sin(2*pi*(2^(-1/6)*440)*quarter);

quarter_bf = sin(2*pi*(2^(1/12)*440)*quarter);

dottedquarter_c = sin(2*pi*(2^(1/4)*440)*dottedquarter);

eighth_df = sin(2*pi*(2^(1/3)*440)*eighth);

half_c = sin(2*pi*(2^(1/4)*440)*half);

half_g = sin(2*pi*(2^(-1/6)*440)*half);


%Note sequence (I made the last note a half G instead of quarter G since it

%sounds more like the song)

melody = [quarter_g, quarter_bf, dottedquarter_c, quarter_g, quarter_bf, eighth_df, half_c, quarter_g, quarter_bf, dottedquarter_c, quarter_bf, half_g];

sound(melody, 1/delta)

wavwrite(melody, 1/delta, 32, 'regular.wav');

pause(8)


%FAST SPEED

delta = 0.00005;

half = [0:delta:0.4665];

dottedquarter = [0:delta:0.35];

quarter = [0:delta:0.233];

eighth = [0:delta:0.116];


%Notes used

quarter_g = sin(2*pi*(2^(-1/6)*440)*quarter);

quarter_bf = sin(2*pi*(2^(1/12)*440)*quarter);

dottedquarter_c = sin(2*pi*(2^(1/4)*440)*dottedquarter);

eighth_df = sin(2*pi*(2^(1/3)*440)*eighth);

half_c = sin(2*pi*(2^(1/4)*440)*half);

half_g = sin(2*pi*(2^(-1/6)*440)*half);


%Note sequence

fast_melody = [quarter_g, quarter_bf, dottedquarter_c, quarter_g, quarter_bf, eighth_df, half_c, quarter_g, quarter_bf, dottedquarter_c, quarter_bf, half_g];

sound(fast_melody, 1/delta)

wavwrite(fast_melody, 1/delta, 32, 'fast.wav');

pause(5)


%HIGHER PITCH

delta = 0.00005;

half = [0:delta:0.933];

dottedquarter = [0:delta:0.7];

quarter = [0:delta:0.4666];

eighth = [0:delta:0.2333];


%Notes used

quarter_g = sin(4*pi*(2^(-1/6)*440)*quarter);

quarter_bf = sin(4*pi*(2^(1/12)*440)*quarter);

dottedquarter_c = sin(4*pi*(2^(1/4)*440)*dottedquarter);

eighth_df = sin(4*pi*(2^(1/3)*440)*eighth);

half_c = sin(4*pi*(2^(1/4)*440)*half);

half_g = sin(4*pi*(2^(-1/6)*440)*half);


%Note sequence

high_melody = [quarter_g, quarter_bf, dottedquarter_c, quarter_g, quarter_bf, eighth_df, half_c, quarter_g, quarter_bf, dottedquarter_c, quarter_bf, half_g];

sound(high_melody, 1/delta)

wavwrite(high_melody, 1/delta, 32, 'higher.wav');

pause(8)


%PART 2

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

sound(beatles, fs, bits)

pause(30)

%"number 9" over and over

reverse = flipud(beatles);

sound(reverse, fs, bits)

wavwrite(reverse, fs, 32, 'reverse.wav');

pause(30)

%sounds to me like "let me on the money", but I've read in the past people

%think it says "turn me on dead man"

Media:regular.wav

Media:fast.wav

Media:higher.wav

Media:reverse.wav

Alumni Liaison

has a message for current ECE438 students.

Sean Hu, ECE PhD 2009