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

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

Questions/answers with a recent ECE grad

Ryne Rayburn