(updated 2nd section)
m
Line 20: Line 20:
 
<code>chirp1 = chirp(t,0,2,500); % creates signal sampled at 1 kHz for 3 seconds & crosses 500 Hz at t = 2 seconds</code>
 
<code>chirp1 = chirp(t,0,2,500); % creates signal sampled at 1 kHz for 3 seconds & crosses 500 Hz at t = 2 seconds</code>
  
<code>chirp2 = chirp(t,50,1.75,400,'quadratic'); % creates quadratic signal sampled at 1 kHz for 3 seconds & crosses 400 at t = 1.75 seconds</code>
+
<code>chirp2 = chirp(t,50,1.75,200,'quadratic'); % creates quadratic signal sampled at 1 kHz for 3 seconds & crosses 400 at t = 1.75 seconds</code>
  
 
Then use the spectrogram command to create a spectrogram:
 
Then use the spectrogram command to create a spectrogram:
Line 30: Line 30:
 
<code>% Using a window of 320, an overlap of 300, 512 DFT sampling points, and a sampling rate of 1 kHz </code>
 
<code>% Using a window of 320, an overlap of 300, 512 DFT sampling points, and a sampling rate of 1 kHz </code>
  
<code> spectrogram(chirp2, 320, 300, 512, 1000, 'yaxis');</code>
+
<code> spectrogram(chirp2, 320, 300, 512, 1000);</code>
 
+
  
 
=== Analyzing Your Signal ===
 
=== Analyzing Your Signal ===

Revision as of 18:23, 2 December 2017

Sound & Color - Using Spectrograms to Analyze Sound Signals

By: Emma Gihl


Background

A spectrogram is the visual representation of the frequency changes in a signal as they vary with time. This image can be useful when analyzing changes in frequency that cannot be easily seen in waveform view. A spectrogram is created by taking the DTFT at a certain time and displaying it vertically. This is done repeatedly to create the overall image. Spectrograms can be manipulated to analyze specific signal properties by altering the DTFT used to create it.

Wideband spectrograms limit the time window to about the length of one period for the DTFT. This increases resolution in the time domain and decreases it in the frequency domain.

Narrowband spectrograms use a longer DTFT that covers several periods of the signal. This increases resolution in the frequency domain and decreases it in the time domain.

Processing & Displaying Your Signal

In order to create your spectrogram you first need to create a series of windowed DFTs. The Matlab function 'spectrogram' makes processing & displaying a spectrogram very easy.

First generate some audio signals:

% Create a 'chirp' sound using the chirp command

t = 0:.001:3;

chirp1 = chirp(t,0,2,500); % creates signal sampled at 1 kHz for 3 seconds & crosses 500 Hz at t = 2 seconds

chirp2 = chirp(t,50,1.75,200,'quadratic'); % creates quadratic signal sampled at 1 kHz for 3 seconds & crosses 400 at t = 1.75 seconds

Then use the spectrogram command to create a spectrogram:

% Using a window of 120, an overlap of 120, 128 DFT sampling points, and a sampling rate of 1 kHz

spectrogram(chirp1,128,120,128,1000);

% Using a window of 320, an overlap of 300, 512 DFT sampling points, and a sampling rate of 1 kHz

spectrogram(chirp2, 320, 300, 512, 1000);

Analyzing Your Signal

Conclusion

Sources

[1] Understanding Spectrograms : https://www.izotope.com/en/community/blog/tips-tutorials/2014/09/understanding-spectrograms.html

[2] Lab 9a Speech Processing : https://engineering.purdue.edu/VISE/ee438L/lab9/pdf/lab9a.pdf

[3] Matlab Documentation on Spectrogram : https://www.mathworks.com/help/signal/ref/spectrogram.html#outputarg_s

Subcategories

This category has only the following subcategory.

Alumni Liaison

BSEE 2004, current Ph.D. student researching signal and image processing.

Landis Huffman