% ECE 1250 S12 Lecture 1 % % PowerPoint presentation: Sound Overview % % The Matlab¨ desktop: % 1) Current Folder (put code here and Matlab¨ will find it) % 2) Workspace (shows what values are stored by Matlab¨ in named variables) % 3) Command History (previous commands, use arrow keys, too) % 4) Command Window (type commands into the glorified graphing calculator that is Matlab¨) % Housekeeping: % 1) Use Preferences in MATLAB menu to set print format to compact % 2) Change current folder to Desktop so Matlab can find files % 3) >> pwd % print current directory % 4) Use Set Path under File Menu to add desired folder to where Matlab¨ looks for files (remember to Save before you Close the Set Path window) % Cool things Matlab¨ can do: >> load handel % load a snippet of Handel's "Messiah" >> sound(y) % play the snippet of "Messiah" stored in variable "y" >> plot(y(1:200)) % Shows us what the sound waveform looks like >> y = y(2000:4048)*0.3; % extract a portion of the sound waveform >> sound(y) % "ah" sound >> plot(abs(fft(y(2000:4048)))) % Shows the frequencies in the "ah" sound % Our goal in the labs will be to analyze sounds and then create a sound effect. % Matlab¨ works like a calculator, but everything is typed out: >> sin(pi) % pi is built-in constant. % The answer should have been zero, but Matlab¨ is numerical and rounds off. Be careful. sqrt(-1) % The square root of -1 is imaginary. Matlab¨ is okay with that. % Some things not in the early part of the book but Very useful: % 1) Put a semicolon ; at the end of a command to suppress printout. Very handy % huge arrays you don't want to see. % 2) Use the >>diary on and >>diary off commands to create a file containing % a transcript of your Matlab¨ session, input and output.