Why You Hear What You Hear

 

Home | MAX patches | Software | Using Falstad applets | Recording Audio| Links

Supplements for Chapter 11

Impulse Response, Building and Sculpting Power Spectra

CDF Applet PulsePowerCorr

This CDF applet written by the author (instructions below) makes the connections between signal, autocorrelation, and power spectrum much more intuitive. You have control of three variable width pulses, which may be moved around in time and are pitched, or not.

The principles of spectrum "sculpting" are easily explored by introducing "echoes" at later times. The effect of pitching the pulses is dramatic, and relevant for example to the trumpet and many other musical instruments.

The CDF Player is free, downloadable from Wolfram's Mathematica website. You will be prompted to install it if you open the CDF applet and don't have it installed. This applet starts with a signal consisting of three pulses of variable timing and variable width. The pulses may be "plain peaks" or they may be pitched, meaning each pulse is itself a cut-off sinusoidal signal. The autocorrelation is computed and shown, along with the cosine at one frequency. The power spectrum is shown at the bottom.

"time1", 2, and 3 control the times the pulses arrive. sigFreq controls the frequency of a sin wave modulation of the peaks, giving them each a finite pitch. The strength of the second peak and third pulses relative to the first are controllable, defaulted to 0.

The amplitude of the pulses may be set positive or negative, which allows simulation of reflections of an open pipe for example, using a negative second pulse.

"sigFreq" controls the frequency of the Cosine transform, plotted against the autocorrelation function, and the cosine multiplying the autocorrelation, below that. The outcome of the balance of orange vs. blue (orange is positive) determines the strength of the power spectrum at that frequency.

"decay" controls the width of the peaks in time, note the uncertainly principle effect on the spectrum in frequency.

"frequency" controls the frequency of the Cosine transform, i.e. the frequency at which the power spectrum is being examined (even though a range of frequencies is always displayed, selecting "frequency" shows how it does the calculation at a frequency of your choosing. This way you see explicitly how peaks and dips develop.) . This is plotted along with the autocorrelation function on the left, and the cosine multiplying the autocorrelation, on the right, in two side-by-side plots. The outcome of the balance of orange vs. blue determines the strength of the power spectrum at that frequency.

Spectrum sculpting and echoes

Here is an instructive example that helps cement the relationship between continuous spectra, as seen at the bottom, belonging to a single short pulse, and sharp spectra that are due to a very long sound made up of a set of fixed frequencies. All the examples above the bottom case are periodic repetitions or echoes of the same short pulse used at the bottom. It is understood that the pulses repeat very many times, giving rise to the sharp spectral lines seen. Their power spectra fills in the broad envelope in proportion to the envelope itself, with a spacing between the peaks inversely proportional to the spacing between the pulses, i.e.. a 0.05 s echo gives rise to peaks spaced by 20 Hz, and a longer 0.1 s echo gives rise to peaks spaced by half that, i.e. 10 Hz. This example may be seen as "sculpting" of a power spectrum due to repeated "echoes" of the original signal.

Impulse response and spectrum of a stretched string with internal loss

Since we understand it so well from chapter 8, the stretched string ought to give excellent examples of the sculpting principle, impulse response, etc. We can drive the string sinusoidally or create a pulse at the left end (figure below) while keeping it stretched. Suppose the waves created lose energy on their way to the wall on the right, due to internal friction in the string, or friction of the string moving through the air, etc. We consider three strings of the same density and tension, but different lengths: L, 2L, and 4L. The longest string, length 4L, shows clear visual evidence of the attenuation of the wave; not much energy reaches the right hand side and even less reflects all the way back to the left to produce an echo. The power as a function of frequency exhibits clear resonances at equally spaced frequencies for a short string (top). Those peak frequencies are the natural mode frequencies of an identical string with no damping. Here however the modes correspond to damped resonances, with a finite Q.

The middle case is a string twice as long as the first. SInce the resonances differ by a frequency proportional to 1/length, we see resonances spaced (green line) by half of the shorter (black) resonances (compare them at the bottom of the figure). They are also more strongly damped (lower Q) since the waves must make a longer round trip to produce an echo, suffering more loss along the way. [Question: how much smaller should the Q be? Recall that the wave travels twice as far as the shorter string, with the fractional energy loss of the wave the same , and the period of the returning pulse is twice as long. ] The resonances of the longest string, twice as long as the middle one, are closer together by another factor of 2. They are very strongly damped due to the the long round trip journey and feeble return echo.

At the bottom we see the three power spectra compared. These spectra can be obtained, as we know, either by sinuoidal driving and easuring power input at a range of different frequencies, or by Fourier transform of the time response (autocorrelation) to a pulse at the end of the string. Note that the power as a function of frequency is the same for all three strings, if we average over the resonances, which is to say that the short time autocorrelation is the same in all three cases. It is clear that the short time response is the same for all three, since the string is the same density and tension at the left, and any pulse at short time has not had time to reach the right hand side and reveal the presensce of the end there. All this is in complete accord with the scuplting principle.

Essential video! This is fantastic!

An excellent and explanitory video from the makers of Altiverb, an industry leader in impulse response measurement and processsing, especially for sound spaces:

http://www.audioease.com/Pages/Altiverb/

Free Impulse Response recordings - doing your own impulse resonse reverb

A web search reveals many free sources of impulse response (IR) functions for acoustical spaces and even objects of various sorts. Often these are provided as normal sound files, such as the format .wav. They are in effect the sound of a sudden bang and its aftermath (unitl the sound dies out) in a given space. By "convolving" this IR with a "dry" sound (e..g. the sound of a guitar recorded with no reverberations at all, i.e. recorded in a "dead" space), you can hear what the sound would be like in the space where the IR was recorded, e.g. the Albert Hall.

Some IR's are synthesized, i.e. computed rather than measured. Synthesized IR's have the disadvantage that they are not perfectly realistic for any given space, but they have a balancing advantage: it is possible to vary the IR according to parameters which are under the user's control, such as reflectivity of the walls, size of the space, etc.

Performing a spectral analysis on the IR often reveals strong resonances belonging to the object or space used for the impulse response; a sonogram analysis may reveal such resonances and the tendency of the space or object to dampen certain frequencies more rapidly than others.

At this site by Acoustics Engineering, you see photos of the spaces for which the IR's are provided. All the examples are interesting, and quite different.

It is highly recommended that you listen to the "before" and "after" IR convolution, such as are available on this page (the SIR reverberation plugin), or here. There is a demo of SIR available, in VST and Audio Unit pluging versions, which can be used in any VST or Audio Unit host, such as Amadeus (in 32 bit mode). You can record your own IR's with a click source and a microphone, and use them in convolutions with SIR. To know what is really going on, be sure to view the Altiverb video above.