Line 70: | Line 70: | ||
soundsc(SoundVector, 1/SampleRate); | soundsc(SoundVector, 1/SampleRate); | ||
end | end | ||
− | < | + | <end> |
== test == | == test == |
Revision as of 18:02, 3 September 2008
Sound Files
Still working on recording the media when i play them...
MATLAB Code Hail Purdue
% Mark Frankosky (mfrankos@purdue.edu) % ECE301 HW1.1 % Hail Purdue % Set up Sample Rate SampleRate = 1/20000; timeSig = 172; % Times Q = 60/timeSig; E = 60/timeSig/2; DQ = Q+E; H = 2*Q; DH = H+Q; % Set up note frequencies... C4 = 2*130.81; C4S = 2*138.59; D4 = 2*146.83; D4S = 2*155.56; E4 = 2*164.81; F4 = 2*174.61; F4S = 2*185; G4 = 2*196; G4S = 2*207.65; A4 = 2*220; A4S = 2*233.08; B4 = 2*246.94; % Set up Notes Notes = [A4 B4 C4S D4 E4 F4S F4S G4 G4 G4 D4 E4 F4 F4S]; % Set up Times NoteLength = [H Q Q DQ E Q Q Q E E Q E E DH]; % Play normal speed for nn=1:length(NoteLength) TimeVector = 0:SampleRate:NoteLength(nn); SoundVector = sin(2*pi*Notes(nn)*TimeVector); soundsc(SoundVector, 1/SampleRate); end pause(2) % Play second time twice as fast for nn=1:length(NoteLength) TimeVector = 0:SampleRate:.5*NoteLength(nn); SoundVector = sin(2*pi*Notes(nn)*TimeVector); soundsc(SoundVector, 1/SampleRate); end pause(2) % play third time with twice the frequency % same as applying the transform x(2t) for nn=1:length(NoteLength) TimeVector = 0:SampleRate:NoteLength(nn); SoundVector = sin(2*2*pi*Notes(nn)*TimeVector); soundsc(SoundVector, 1/SampleRate); end <end> == test ==