07_CM0268_DSP

# 07_CM0268_DSP - Basic Digital Audio Signal Processing In...

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

CM0268 MATLAB DSP GRAPHICS 1 174 JJ II J I Back Close Basic Digital Audio Signal Processing In this section we look at some basic aspects of Digital Audio Signal Processing: Some basic deﬁnitions and principles Filtering Basic Digital Audio Effects

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

View Full Document
CM0268 MATLAB DSP GRAPHICS 1 175 JJ II J I Back Close Simple Waveforms Frequency is the number of cycles per second and is measured in Hertz (Hz) Wavelength is inversely proportional to frequency i.e. Wavelength varies as 1 frequency
CM0268 MATLAB DSP GRAPHICS 1 176 JJ II J I Back Close The Sine Wave and Sound The general form of the sine wave we shall use (quite a lot of) is as follows: y = A.sin (2 π.n.F w /F s ) where: A is the amplitude of the wave, F w is the frequency of the wave, F s is the sample frequency, n is the sample index. MATLAB function: sin() used — works in radians

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

View Full Document
CM0268 MATLAB DSP GRAPHICS 1 177 JJ II J I Back Close MATLAB Sine Wave Radian Frequency Period Basic 1 period Simple Sine wave — 1 period is 2 π radians % Basic 1 period Simple Sine wave i=0:0.2:2 * pi; y = sin(i); figure(1) plot(y); % use stem(y) as alternative plot as in lecture notes to % see sample values title(’Simple 1 Period Sine Wave’);
CM0268 MATLAB DSP GRAPHICS 1 178 JJ II J I Back Close MATLAB Sine Wave Amplitude Sine Wave Amplitude is -1 to +1. To change amplitude multiply by some gain ( amp ): % Now Change amplitude amp = 2.0; y = amp * sin(i); figure(2) plot(y); title(’Simple 1 Period Sine Wave Modified Amplitude’);

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

View Full Document
CM0268 MATLAB DSP GRAPHICS 1 179 JJ II J I Back Close MATLAB Sine Wave Frequency % Natural frequency is 2 * pi radians % If sample rate is F_s HZ then 1 HZ is 2 * pi/F_s % If wave frequency is F_w then freequency is F_w * (2 * pi/F_s) % set n samples steps up to sum duration nsec * F_s where nsec is the % duration in seconds % So we get y = amp * sin(2 * pi * n * F_w/F_s); F_s = 11025; F_w = 440; nsec = 2; dur= nsec * F_s; n = 0:dur; y = amp * sin(2 * pi * n * F_w/F_s); figure(3) plot(y(1:500)); title(’N second Duration Sine Wave’);
CM0268 MATLAB DSP GRAPHICS 1 180 JJ II J I Back Close MATLAB Sine Wave Plot of n cycles % To plot n cycles of a waveform ncyc = 2; n=0:floor(ncyc * F_s/F_w); y = amp * sin(2 * pi * n * F_w/F_s); figure(4) plot(y); title(’N Cycle Duration Sine Wave’);

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

View Full Document
CM0268 MATLAB DSP GRAPHICS 1 181 JJ II J I Back Close Cosine, Square and Sawtooth Waveforms MATLAB functions cos() (cosine), square() and sawtooth() similar.
CM0268 MATLAB DSP GRAPHICS 1 182 JJ II J I Back Close MATLAB Cos v Sin Wave % Cosine is same as Sine (except 90 degrees out of phase) yc = amp * cos(2 * pi * n * F_w/F_s); figure(5); hold on plot(yc,’b’); plot(y,’r’); title(’Cos (Blue)/Sin (Red) Plot (Note Phase Difference)’); hold off;

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

View Full Document
CM0268 MATLAB DSP GRAPHICS 1 183 JJ II J I Back Close Relationship Between Amplitude, Frequency and Phase
CM0268 MATLAB DSP GRAPHICS 1 184 JJ II J I Back Close Amplitudes of a Sine Wave % Simple Sin Amplitude Demo samp_freq = 400; dur = 800; % 2 seconds amp = 1; phase = 0; freq = 1; s1 = mysin(amp,freq,phase,dur,samp_freq); axisx = (1:dur) * 360/samp_freq; % x axis in degrees plot(axisx,s1); set(gca,’XTick’,[0:90:axisx(end)]); fprintf(’Initial Wave: \t Amplitude = . ..\n’, amp, freq, phase,. ..); % change amplitude amp = input(’\nEnter Ampltude:\n\n’);

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/24/2012 for the course CM 0268 taught by Professor Davidmarshall during the Winter '11 term at Cardiff University.

### Page1 / 58

07_CM0268_DSP - Basic Digital Audio Signal Processing In...

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

View Full Document
Ask a homework question - tutors are online