Line 47: Line 47:
 
end
 
end
 
</pre>
 
</pre>
[[Media:Trother_smoke.wav]]
+
[[Media:Trother_smoke2.wav]]
 
<br/>
 
<br/>
 
'''Part 2'''
 
'''Part 2'''

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

Ph.D. on Applied Mathematics in Aug 2007. Involved on applications of image super-resolution to electron microscopy

Francisco Blanco-Silva