(→Matlab File) |
(→Matlab File) |
||
Line 1: | Line 1: | ||
+ | ==Files== | ||
+ | [[Media:Normal_ECE301Fall2008mboutin.wav]] | ||
+ | [[Media:Fast_ECE301Fall2008mboutin.wav]] | ||
+ | [[Media:High_Pitch_ECE301Fall2008mboutin.wav]] | ||
+ | |||
==Matlab File== | ==Matlab File== | ||
<pre> | <pre> | ||
Line 49: | Line 54: | ||
Notes =[A,B,Db,D,E,Gb,Gb,G,G,G,D,E,F,Gb,Gb,Gb,E,D,E,Gb,Gb,E,B,Db,D,Db,B,E,... | Notes =[A,B,Db,D,E,Gb,Gb,G,G,G,D,E,F,Gb,Gb,Gb,E,D,E,Gb,Gb,E,B,Db,D,Db,B,E,... | ||
A,A,B,Db,D,E,Gb,Gb,Gb,G,G,D,E,Gb,B,Db,D,B,A,D,Gb,A,B,Gb,E,D,D]; | A,A,B,Db,D,E,Gb,Gb,Gb,G,G,D,E,Gb,B,Db,D,B,A,D,Gb,A,B,Gb,E,D,D]; | ||
− | + | %array declarations | |
+ | allsound = []; | ||
+ | allsound2 = []; | ||
+ | allsound3 = []; | ||
%regular speed | %regular speed | ||
Line 69: | Line 77: | ||
wave =sin(2*pi*t*Notes(j)); | wave =sin(2*pi*t*Notes(j)); | ||
sound(wave,1/delta); | sound(wave,1/delta); | ||
− | + | allsound2 = cat(2, allsound2, wave); | |
end | end | ||
Line 81: | Line 89: | ||
wave =sin(2*2*pi*t*Notes(k)); | wave =sin(2*2*pi*t*Notes(k)); | ||
sound(wave,1/delta); | sound(wave,1/delta); | ||
− | + | allsound3 = cat(2, allsound3, wave); | |
end | end | ||
− | wavwrite(allsound,delta,' | + | wavwrite(allsound,1/delta,'Regular.wav'); |
+ | wavwrite(allsound2,1/delta,'Fast.wav'); | ||
+ | wavwrite(allsound3,1/delta,'High_Pitch.wav'); | ||
</pre> | </pre> |
Revision as of 18:28, 4 September 2008
Files
Media:Normal_ECE301Fall2008mboutin.wav Media:Fast_ECE301Fall2008mboutin.wav Media:High_Pitch_ECE301Fall2008mboutin.wav
Matlab File
%Travis Safford (tsafford@purdue.edu %9/5/08 %Hw 1.1 clear; clc; %Google found me this lovely site %http://www.phy.mtu.edu/~suits/notefreqs.html %from the lads at MIT that has the note frequencies on it A = 440; Bb = 466.16; B = 493.88; Cb = 523.25; C = 523.25; Db = 554.37; D = 587.33; Eb = 622.25; E = 659.26; F = 698.46; Gb = 739.99; G = 783.99; Ab = 830.61; %And that's that. %Mimi used this in class, so i'll use it too delta =1/20000; %Assuming 4/4 quarter notes are 172 bpm %Thus 1 quarter note is 60/172 minutes Q = 60/172; %Quarter Note Ei = 0.5*Q; %Eighth note (can't be E because of note) H = 2*Q; %Half Note W = 4*Q; %Whole Note DQ = 1.5*Q; %Dotted Quarter DH = 3*Q; %Dotted Half %timing fot the notes Lengths =[H,Q,Q,DQ,Ei,Q,Q,Q,Ei,Ei,Q,Ei,Ei,DH,H,Q,Q,DQ,E,Q,Q,Q,Ei,Ei,Q,Ei,Ei,W,DQ,Ei,... Q,Q,DQ,Ei,Q,Ei,Ei,Q,Q,Q,Q,W,DQ,Ei,Q,Q,Q,Q,Q,Q,DQ,Ei,Dq,Ei,W,W]; %notes for song Notes =[A,B,Db,D,E,Gb,Gb,G,G,G,D,E,F,Gb,Gb,Gb,E,D,E,Gb,Gb,E,B,Db,D,Db,B,E,... A,A,B,Db,D,E,Gb,Gb,Gb,G,G,D,E,Gb,B,Db,D,B,A,D,Gb,A,B,Gb,E,D,D]; %array declarations allsound = []; allsound2 = []; allsound3 = []; %regular speed for i = 1:length(Notes) t = 0:delta:Lengths(i); wave = sin(2*pi*t*Notes(i)); sound(wave,1/delta); allsound = cat(2, allsound, wave); end pause(5) %double speed %Cut lengths in half for j =1:length(Notes) t =0:delta:0.5*Lengths(j); wave =sin(2*pi*t*Notes(j)); sound(wave,1/delta); allsound2 = cat(2, allsound2, wave); end pause(5) %doubles the frequencies for the transformation %y(t)=x(2t) for k =1:length(Notes) t =0:delta:Lengths(k); wave =sin(2*2*pi*t*Notes(k)); sound(wave,1/delta); allsound3 = cat(2, allsound3, wave); end wavwrite(allsound,1/delta,'Regular.wav'); wavwrite(allsound2,1/delta,'Fast.wav'); wavwrite(allsound3,1/delta,'High_Pitch.wav');