Page  45 ï~~Experiments with Chaotic Oscillators Richard Dobson and John Fitch The Media Technology Research Centre & School of Mathematical Sciences University of Bath, Bath BA2 7AY, United Kingdom, ABSTRACT: We explore the use of non-linear iterative formulae inspired by chaos theory for waveform synthesis, for generating sounds, control functions or amplitude envelopes. This is part of our aim, to produce a complete arithmetic instrument. Introduction: The application of chaos science and fractal techniques to music generation has been widely explored, to the extent that some commercial programs are now available (e.g. FractalMusic), enabling, for example, MIDI data to be derived from fractal images such as the Mandelbrot set (Mandelbrot,B.). The use of chaos equations to generate note sequences was described in (Bidlack,R.). On the other hand, it seems that much less attention has been paid to what might be called fractal waveform generation, especially outside the area of physical modelling, where the chaotic aspect of natural and instrumental sounds is investigated within the context of complex dynamical models (Keefe,D.). The computational demands of such models are considerable, and the modelling process itself is hardly a trivial task; this paper starts from the premise that computationally undemanding iterative formulae can be constructed which exhibit similarly complex behaviour over time, analogous to, but not analytically derived from, the behaviour of a physical system, and which may form the basis for an arithmetical instrument. In the creation of a typical fractal image, successive iterations of a recurrence formula (in the case of the Mandelbrot set and many others, in the complex domain) are tested for convergence, limit cycles or divergence. One or more coefficients of the formula are modified in a linear, ordered way to generate, in most cases, a coloured plane image. Beyond this graphical aspect, the exact character of the generated numeric sequence is of little concern. In the formulae described here, the potential musicality and stability of the generated sequence is of primary importance, and the modification of coefficients and variables chosen for their musical interest. Where necessary, a non-linear constraint formula is applied to keep the sequence within bounds. There is no claim that the formulae are fractal in the strict sense; the concern is solely with musical output. The examples we have investigated so far can be seen either as wave forms or as envelopes. We present one sample recurrence relation which can be configured to act in either mode. The wave form example is given in substantially more detail, as that is our main concern, but the envelope has some properties which suggest intriguing possibilities. A Simple Case Study: As a starting point, the complex-domain formula of the Mandelbrot set, Zne,,, - Z d + C can be recast in the real domain as a difference equation, with one necessary change of sign: X, =X2 1 C where, generally, 0 <C<<1.0 This will generate a simple exponentially decaying sequence, which is however forced into extended and possibly sustained oscillation by the negative C. It is assumed at this stage that the initial conditions (i.e. Xo in this case) are zero; a non-zero value for Xo will have the effect of altering the phase of a periodic output. By itself, this is almost entirely predictable, and of no great significance. It is sufficient to note that the DC offset caused by the constant C, can be simply removed in a practical implementation, and that even in this elementary example, a distinct evolution of the waveshape can be observed. There are two principal modifications to this basic formula which can be made, each of which leads to worthwhile changes in output. The first is to add a delay to the difference equation: X,=X -c where L is any arbitrary sample offset; we take L = 16. The resulting output has the form of a square wave with slightly sloping sides. The second, related modification is to add a further (linear) delay element, before or after the non-linear term, thus forming a non-linear filter: IC M C P ROCEE D I N G S 1995 4 45

Page  46 ï~~Figure 1: Quasi-sinewave Figure 2: High negative S with reduced C Figure 3: C = 0.14 has more complexity Figure 4: Increasing complexity Xn = X _I + SX, -2 - C (1) where typically 6 E [-0.75, 0.75], (C will generally need to be lower; in particular, 6 + C must not be too negative) The general effect of this is much as one might expect: a positive value leads to rounding of the underlying waveshape, an effect more clearly seen when combined with the delay, for example: Xn = XX_L + 6Xn_M -C where 0<M<L. We now concentrate on giving the non-linear term the maximum delay, while the linear term is the previous output: X, = XnL + Xn-1 - C (2) The rounding effect of the positive linear term is clear even at 6 = 0.25; with judicious values for C the waveform can be made to reduce to something approaching a sine wave (fig 1), a behaviour bearing obvious similarities to that of the Karplus-Strong algorithm (Karplus,R. & Strong,A.)(Jaffe,D. & Smith,J.). The effect of a negative 6 is more significant- in fact it forms the basis for the great majority of the examples presented here. Whereas a large negative C tends to produce crude linear-segment oscillations (to say nothing of the large DC offset) through successive iterations, a large 6 can in fact endow impressive rounding to the waveform (i.e. by extending its period), or add fractal complexity to it, and C can (indeed must) be kept small. In some cases, large values of 6 (i.e. close to -1) introduce ringing to an extent that the underlying square wave shape can be completed swamped by more rapid oscillations in forms suggestive of grains or wavelets (fig 2). Note, again, the marked changes in grain profile as the waveform develops. It almost goes without saying that the grain shapes differ according to the length of the delay: the difference between odd and even lengths is especially striking. An especially fruitful strategy is to give the closer of the two delayed terms an arbitrary offset up to L -1. The resulting waveforms can range from the highly complex to relatively simple pitched sounds. The latter can be truly simple (a single wavecycle repeated), but most exhibit a continually shifting phase between frequency components, surely one of the definitive features of 'fractalness'. Although it is rarely safe to generalise in a subject such as this, it has been observed that relatively prime ratios between L and the offset most often lead to the most elaborate waveform evolutions, whereas simple ratios can lead to very rapid convergence for all but the most extreme parameter values. The period of the waveform is not necessarily of length L (although this is true of the more elaborate formulae described later); the period can be be three to four times L, even for L = 2. For many of these waveforms, C functions as a sort of modulation index - indeed the spectrum can look remarkably like that of an FM-generated signal (fig 3). However, as C is raised, a chaotic threshold is reached, inducing strange attack patterns (fig 4). Note also the general changes of period, despite the fact that L is the same in each case. This is an especially clear demonstration of the natural rule that C +6 must not exceed a threshold value (in the absence of limiting) of around 0.95, and that a high C induces a long attack phase. 46 IC M C P RO C EE D I N G S 1995

Page  47 ï~~Figure 5: Seeded oscillator Figure 6: Evolution of a Seeded oscillator,.......................................................... Figure 7: Characteristic Envelope shape Figure 8: Length of envelope as a function of a and b Interesting as these waveforms are, a further level of sophistication in the formulae has proved even more fruitful. There are two basic oscillator types to be considered: the filter type described by formula (1), and the extended delay oscillator of formula (2), which will, for reasons that will become apparent, be called a 'seeded' oscillator. By adding a third linear term to the basic formulae just described, we establish a structure which contains an explicitly linear filter element. It is clear that only the application will decide whether this formula functions as an oscillator or as a non-linear filter: Xn = aX _1 + bX,_2 + cX2_M + C where the delay M < 3 This exhibits most of the characteristics of its predecessor, such as the rounded square wave typical of the longer delay lengths, with the expected refinement of enhanced rounding to most waveforms, which range from the almost sinusoidal to the semi-chaotic. Calculating the spectra of some of these decaying waveforms indicates that use of this formula as a non-linear filter could well be musically worthwhile. Our experiments with this are continuing. The Seeded Oscllator: More important in the present context is the question of initial conditions, to which only a passing reference has so far been made. Initial experiments with a single non-zero value and with a repeated single value led to the development of what we have called a seeded oscillator. This is almost identical to the formula above, except that the initial space occupied by the delay is filled with one cycle of a sinewave: X,,= A sin(2irn/L) n E [0, L - 1] where A is an amplitude (0 < A < 1) and L is a delay in samples. Then for n > L Zn = aX2L + bX(n-L)+l + CX(n-L)+2 + C This produces what is the most complete "arithmetic instrument" so far presented, and also the most acoustically interesting (fig 5). A description of this waveform surely constitutes that of an archetypally fractal sound: a chaotic attack which decays to a local minimum as it becomes periodic with a progressive loss of high frequencies, but with more or less subtle continuous phase shifts through the steady part of the sound, which has increased in amplitude from the minimum. In this example it is possible to identify a square wave shape during the transition, but this is not an unavoidable feature, as shown with slight changes to the parameters. In other cases, the waveform will become more complex as it evolves (fig 6). These examples also illustrate the ever present problem of numerical overflow. We want to retain as many of the 'fractal' features of these waveforms as possible, while, ultimately, being able to play these instruments I C M C P RO C E E D I N G S 1995 4 47

Page  48 ï~~in real time. In this case we can see that overflow can happen during the chaotic attack, and that if it can be constrained, the waveform will be able to continue towards its periodic, stable, state. This requires a non-linear compression function which will leave low amplitude samples substantially unaffected, while constraining high values to some upper limit. There are some high-powered functions which can be used, such as the hyperbolic tangent without losing the desired fractal behavior, but we still seek a limiting function which can be computed rapidly on a DSP. Simple attempts so far have destroyed the essential nature of these sounds. Such a function can be philosophically and aesthetically incorporated into the oscillator by analogy with acoustic instruments, whose otherwise chaotic behaviour is constrained by any number of fixed and variable physical systems - some deliberately chosen for musical effect, such as string and brass mutes, or the cloths placed inside a drum. On the other hand, some researchers may well feel that part of the fascination of these formulae lies in the search for interesting and musically useful waveforms without the use of such a safety net. A Family of Envelopes: The same recurrence relation, with the constant C always zero, but with non-zero initial conditions can be used to generate a family of envelopes, all of which show characteristic decay shapes, but the detailed structure, and in particular the total length of the sustained time is not a simple smooth function of the parameters. The recurrence formula is Xn = X_1-6X,_-2 X0=0.5 X1=-a the two parameters a and 5 defining the family. The general shape of these envelopes is seen in figure 7, where the initial disorganised variations can be seen to give way to a gentle decay. In fact the structure of the decay is more complex that the figure indicates. As might be expected with the chaotic origin of the recurrence relationship, the length of the decay is not a simple smooth function of the two parameters. In figure 8 the surface where the height is the length of the note, and a goes from 0 to 1 across the picture, and 6 goes from 0.99 at the front to I at the back is shown. This illustrates the non-smooth nature well. What this does open up is the possibility of an instrument which has notes which do not sustain as well as others, with resonances and dead points as the parameters vary slightly, and hence has a potential "natural" feel to it. Conclusion: What is obvious from all the equations we have described is that they are easy to calculate on a simple DSP chip, or on a simple computer. The wave forms do not need much storage for their calculation either. We have not presented here the frequency analysis of the waveforms, but they show pleasing characteristics of strong fundamental pitch, with little or no high frequency noise. There is insufficient space here to show all the properties of these wave-forms - natural sound evolution, low-pass filters with resonant frequencies, sustaining notes, rapid decay etc. We had to resist the rich vistas which opened out at every variation. We have hardly begun to explore this simple wave-generator. We have plans to create a unit generator for a system such as Csound (Vercoe,B.) as soon as we can ensure its safety. We commend these relations as a rich area for future synthesis engines, as although the formulae are simple the results look, and sound, attractive, with seemly infinite subtle variations. References: Rick Bidlack. Chaotic systems as simple (but complex) compositional algorithms. Comp. Music J., 16(3):33 -47, 1992. FractalMusic. Datamusic, London, 1992. Atari ST Software package. D. Jaffe & J. Smith. Extensions of the Karplus-Strong plucked-string algorithm. Comp. Music J., 7(2):56-69, 1983. R. Karplus & A. Strong. Digital synthesis of plucked string and drum timbres. Comp. Music J., 7(2):43-55, 1983. Douglas H. Keefe. Physical modeling of wind instruments. Comp. Music J., 16(4):57-73, Winter 1992. B. Mandelbrot. The Fractal Geometry of Nature. W. H. Freeman, 1982. Barry Vercoe. Csound - A Manual for the Audio Processing System Media Lab, M.I.T., 1993. 48 8IC MC PROCEEDINGS 1995