ee599 020 audio signals and systems l.
Skip this Video
Loading SlideShow in 5 Seconds..
EE599-020 Audio Signals and Systems PowerPoint Presentation
Download Presentation
EE599-020 Audio Signals and Systems

Loading in 2 Seconds...

play fullscreen
1 / 33

EE599-020 Audio Signals and Systems - PowerPoint PPT Presentation

  • Uploaded on

EE599-020 Audio Signals and Systems. Digital Signal Processing (Analysis) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky. Spectra. The spectrum of the impulse response will indicate the following filter/system properties:

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'EE599-020 Audio Signals and Systems' - kara

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
ee599 020 audio signals and systems

EE599-020Audio Signals and Systems

Digital Signal Processing (Analysis)

Kevin D. DonohueElectrical and Computer EngineeringUniversity of Kentucky


The spectrum of the impulse response will indicate the following filter/system properties:

  • resonance and frequency sensitivities through the magnitude spectrum
  • delay and dispersive properties through the phase spectrum.

The discrete Fourier transform (DFT) computes complex samples the spectrum.

  • Frequency domain sampling creates periodicity in the time domain, which cause problems when implementing convolution in the frequency domain.
discrete fourier transform
Discrete Fourier Transform

In order to take a DFT of a signal, a finite window (time interval) must be extracted from the original sampled time signal, and DFT points are evaluated at discrete frequency samples (frequency sampling). The DFT is defined as:

inverse dft
Inverse DFT

This inverse DFT is a similar computation as the DFT except the complex conjugate of the kernel is used:

dft with w notation
DFT with W notation

Let W equal the complex sinusoid with the lowest nonzero frequency (n or k = 1):

W is effectively a fundamental frequency in a harmonic expansion, since the frequency domain was sampled in equal increments. DFT and its inverse can now be written as:

computation examples
Computation Examples

Compute the DFT for the 4 point and 8 point signals given below:

What was the effect of extra zeros padded on the end of the signal in the second example?

homework 1

Compute the DFT (by hand as done in the previous example) for the 8 point signal given below:

computation examples8
Computation Examples
  • What symmetries exist in the W factor in the DFT computation that suggest a more efficient computation than a direct multiply and summation? The implementation that takes advantage of these symmetries is called a Fast Fourier Transform (FFT).
  • If the sequence is a power of 2, the FFT is most efficient. A direct implementation of the DFT requires N2 complex multiplications. A FFT requires Nlog2N multiplications.
  • Compute the ratio between complex multiplications for the FFT and DFT for a 128 point sequence. Compute the same ratio for a 2048 point sequence.
things to worry about
Things to Worry About

Distortion and error may result from the truncated and frequency sampled signal from 3 main sources:

  • Loss of energy from truncated portion will distribute as error over the signal.
  • Truncating signal at the endpoints may introduce a significant sharp transition that is not part of the signal.
  • Circular convolution may distort signal if processed in the frequency domain.
frequency sampling effect
Frequency Sampling Effect

The DFT can be applied to a finite duration signal. If signal support is too big or infinite, part of it must be truncated. The DFT definition can be applied to the finite point signal to obtain a frequency sampled spectrum.

frequency sampling effect11
Frequency Sampling Effect

The DFT representation implies the time domain signal was periodic (sampling in time produces periodic spectra, likewise sampling in frequency produces periodic time segments) as would be the case for Fourier series.

homework 2

Without going through detailed computations, use the result of Homework (1) and the effects of frequency sampling to determine the DFT of :

circular convolution
Circular Convolution

Multiplication in frequency is convolution in time. For discrete signals this can performed with the fft command in Matlab on the filter coefficients h(n) and input signal x(n), then the ifft command on their frequency domain product:







linear convolution example
Linear Convolution Example

Linear convolution implemented in the time domain. Note the convolved signal length is greater than either of the originals. Why?

circular convolution example
Circular Convolution Example

Convolution implemented in the frequency domain. Note the convolved signal length is the same as the originals. Why?

Why is there an apparent artifact at the beginning of the signal?

circular convolution example16
Circular Convolution Example

Convolution implemented in the frequency domain with zero padding. Why is the apparent artifact from the nonzero pad example no longer present?

fft for signal analysis
FFT for Signal Analysis

The FFT can be applied directly to finite duration energy signals to examine the spectral content of the signal.

For Matlab’s FFT:

  • FFT(X) is the discrete Fourier transform (DFT) of vector X. For matrices, the FFT operation is applied to each column.
  • FFT(X,N) is the N-point FFT, padded with zeros if X has less than N points and truncated if it has more.
fft of a rayleigh ring
FFT of a Rayleigh Ring

Write a Matlab script to Generate a tone modulated by a Rayleigh envelope. Plot the signal, its spectra, and play the sound.

% Simulate a Rayleigh envelope ring, truncate it, take its FFT and examine

% its spectral content

fr = 250; % Frequency of the ring

sigma = .05; % effective duration TIMES 2 of ring

fs = 8000; % Sampling frequency

dur = .25; % signal duration in seconds

nfft = 4096;

t = [0:round(dur*fs)-1]/fs; % Create time axis

ring = (t/sigma).*exp((-t.^2)/(sigma^2)).*sin(2*pi*t*fr); % Generate Ring signal


plot(t, ring) % Plot ring

title('Rayleigh Envelope Ring Signal')



soundsc(ring,fs) % Play sound

fft of a rayleigh ring19
FFT of a Rayleigh Ring

spec0 = fft(ring); % No Zero pad

spec1 = fft(ring,nfft); % Zero pad (or truncate) to NFFT points

spec2 = fft(ring,2*nfft); % Zero pad to 2*NFFT

% Create frequency axes for each of the spectra

faxis0 = fs*[0:length(spec0)-1]/length(spec0);

faxis1 = fs*[0:length(spec1)-1]/length(spec1);

faxis2 = fs*[0:length(spec2)-1]/length(spec2);

% Plot spectrum with zero padded version on the same graph and compare

figure(2) % Magnitude

plot(faxis0, abs(spec0),'k',faxis1, abs(spec1),'r--',faxis2, abs(spec2),'g.')

legend([int2str(length(t)) ' point FFT'], [int2str(nfft) ' point FFT'], [int2str(2*nfft) ' point FFT'])

title('Magnitude ffts with zero padding')



figure(3) % Phase

plot(faxis0, 180*phase(spec0)/pi,'k',faxis1, 180*phase(spec1)/pi,'r--',faxis2, 180*phase(spec2)/pi,'g.')

legend([int2str(length(t)) ' point FFT'], [int2str(nfft) ' point FFT'], [int2str(2*nfft) ' point FFT'])

title('Phase ffts with zero padding')



homework 3

What effect does the frequency of the tone have on the spectrum? What effect does the duration of the tone have on the spectrum? What effect does padding with zeros have on the spectrum? What effect does truncating the signal too soon (cut out a significant portion of energy) have on the spectrum?

Show plots, use minimal words to respond to each of these questions.

fft of extended non stationary signals
FFT of Extended Non-Stationary Signals
  • When the signal is long with changing dynamics, as would be the case for a speech or music signal, the FFT must be applied to short segments of these signals.
  • To reduce truncation effects, a tapering is used to bring the ends of the segment close to zero in a gradual way.
  • To ensure that information is not lost in the truncation and tapering, an overlap between signal segment is used.
spectrogram for signal analysis
Spectrogram for Signal Analysis

The Matlab Spectrogram command is appropriate of analyzing long deterministic or non-stationary signals.

For Matlab’s SPECGRAM: Calculate spectrogram from signal.

B = SPECGRAM(A,NFFT,Fs,WINDOW,NOVERLAP) calculates the spectrogram for the signal in vector A. SPECGRAM splits the signal into overlapping segments, windows each with the WINDOW vector and forms the columns of B with their zero-padded, length NFFT discrete Fourier transforms. Thus each column of B contains an estimate of the short-term, time-localized frequency content of the signal A. Time increases linearly across the columns of B, from left to right. Frequency increases linearly down the rows, starting at 0.

spectrogram for signal analysis24
Spectrogram for Signal Analysis

If plotting, it is convenient to use the optional output arguments:

[B,F,T] = SPECGRAM(A,NFFT,Fs,WINDOW,NOVERLAP) returns a column of frequencies F and one of times T at which the spectrogram is computed. F has length equal to the number of rows of B, T has length k. If you leave Fs unspecified, SPECGRAM assumes a default of 2 Hz.

spectrogram of frequency sweep
Spectrogram of Frequency Sweep

Write a Matlab script to Generate a frequency sweep from 20 Hz to 1.9 kHz, where Fs is 4 kHz. Then plot the magnitude of the spectrogram and play the sound.

% Simulate a frequency sweep signal and take its spectrogram and examine

% its spectral content over time

% Signal Parameters

flow = 20; % Starting frequency of sweep in Hertz

fend = 1900; % Ending frequency of sweep in Hertz

dt = 4; % Time duration of sweep in seconds

fs = 4000; % Sampling frequency

% Spectrogram Parameters

wlen = 128; % Length of actual point extracted from signal segment

nfft = 1024; % number of FFT point (zero padding)

olap = floor(wlen/2); % Points of overlap between segments

wn = hamming(wlen); % Create tapering window (also try boxcar - square window)

spectrogram of frequency sweep26
Spectrogram of Frequency Sweep

% Generate signal

t = [0:round(dt*fs)-1]/fs; % Create time axis

fsw = flow + ((fend-flow)/2)*[0:length(t)-1]/length(t); % Create Frequency ramp - Why divid by 2?

swp = sin(2*pi*t.*fsw); % Generate sweep signal

soundsc(swp,fs) % Play sound

% Create Spectrogram

[b,faxis,taxis] = specgram(swp,nfft,fs,wn,olap);

% Plot over time and frequency

figure(1); imagesc(taxis, faxis, abs(b)) % Plot spectrogram

axis('xy') % Flip y axis to put zero Hz on bottom

colorbar % Include colorbar to determine color coded magnitudes on graph

title(['Frequency Sweep from ' num2str(flow) ' Hz to ' num2str(fend) ' Hz']); xlabel('Seconds'); ylabel('Hz')

% Just plot at a single time instant

figure(2); tindex = find(taxis >= dt/2); %Find index of halfway point over the time axis

tindex = tindex(1);


title(['Single column from Spectrogram at ' num2str(taxis(tindex)) ' seconds']); xlabel('Hz'); ylabel('Magnitude')

homework 4

What effect does the window length have on the spectrogram? What effect does the window shape (flat or tapered) have on the spectrogram? What effect does padding with zeros have on the spectrogram? What effect does overlap of points have on the spectrogram?

Show plots, use minimal words to respond to each of these questions.

random signal analysis
Random Signal Analysis
  • If a process is changing over time, however the statistics of the process do not change over time, the process is referred to as a stationary process. In this case averaging and moment computations result in useful characterization.
power spectral denisty
Power Spectral Denisty
  • The Power Spectral Density (PSD) is the average power in a signal as a function of frequency. This can be estimated by averaging DFT magnitudes squared over segments of signals from the same noise process.
  • Where E[] is the expected value, S(f) is the true spectrum and is the DFT or short time FT estimated from independent signal segments.
psd example colored noise
PSD Example Colored Noise

Filter white noise through a band-pass filter and compute the PSD. Compare PSD to the transfer function magnitude of the filter. Assume a sampling rate of 8kHz and a 6th order Butterworth filter with passband from 500 to 1500 kHz.

psd example colored noise32
PSD Example Colored Noise
  • fs = 8000; % Sampling Frequency
  • dur = 2; % Sound duration in seconds
  • ord = 6;
  • plen = 512; % PSD segment length
  • % Bandlimit on the filter
  • f1 = [500]; % lower bandlimit
  • f2 = [1500]; % corresponding upper bandlimit
  • % colors for the plots
  • col = ['g', 'r', 'b', 'k', 'c', 'b'];
  • no = randn(1,round(fs*dur)); % Generate noise signal
  • [b,a] = butter(ord,2*[f1 f2]/fs); % Generate filter
  • % perform filter operation to get colored noise
  • cno = filter(b,a,no);
  • % Compute the PSD
  • [p, fax] = psd(cno,2*plen, fs, hamming(plen),fix(plen/2)); % Compute PSD of noise
  • figure(1); lh = plot(fax,abs(p),col(1)) % Plot PSD
  • set(lh,'LineWidth',2) % Make line thicker
  • hold on
  • % Find filter transfer function
  • [h,fq] = freqz(b,a,2*plen,fs);
  • plot(fq,abs(h).^2,col(2))
  • hold off
  • % Label figure
  • xlabel('Hertz')
  • ylabel('PDS')
autocorrelation function
Autocorrelation Function

As a measure of how quickly a signal changes on average, the autocorrelation is computed in the time domain:

Define the autocorrelation of a sequence as:

Repeat previous example for signal generation and compute the autocorrelation function.