finalreviewsession

# finalreviewsession - Bismillahir Rahmanir Rahim Final...

This preview shows pages 1–3. Sign up to view the full content.

Bismillahir Rahmanir Rahim Final review session SORTING Big O - theoritical concept of how to measure computational insertion sort ------ O(N^2) bubble sort --------- O(N^2) merge sort ---------- O(Nlog N) recursive (sp[litting in half everytime) quick sort ---------- O(Nlog N)-average case recursive ----------------------O(N^2) -worst case for quick like if the vector is already sorted Bubble sort - not recursive , swapping numbers thing and loop inside loop Quicksort - splitting iit in half is merge , yes its quick insertion sort - start off with empty vector , and value put in between. SOUND we can take measurements of the pressure ar certain intervals and play them if we take a graph of time vs. amplitude , the graph will loook like a sine wave MATLAB cant do continuous waves , so we have to simulate a continuous wave by sampling data at a certain sampling frequency Sound files on your computer know what their sampling rate should be [data fs] = wavread( 'sound.wav' ) data is the amplitude info fs is the sampling frequency dt = 1/fs ----- time between samples tmax = length(data)/fs ------ duration to create a graph of time and amplitude , plot (dt:dt:tmax, data) we can alter our sound vector(data) just like any other vector ... the only thing to keep in mind is that data is a column vector - this is important while concatenating reverse sound = data(end:-1:1) first_half = data(1:end/2) second_half = data(end/2+1:end) silence_3sec = zeros(3*Fs, 1) ------- we want 3 seconds of silence data2 = [first_half; silence_3sec; second_half] ------ puts 3 second of silence within the sound file ekdom majhkhane sound(data2, Fs) ------------- note that you can only play at a specific Fs

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
frequency(pitch) changing the pitch of a sound changing frequency 1 - BY CHANGING FS _ SAMPLING FREQUWNCY you play it faster the pitch goes high play it slower the pitch goes slower increase Fs - increase pitch cuz playback faster - more samples per second as per multiple sound(data,2*Fs) ------- up an octave , i.e twice as fast decrease Fs - decrease pitch cuz playback slower - less samples per second sound(data, Fs/2) ---------- down an octave , i.e half as fast also you can change pitch by altering N 2 - BY CHANGING N- (LENGTH OF THE VECTOR) if the vector is twice as long , it goes down an octave as it takes double the time to play data = data(round(linspace(1,end,2*end))) -------- down an octave data = data(round(linspace(1,end,end/2))) --------- up an octave upping by halve steps data = data(round(linspace(1,end,end/(2^x/12)))) -------- step down
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 10

finalreviewsession - Bismillahir Rahmanir Rahim Final...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online