Algorithmic Music

What is an algorithm?

Strangely, the word algorithm has recently acquired an almost anthropomorphic status, referring to the oppressive ejudicator of internet rankings, for web pages and YouTube videos. And indeed, algorithms can be very complex, to the point of enabling mimicry of human cognition and judgment, as we see in AI developments. But the original & basic meaning comes from medieval Arabic mathematics, and refers to a generic process or series of tasks which will produce an expected or repeatable result, from a given set of inputs. We could even refer to a systematic shifting & grouping of stones on a table, to help with arithmetic division, as a simple physical algorithm. Like much of mathematics, algorithms are a neat tool to relieve mental effort, and describe possible solutions to problems, trivial or otherwise.

For music?

With the advent of MIDI, score-printing software and digital audio workstations, it is possible to produce music without even picking up a traditional musical instrument, let alone performing impressively upon it. While much mainstream music still insists on live, talented musical performers (more comments below), an increasing amount of what we actually hear is artificial, in the sense that it can be designed and programmed by non-performers who have computer-mouse skills and a good ear. And in a sense, the processes underlying this kind of music production are algorithmic, since there are abstract inputs being directly and reliably (and tastefully) converted into sound.

But there is at least one more level to this, where these processes can be controlled by algorithms, and automated. And not only those processes applied to a pre-composed piece of music toward its final, recorded form, but also to the composition phase. It’s still quite reminiscent of traditional composer-to-orchestra workflow, only much quicker and (theoretically) more empowering. For me, as a non-performer with fair design & listening skills, algorithms offer the chance to create real musical objects. As long as my models of what constitute music are valid, and audiences are non-negative in their response to the results, the algorithms I build can be applied repeatedly, just changing parameters for new kinds of results. My ultimate goal was to produce nice (at least interesting) music with a single tap of Enter.

Non-conventional composition

Although there have been many, various & extraordinarily clever techniques employed by 20th and 21st century composers, few of the resultant works have entered the popular mainstream, and some are indeed challenging for even the keenest proponents of Avant-garde. Nonetheless, composers have long since left the constraints of traditional techniques and theoretical bases such as those Mozart, Chopin, Verdi, Mahler etc applied to attain exemplary musical heights, and have become comfortable exploring alternatives. Many still use the old ways, it’s all well & good.

There are of course many foundational elements which a composition technique must address, however abstract the theoretical basis and convoluted its procedures. And we can perhaps categorize the methods into two mindsets: one where the practitioner relies on training in performance and theory, and the other which uses a naive, experimental approach. Here’s a very simple quadrant showing the various pros and cons of typical composing methods; we often draw one from each column. Here, instrument just means one’s chosen sound-source.

ON INSTRUMENT USING THEORY
Y May include distinctive instrumental effects, but results may be too rote or familiar. Harmonic & orchestration solutions can be easy to see, but also easily limited by rules & conventions.
N Not limited by habits, natural actions or ability, but result may be difficult to play. Melodic lines, harmony, orchestration freer & more surprising, but may be limited by weak inventiveness.

Now for some of us, who lack the talent for playing an instrument, or have trouble with reading and writing (Western) musical notation, or have no accurate sense of pitch, composition must involve suitable techniques and “tricks”. My own approach was simple enough – use modest coding skills to 1 create algorithms which in turn 2 create musically relevant data structures, 3 organize the data, and 4 generate audio and/or MIDI.

What can be achieved?

All going well, any musical object can be produced using any well-designed compositional procedure (algorithm), to the point where action by the composer can be reduced to scribbing on graph paper, rolling dice, or clicking on a button. It’s quite rare now to find composers writing out pages of manuscript with a pen, mainly because modern life is too urgent, and we are lazy, and it’s just not really necessary. I often wonder, though, why it is that History can still judge say, Mozart’s hand-written scores, as somehow superior in their content to what is produced with modern DAWs, powerful digital equipment, and near-instant communication of ideas across continents. It’s a complex topic, but I think it becomes all the more poignant as we begin to apply advanced AI to music production – it may force us to reconsider, re-evaluate, re-establish the human connections to Music. When I said “empowering” earlier, I was referring to the potential, rather than the reality.

Anyway, my own approach grew from a combination of laziness and impatience, nurtured by a growing understanding of what musical materials and processes are essential, what are trivial or arbitrary, and what aspects are actually within my cognitive reach & physical domain. There are so many options at every stage of the compositional process, and some are quite tedious. And this wealth of options suggested that many decisions could be off-loaded to stochastic (probabilistic) methods, so what was left could be managed in a fairly natural manner. Constant access to ongoing results (as we get during a typical DAW session) can be very discouraging, and we can get caught up in details which turn out to be irrelevant to an audience. An algorithmic approach helps to provide a separation from temporary uncertainties, and can make us more productive. In addition, once the overall framework is found to be satisfactory, we can also remain separated from any tendencies, decisions & limitations imposed by traditional composition and its theories.

Algorithms for lower levels

As mentioned elsewhere, I decided early on that the instruments or “voices” used in the algorithmically composed pieces needn’t be acoustic or electric, to be skilfully played and recorded, but could be synthesized. And obviously a necessary level of complexity (to stand comparison with human voice and traditional musical sources) would require very careful & systematic design, and thus an algorithmic approach here also. Applied at a very small time scale (anywhere from a sample at 22 nanoseconds to a vibrato at 200 ms), coded functions could help design digital instruments down to extraordinary detail. The challenge, of course, is finding out what details are necessary – it’s not widely known, and it has nothing in common with say, luthiery, except for the equation of harmonic motion x = A*sin(2*pi*f*t).

This part of the Dmuse system, which I named Dsynth, required research into and construction of a synthesizer which could incorporate both low & high levels of algorithmic control. There are many synths out there already, free & commercial, but I didn’t want a black box built upon god-knows-what principles. Unfortunately, while my attempt has reached an excellent degree of operability, and a few examples of solo voices have appeared on → bandcamp, there is (at the time of writing) a yawning gap between the interesting results and what can pass as a voice within a musical composition.

I’m thinking that part of the solution to making synthetic voices more “natural”, satisfying the ear in a holistic manner, is distilling & simplifying certain aspects of traditional physical instruments, in the same way that a satisfying artificial flavour may be extracted, replacing the need for an entire fruit. Something like a guitar, for example, might be modeled and idealized, and have undesirable effects like fret noise, buzz, twangs and bad tuning removed. This might enable a more essential guitaresque sonic experience. But, much still depends on our imagination and subconscious associations; in the case of a guitar, we may expect a hero(ine) to be dexterously conquering its fretboard, bathed in sweat and stage lights. Providing an equally rich subtext is perhaps the deepest challenge for new, synthetic instruments.

Another, quite simple, part of the solution is to provide an aural space around the plain, two-dimensional digital wavefront. This can be achieved by superimposing reverberation, which simulates a room with its complex reflections and timbral alterations of the voice based on the size of the room, where in its space the instrument appears to sit, and where in the room we seem to be hearing it. This is the natural process for sound reaching an audience, and we are easily convinced of the extra dimension, and hopefully seduced into a sense of “realism” by this familiar effect, instead of being distracted by signs of the voice’s artificial origin.


hondrd@skyknowledge.com
Content © 2023 Ian James