Lab-2: Sounds and their spectra

The spectrum of a sound can be computed by the Discrete Fourier Tansform (DFT):

In general we compute the DFT using a fast algorithm called Fast Fourier Transform (FFT), which has the restriction that the size of the array to compute, N, has to be a power of 2. The output is an array of complex values, complex spectrum, that is converted to polar coordinates, magnitude and phase spectra. The magnitude spectrum is the most useful function in which we can visualize many of the perceptual attributes of a sound.

2.1 Record sounds

The goal of the lab is to explore the use of spectra to understand and describe sounds. For that purpose the best is to record your own sounds and to be able to identify in the sound spectra as many characteristics as possible of the sound you recorded.

Record a few short sounds (a few seconds maximum) from different vibrating objects. Record sounds of different characteristics, such as percussive, harmonic, bowed, plucked, inharmonic,.... Use the highest quality possible and write the exact recording set up used, including the recording equipment,  placement of  microphone and how was the object excited to produce the sound.

Use a sound editor, like snd, to make sure that the recording is correct and to edit the sound so that is as short as possible and it has smooth boundaries.

2.2 Analyze and describe sounds

Before using Octave to compute spectra, experiment with different values of the Fourier transform using snd, especially the effect of the window size into the magnitude spectrum.

Select a few short fragments, less than one second, of the sounds recorded in the previous section. Convert them to an array with wavread, x=wavread('filename'). Listen to the sound arrays using sound, sound(x,samplingrate) (only works in Matlab) or from an external application.
  1. Display the whole sound with plot, expressing the horizontal axis in seconds.
  2. Display a few periods (5 to 10) of the attack, the steady-state and the release of a sound event. Explain the difference between the three displays.
  3. If the sound is harmonic, what is the fundamental frequency? 
  4. Compute the spectrum of a few periods (5 to 10) of the steady state of the sound using the function fft. Display the magnitude spectrum of the positive frequencies (the first half of the spectrum), with the vertical (magnitude) axis expressed in dB 20*log10() and the horizontal (frequency) axis expressed in Hz. The mag spectrum is computed with 20*log10(abs(fft(x, 1024)))
  5. In the case of a harmonic sound, how can you identify the fundamental frequency in the magnitude spectrum?
  6. Change the number of samples of the analysis, in a few steps, from a few samples (less than 1 period in a harmonic sound) to several thousand samples (several tens of periods of a harmonic sound). Explain the difference in the different spectra.
  7. Display the magnitude spectrum of the attack, steady state and release. Explain the difference between the three displays. Make the correspondence with the answer in 2.

2.3 Contribute to

Select a few of the sounds you recorded, upload them to  and describe them. The description should include information about the source, the recording process and the perceptual/spectral characteristics of the sound. For an explanation on how to upload sounds you can read this article.

Find sounds that might be similar to the sounds you uploaded and leave a comment in them making reference to your own recording or just commenting on their characteristics.