(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
%HW 1 ECE 301 <\n>
+
<pre>
 +
%HW 1 ECE 301
 
%Jeff Gaines
 
%Jeff Gaines
  
 
%REGULAR SPEED
 
%REGULAR SPEED
 
+
%beats/min = 112 -> quarter note = .5357 sec
%bpm = 112 = 1.867 bps
+
 
+
 
delta = 0.00005;
 
delta = 0.00005;
 
+
half = [0:delta:1.0714];
half = [0:delta:0.933];
+
dottedquarter = [0:delta:0.8036];
 
+
quarter = [0:delta:0.5357];
dottedquarter = [0:delta:0.7];
+
eighth = [0:delta:0.26785];
 
+
quarter = [0:delta:0.4666];
+
 
+
eighth = [0:delta:0.2333];
+
 
+
  
 
%Notes used
 
%Notes used
 
 
quarter_g = sin(2*pi*(2^(-1/6)*440)*quarter);
 
quarter_g = sin(2*pi*(2^(-1/6)*440)*quarter);
 
 
quarter_bf = sin(2*pi*(2^(1/12)*440)*quarter);
 
quarter_bf = sin(2*pi*(2^(1/12)*440)*quarter);
 
 
dottedquarter_c = sin(2*pi*(2^(1/4)*440)*dottedquarter);
 
dottedquarter_c = sin(2*pi*(2^(1/4)*440)*dottedquarter);
 
 
eighth_df = sin(2*pi*(2^(1/3)*440)*eighth);
 
eighth_df = sin(2*pi*(2^(1/3)*440)*eighth);
 
 
half_c = sin(2*pi*(2^(1/4)*440)*half);
 
half_c = sin(2*pi*(2^(1/4)*440)*half);
 
 
half_g = sin(2*pi*(2^(-1/6)*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
 
%Note sequence (I made the last note a half G instead of quarter G since it
 
 
%sounds more like the song)
 
%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];
 
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)
 
sound(melody, 1/delta)
 
 
wavwrite(melody, 1/delta, 32, 'regular.wav');
 
wavwrite(melody, 1/delta, 32, 'regular.wav');
 
 
pause(8)
 
pause(8)
 
  
 
%FAST SPEED
 
%FAST SPEED
 
 
delta = 0.00005;
 
delta = 0.00005;
 
+
half = [0:delta:1.0714*.5];
half = [0:delta:0.4665];
+
dottedquarter = [0:delta:0.8036*.5];
 
+
quarter = [0:delta:0.5357*.5];
dottedquarter = [0:delta:0.35];
+
eighth = [0:delta:0.26785*.5];
 
+
quarter = [0:delta:0.233];
+
 
+
eighth = [0:delta:0.116];
+
 
+
  
 
%Notes used
 
%Notes used
 
 
quarter_g = sin(2*pi*(2^(-1/6)*440)*quarter);
 
quarter_g = sin(2*pi*(2^(-1/6)*440)*quarter);
 
 
quarter_bf = sin(2*pi*(2^(1/12)*440)*quarter);
 
quarter_bf = sin(2*pi*(2^(1/12)*440)*quarter);
 
 
dottedquarter_c = sin(2*pi*(2^(1/4)*440)*dottedquarter);
 
dottedquarter_c = sin(2*pi*(2^(1/4)*440)*dottedquarter);
 
 
eighth_df = sin(2*pi*(2^(1/3)*440)*eighth);
 
eighth_df = sin(2*pi*(2^(1/3)*440)*eighth);
 
 
half_c = sin(2*pi*(2^(1/4)*440)*half);
 
half_c = sin(2*pi*(2^(1/4)*440)*half);
 
 
half_g = sin(2*pi*(2^(-1/6)*440)*half);
 
half_g = sin(2*pi*(2^(-1/6)*440)*half);
 
  
 
%Note sequence
 
%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];
 
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)
 
sound(fast_melody, 1/delta)
 
 
wavwrite(fast_melody, 1/delta, 32, 'fast.wav');
 
wavwrite(fast_melody, 1/delta, 32, 'fast.wav');
 
 
pause(5)
 
pause(5)
 
  
 
%HIGHER PITCH
 
%HIGHER PITCH
 
 
delta = 0.00005;
 
delta = 0.00005;
 
+
half = [0:delta:1.0714*.5];
half = [0:delta:0.933];
+
dottedquarter = [0:delta:0.8036*.5];
 
+
quarter = [0:delta:0.5357*.5];
dottedquarter = [0:delta:0.7];
+
eighth = [0:delta:0.26785*.5];
 
+
quarter = [0:delta:0.4666];
+
 
+
eighth = [0:delta:0.2333];
+
 
+
  
 
%Notes used
 
%Notes used
 
 
quarter_g = sin(4*pi*(2^(-1/6)*440)*quarter);
 
quarter_g = sin(4*pi*(2^(-1/6)*440)*quarter);
 
 
quarter_bf = sin(4*pi*(2^(1/12)*440)*quarter);
 
quarter_bf = sin(4*pi*(2^(1/12)*440)*quarter);
 
 
dottedquarter_c = sin(4*pi*(2^(1/4)*440)*dottedquarter);
 
dottedquarter_c = sin(4*pi*(2^(1/4)*440)*dottedquarter);
 
 
eighth_df = sin(4*pi*(2^(1/3)*440)*eighth);
 
eighth_df = sin(4*pi*(2^(1/3)*440)*eighth);
 
 
half_c = sin(4*pi*(2^(1/4)*440)*half);
 
half_c = sin(4*pi*(2^(1/4)*440)*half);
 
 
half_g = sin(4*pi*(2^(-1/6)*440)*half);
 
half_g = sin(4*pi*(2^(-1/6)*440)*half);
 
  
 
%Note sequence
 
%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];
 
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)
 
sound(high_melody, 1/delta)
 
 
wavwrite(high_melody, 1/delta, 32, 'higher.wav');
 
wavwrite(high_melody, 1/delta, 32, 'higher.wav');
 
+
pause(5)
pause(8)
+
 
+
  
 
%PART 2
 
%PART 2
 
 
[beatles, fs, bits] = wavread('Beatles.wav');
 
[beatles, fs, bits] = wavread('Beatles.wav');
 
 
sound(beatles, fs, bits)
 
sound(beatles, fs, bits)
 
 
pause(30)
 
pause(30)
 
 
%"number 9" over and over
 
%"number 9" over and over
 
 
reverse = flipud(beatles);
 
reverse = flipud(beatles);
 
 
sound(reverse, fs, bits)
 
sound(reverse, fs, bits)
 
 
wavwrite(reverse, fs, 32, 'reverse.wav');
 
wavwrite(reverse, fs, 32, 'reverse.wav');
 
 
pause(30)
 
pause(30)
 
 
%sounds to me like "let me on the money", but I've read in the past people
 
%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"
 
%think it says "turn me on dead man"
 
+
</pre>
[[Media:regular.wav]]
+
[[Media:regular.wav]]<br>
 
+
[[Media:fast.wav]]<br>
[[Media:fast.wav]]
+
[[Media:higher1.wav]]<br>
 
+
[[Media:reverse.wav]]<br>
[[Media:higher.wav]]
+
 
+
[[Media:reverse.wav]]
+

Latest revision as of 13:30, 14 January 2011

%HW 1 ECE 301
%Jeff Gaines

%REGULAR SPEED
%beats/min = 112 -> quarter note = .5357 sec
delta = 0.00005;
half = [0:delta:1.0714];
dottedquarter = [0:delta:0.8036];
quarter = [0:delta:0.5357];
eighth = [0:delta:0.26785];

%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:1.0714*.5];
dottedquarter = [0:delta:0.8036*.5];
quarter = [0:delta:0.5357*.5];
eighth = [0:delta:0.26785*.5];

%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:1.0714*.5];
dottedquarter = [0:delta:0.8036*.5];
quarter = [0:delta:0.5357*.5];
eighth = [0:delta:0.26785*.5];

%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(5)

%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:higher1.wav
Media:reverse.wav

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett