(New page: == Homework 1 == Travis Rother '''Part 1''' <pre style="font-size:.9em;border:1px solid gray;background:#fcfcfc;padding:6px;"> % smoke.m % Author: Travis Rother % Description: plays begi...)
 
 
(2 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
     playsmoke(112, 1); % play at normal speed  (Part a)
 
     playsmoke(112, 1); % play at normal speed  (Part a)
 
     playsmoke(224, 1); % play twice as fast    (Part b)
 
     playsmoke(224, 1); % play twice as fast    (Part b)
     playsmoke(112, 2); % play with a frequency shift    (Part c)
+
     playsmoke(224, 2); % play with a frequency shift    (Part c)
 
      
 
      
 
     wavwrite(buf,1/delta,32, 'smoke.wav'); % write to wav file
 
     wavwrite(buf,1/delta,32, 'smoke.wav'); % write to wav file
Line 47: Line 47:
 
end
 
end
 
</pre>
 
</pre>
 
+
[[Media:Trother_smoke2.wav]]
 +
<br/>
 
'''Part 2'''
 
'''Part 2'''
 
<pre style="font-size:.9em;border:1px solid gray;background:#fcfcfc;padding:6px;">
 
<pre style="font-size:.9em;border:1px solid gray;background:#fcfcfc;padding:6px;">
Line 55: Line 56:
 
wavwrite(rev,Fs,'revBeatles.wav');
 
wavwrite(rev,Fs,'revBeatles.wav');
 
</pre>
 
</pre>
 +
[[Media:Trother_revBeatles.wav]]
 +
<br/>
 
'''a)''' "number 9, number 9, number 9... "
 
'''a)''' "number 9, number 9, number 9... "
 
<br/>'''b)''' Yes I think it is possible that there is a hidden message. To me it sounds like "carry on, gentlemen". Or it could be nothing, just my brain trying to make sense of garbled sounds.
 
<br/>'''b)''' Yes I think it is possible that there is a hidden message. To me it sounds like "carry on, gentlemen". Or it could be nothing, just my brain trying to make sense of garbled sounds.

Latest revision as of 08:33, 19 January 2011

Homework 1

Travis Rother


Part 1

% smoke.m
% Author: Travis Rother
% Description: plays beginning of smoke on the water in three different ways
function smoke()
    delta = .00005;

    buf = []; % stores the freq data to be written at the end
    playsmoke(112, 1); % play at normal speed  (Part a)
    playsmoke(224, 1); % play twice as fast    (Part b)
    playsmoke(224, 2); % play with a frequency shift    (Part c)
    
    wavwrite(buf,1/delta,32, 'smoke.wav'); % write to wav file


    function playsmoke(BPM, pitch)
        % define the notes the song uses
        G = note(-2);
        Bf = note(1);
        C = note(3);
        Df = note(4);

        % vector of notes the song plays
        notes = [G Bf C G Bf Df C G Bf C Bf G];

        % corresponding beat values for each note
        beat = [1 1 1.5 1 1 .5 2 1 1 1.5 1 1];

        % play all of the notes
        for i=1:length(notes)
            dur = (60/BPM)*beat(i);
            t = 0:delta:dur;
            z = sin(pitch*2*pi*notes(i)*t);
            sound(z,1/delta);
            buf = [buf; z(:)];
        end
    end

    function freq = note(hsteps)
       freq =  440 * 2^(hsteps/12);
    end
end

Media:Trother_smoke2.wav
Part 2

[data, Fs] = wavread('Beatles.wav');
rev = flipud(data);
sound(rev,Fs);
wavwrite(rev,Fs,'revBeatles.wav');

Media:Trother_revBeatles.wav
a) "number 9, number 9, number 9... "
b) Yes I think it is possible that there is a hidden message. To me it sounds like "carry on, gentlemen". Or it could be nothing, just my brain trying to make sense of garbled sounds.

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood