k y m a • t w e a k y — the kyma collective || view the current website || February 2015 Archive

/ WebHome / QuestionsChallengesPuzzlesUnexplainedPhenomena / Learn.WhatConstitutesADispersiveMedium


Learn Section


All Sections


Login / Register 
Change password
Forgot password?

Symbolic Sound

Kyma Forum
Eighth Nerve

TWiki Links


What constitutes a 'dispersive medium' and how might one model it in Kyma?

Dispersive Media -- This is a medium in which waves of different frequencies travel at different velocities. With electromagnetic radiation (light, radio waves) this occurs because the index of refraction of the medium is frequency dependent. The index of refraction controls how much the wave bends away from a straight line as it traverses the medium. You all know about prisms and how it bends blue light more strongly than red light, hence casting a spectrum or rainbow of colors on a projection screen.

In the case of light the index of refraction is a property of the material. Many of you have seen the colored fringes outlining objects in cheap binoculars or telescopes. That chromatic aberration is caused by the fact that the index of refraction of the glass lenses is different for blue light than it is for red light. The speed of blue light through the glass differs from the speed of red light, and so they don't come to the same focus. In most glasses the index of refraction is larger at blue wavelengths than at red.

In the case of radio waves, those chirps referred to above happen because of the interaction of free electrons in the high stratosphere with our Earth's magnetic field. That "plasma" has an effective index of refraction that depends on the frequency of the radio waves, the strength of the magnetic field (which grows stronger toward the north and south magnetic poles), and the electron density. This is also the reason why radio waves of low enough frequency bend back toward Earth after radiating skyward from the transmitter, hence enabling the reception of short wave radio signals from the other side of the Earth.

But probably of more interest to the reader is the concept of dispersive acoustic media. A metal bar is a classic example of dispersive acoustic material. High audio frequencies travel at a different speed in the bar than lower audio frequencies, and this is what gives rise to the anharmonic spectra when the bar is struck with a mallet. The resonant frequencies of a bar are determined by the speed of sound, and since low and high frequencies travel with different speeds the resonant wavelengths do not bear a simple geometric relationship to one another. Most of our musical instruments are based on the creation of harmonic spectra, but metal bars and plates, and even the kettle drum, exhibit distinctly non-musical overtone series. But that's what makes them so fascinating to hear!

So why does this happen? We know that very fine strings are almost perfect (but not quite perfect) harmonic resonators. That's because the tension in the string is directly related to its displacement when plucked or bowed with a rosin coated horse-hair. But in metal bars and plates that restoring force is a nonlinear function of the displacement. The speed of sound in the metal bar varies according to the square root of the frequency, while it is constant in the ideal thin string. Hence high frequencies have a higher speed of propagation in the bar compared to lower frequencies.

[For those familiar with the subject, the wave equation for a thin string is a linear 2nd order differential equation, while for a metal bar or plate the equation is 4th order in spatial coordinates and 2nd order in time -- exceedingly difficult to solve except for the simplest boundary conditions.]

-- DavidMcClain - 19 Nov 2003

What physical property (or properties) of the metal bar allow high frequency waves to travel through it at a different velocity than lower frequency waves? Is there something analogous to the interaction with free electrons in the stratosphere that is going on inside the metal bar (like islands of different density that are small with respect to some frequencies but large with respect to short wavelengths?) Is there a general set of physical properties that describes all dispersive media?

Is there anything about the structure of an Allpass filter that mimics the physics of a dispersive medium? Or is it just a coincidence that its behavior is similar?

-- CarlaScaletti - 20 Nov 2003

What makes a metal bar dispersive? Well the answer to that lies in the nature of the restoring force for a bent metal bar (or a bar of any other material for that matter -- e.g., wood, plastic, metal, glass). That restoring force is a nonlinear function of the displacement of the material. This has to do with general properties of solids known as the Young's Modulus. If you were to examine a cross section of a bar while bending it, you would see that the top of the bar is being stretched, while the bottom of the bar is being compressed. These shearing forces depend on the third derivative of the displacement, as long as you don't exceed the so called "elastic limit" of the material. Going beyond that limit either permanently deforms the object, as in stretched plastic or bent metal, or else it breaks if it is brittle like glass.

So the nature of solid materials in a rest state is such that the chemical bonds in their susbstance prefer specific distances between the atoms or molecules. Stretching a material causes it to want to snap back. Compressing it makes it want to uncompress. These are properties of chemical bonds, which are complex interactions between shared electrons and nuclear spacings. Going beyond the elastic limit actually tears some of these bonds apart.

The one thing in common, shared by all dispersive media, is the nonlinearity of its behavior. Once you have nonlinear behavior small displacements behave differently from large displacements. Since you can decompose any shape into a series of sinewaves, and these various component waves have different amplitudes, it becomes easy to see that if large displacements behave differently from small displacements, then the material is sure to become dispersive with frequency. Most shapes have diminishing amplitudes as you go toward higher frequency components, c.f., sawtooth or triangle waves which can be thought of as diminishing amplitude harmonic series.

[Nonlinearity refers to two things being related but not by a simple proportionality constant. Rather the two things are related by some more complex relationship -- square root, square, cube, reciprocal, anything other than simple proportionality.]

How does one model such behavior in Kyma? Great question! An all-pass filter is one that does not alter the signal amplitude, but does impart a varying phase shift in a frequency dependent manner. The (negative) derivative with respect to frequency of that phase shift is indeed a delay, and so this does become a dispersive element. But this is actually true of just about any filter you could design that contains "poles". FIR filters do not contain poles and so they are non-dispersive. But an FIR filter has the property of producing an output even before the input arrives -- in a manner of speaking.

[ I should have said, common implementations of FIR filters do not impart any phase shift except a linear phase ramp -- which becomes a constant delay. You certainly can design FIR filters that are All-Pass with arbitrary phase shift. See below in the discussion about Fourier Domain techniques with FFT's. ]

IIR filters on the other hand, do have poles, and they do not produce any output until the input signal arrives. However, their response is theoretically infinite in duration - hence the name "IIR" = "Infinte Impulse Response". Such filters, by virtue of their having poles, impart a frequency dependent phase shift to the input signal on output. Even the Kyma Butterworth filters produce these frequency dependent phase shifts. So this behavior is not restricted only to All Pass filters. You can see this indirectly in the phase cancellation of parallel filters. There are some frequencies, even when the filters are all arranged with overlapping pass bands, that are simply attenuated, despite your best intentions. This is true for all but 1-pole filters arranged with overlapping passbands.

But if you want to create a dispersion similar to that of a metal bar, you need to produce a phase shift such that its derivative with respect to frequency varies as the square root of that frequency. Offhand, I don't know how to do that with conventional DSP algorithms, except over limited frequency ranges. Over those limited ranges we can approximate this behavior with aptly chosen All Pass filters.

The other way to produce this effect would be to solve the differential equation representing the propagation of bending waves in real time using DSP approximations. Rather than resort to this heavy approach, I used the precomputed series solutions of this wave equation in my metal bar sounds, for the first 20 or so overtones. The drawback here is that it is difficult to model changes to the boundary conditions. Those series solutions assumed one of two pre-specified boundary conditions: those of a bar clamped at both ends, and those of a bar freely suspended. The spectrum of overtones for each case is quite different. But modeling a bar clamped at some arbitrary point is not possible with these precomputed solutions. That's where solving the differential equation in real time could be useful.

Another way, which might work, would be to work in the Fourier domain. Reasoning that the delay is inversely proportional to velocity, one could use an All-Pass amplitude response along with a phase ramp is twice the negative square root of frequency. This phase ramp needs to bend downward toward more negative phase angles as frequency is increased, in order to model the behavior of increasing speed of sound as frequency increases. However, when you do this you must work in the complex valued Fourier domain. It must be such that this phase response is an odd function of frequency in order to produce a real-valued output signal.

But now, you have to work with overlapping sections of sound and phase discontinuities between these sections will present a problem in the resulting sound. And the scaling of the phase shifts is likely to be extreme, making the result appear to have random phase shifts in higher frequency FFT bins. It all depends on how much dispersion you wish to achieve.

Truly the best ways to work are either solving the differential equations in real time, or else using an approximation over a limited frequency range with suitably chosen All-Pass IIR filters. Finding those filters will be a challenge. All-Pass filters will only be able to impart slight amounts of dispersion to the input signal.

So here is a case that argues for some DSP code to permit a sort of "finite element modeling" of acoustic systems. This could be really interesting!

-- DavidMcClain - 20 Nov 2003

Okay! I just came up with another idea here... You could convolve your sounds with a chirp! The chirp itself would be the sound resulting from any sharp impulse sound. So if you design a chirp of appropriate dispersion, you could model the sound of any dispersive medium by simply performing a convolution -- multiplication of the FFT of that sound with the FFT of the chirp itself. A chirp has an FFT that looks like a slinky -- cosines for the real part and sines for the odd imaginary part. I just tried this out in a numerical modeling environment of mine, and it does indeed work. My impulse got dispersed in the time domain.

I created my chirp by first producing a phase that is the negative square root of the FFT cell number. Then I folded that over to negative frequencies with sign reversal. So the phase looks like a backward "S" shape. Then I created the real and imaginary parts of this Fourier domain chirp by taking the cosine for the real part, and the sine for the imaginary part. These look like slinkies. Taking the inverse transform of that complex valued function produces a smeared out impulse with a sharp attack and a trailing sound diminishing quickly.

It is easy to produce chirps with Kyma. Just create an oscillator that swoops down in frequency by some function of time. But in Kyma, the duration of the chirp must be less than half the longest available FFT in order to avoid time aliasing artifacts. So that pretty much limits our chirps to durations of 10 ms or less. If you capture one of these chirps and cyclically multiply its FFT by the FFT of the incoming signal, you end up convolving your signal with this chirp, producing the dispersed version of your input signal.

-- DavidMcClain - 20 Nov 2003

Carrying this process one step further... an FIR filter is the inverse FFT of the desired frequency response. So to convolve an input signal with a chirp, one only needs to obtain the impulse response of that chirp and place those values as coefficients into a Kyma FIR Filter Sound block. Remember to reverse the order of those coefficients when you place them into the Kyma array. In order to get a longer response time, you could perform the computation of these filter coefficients offline. I think the FIR filter allows up to 4096 tap weights.

So here is an example of an FIR that does perform all-pass amplitude response with a variable phase shift. When you see this filter's tap weights displayed on a graph, you will notice that it is highly asymmetric. Most conventional FIR filters for band pass, low pass, high pass, and band reject, appear symmetric and impose only a constant delay on the input signal. But not this one...

-- DavidMcClain - 20 Nov 2003

Okay, after experimenting with these ideas, I came up with a Sound I call Whacky Dispersion. It is very simple and coarse. Just take 6 or 7 of the Graphic EQ Sounds and mix them all together. Give each one all zeros for the amplitudes except in one of the frequency bins. Make sure to give each one its own octave band. Then insert a Delay in series with each of these filters and give each delay a 20 ms maximum delay and expressions like !D250/20, !D500/20, etc, in the DelayScale? fields. Now play your favorite sounds through this process and click the dice button to randomize the individual delays.

Native Instruments markets a little tool to do this kind of spectral warping with more degrees of freedom. I think they call it Spektral Delay. But after playing with such a toy, one might quickly tire of it -- unless you need some wierd ambience beneath your music.

In and of itself this is only mildly interesting. It mushes out drums and causes a few notable interesting delayed effects. So what's missing here? Why doesn't this sound as interesting as a metal bar?

The answer lies in the fact that dispersion alone only chirps frequency components. What sets a metal bar apart is the fact that each different frequency of bending waves in the bar has a different velocity, and hence its wavelength varies in a nonlinear way with increasing frequency. That coupled with the boundary conditions of the bar -- the fact that it is sawn off at both ends and either suspended freely or clamped somewhere, makes this a special kind of resonator. Those frequencies whose wavelengths are not simple submultiples of the length of the bar are severely attenuated, while those which are commensurate set up standing waves of resonances. It is this fact that makes this particular kind of dispersive medium interesting to hear. Dispersion alone is simply not that interesting. Imposing constraints on that dispersion makes for "musical??" qualities.

-- DavidMcClain - 20 Nov 2003

Isn't this the same phenomenon that happens when you listen to sounds under water?

-- TobiasEnhus - 25 Nov 2003

For Sounds that give different amounts of delay to each partial of the spectrum, I recommend taking a look at:

Kyma Sound Library > Effects > Spectral Processing-Live > Delay Partials (16) and Delay Partials LITE and

Kyma Sound Library > Effects > Spectral Processing-Analyzed > KBD Sweep Partials + echo (there are several variants, but the last one is my favorite)

-- CarlaScaletti - 25 Nov 2003

"Isn't this the same thing that happens to sounds under water?" What an interesting question!

I'm not a mechanical engineer, and I can't imagine for the moment how one might measure the Young's Modulus of water. Surely there must be a way. There ought to exist a continuum of media properties as one proceeds from the nearly perfectly linear behavior of gases to the well observed nonlinear behavior of solid substances - with liquids in between these two extremes. So I would imagine that water would be slightly dispersive to sound.

However, I can't recall any particular chirping to impulsive sounds heard under water. I'll have to ask my brother, who is a retired Submarine Sonar Operator. I do recall hearing sounds become more thuddy or bass'y. And that points out something to keep differentiated in our thinking.

Dispersion affects the speed of sound as varying with frequency. But media can also exhibit attenuation that varies with frequency. These are two completely different effects. In the case of dispersion, a bar or block of material will resonate at anharmonically related frequencies -- not the nice musical overtones we are accustomed to hearing. This says nothing about how quickly each overtone is damped. Similarly, just because a material damps out high frequencies faster than low frequency vibrations, it need not necessarily be dispersive.

-- DavidMcClain - 04 Dec 2003

© 2003-2014 by the contributing authors. / You are TWikiGuest