13.07.2015 Views

Tutorials and Topics - Peabody Computer Music

Tutorials and Topics - Peabody Computer Music

Tutorials and Topics - Peabody Computer Music

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tutorial 26: Frequency Domain Signal Processing with pfft~Working in the Frequency DomainMost digital signal processing of audio occurs in what is known as the time domain. Asthe other MSP tutorials show you, many of the most common processes for manipulatingaudio consist of varying samples (or groups of samples) in amplitude (ring modulation,waveshaping, distortion) or time (filters <strong>and</strong> delays). The Fast Fourier Transform (FFT)allows you to translate audio data from the time domain into the frequency domain,where you can directly manipulate the spectrum of a sound (the component frequenciesof a slice of audio).As we have seen in Tutorial 25, the MSP objects fft~ <strong>and</strong> ifft~ allow you to transformsignals into <strong>and</strong> out of the frequency domain. The fft~ object takes a a group of samples(commonly called a frame) <strong>and</strong> transforms them into pairs of real <strong>and</strong> imaginarynumbers representing the amplitude <strong>and</strong> phase of as many frequencies as there aresamples in the frame. These are usually referred to as bins or frequency bins. (We will seelater that the real <strong>and</strong> imaginary numbers are not themselves the amplitude <strong>and</strong> phase,but that the amplitude <strong>and</strong> phase can be derived from them.) The ifft~ object performsthe inverse operation, taking frames of frequency-domain samples <strong>and</strong> converting themback into a time domain audio signal that you can listen to or process further. The numberof samples in the frame is called the FFT size (or sometimes FFT point size). It must bea power of 2 such as 512, 1024 or 2048 (to give a few commonly used values).One of the shortcomings of the fft~ <strong>and</strong> ifft~ objects is that they work on successiveframes of samples without doing any overlapping or cross-fading between them. Formost practical musical uses of these objects, we usually need to construct such an overlap<strong>and</strong> crossfade system around them. There are several reasons for needing to create such asystem when using the Fourier transform to process sound. In FFT analysis there isalways a trade-off between frequency resolution <strong>and</strong> timing resolution. For example, ifyour FFT size is 2048 samples long, the FFT analysis gives you 2048 equally-spacedfrequency bins from 0 Hz. up to the sampling frequency (only 1024 of these bins are ofany use; see Tutorial 25 for details). However, any timing resolution that occurs withinthose 2048 samples will be lost in the analysis, since all temporal changes are lumpedtogether in a single FFT frame. In addition, if you modify the spectral data after the FFTanalysis <strong>and</strong> before the IFFT resynthesis you can no longer guarantee that the timedomain signal output by the IFFT will match up in successive frames. If the output timedomain vectors don’t fit together you will get clicks in your output signal. By designing awindowing function in MSP (see below), you can compensate for these artifacts by havingsuccessive frames cross-fade into each other as they overlap. While this will notcompensate for the loss of time resolution, the overlapping of analysis data will help toeliminate the clicks <strong>and</strong> pops that occurs at the edges of an IFFT frame after resynthesis.201

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!