Daniel Iglesia

research

FFT-based splicing

Analyze different sounds for points of spectral similarity, then cut amongst them.

Analysis, Resynthesis, and Scoring of a Very Short Sound

Stretch out a very short sound, analyze it for prominent tones, and score it for piano.

THE XEN ALGORITHMIC COMPOSITION PROJECT

The computer program XEN is an continually expanding project, first based on a project entitled "An Implementation of Xenakis’Stochastic Principles". As it is continually expandable, it provides the most all-inclusive basis for my study of algorithmic composition.

The program takes in a series of user-written commands and generates (with the use of some translation shareware) a MIDI score. The first implementation defined 4 modular "events" (i.e. functions): block, layer, rise and fall. These events, plus their individual parameters are defined by the user. Parameters (which differ for each event) include duration of the event (in measures upper and lower ranges, note duration, etc.)

Since then, subsequent improvements have added both new events and new manners of specificity. For example, the notes in an event can be adhered, with varying degree, to various keys/notes/scales. Allowances for repeating motifs and cantus firmi have been added. And some of my other algorithmic composition programs (currently, my Counterpoint generator and my Riley-O-Matic) have become their own functions within XEN. Additionally, I am currently working to add an optional output to SKINI file format for use with Perry Cook’s Synthesis Toolkit. Ultimately, I am interested not only in furthering the program at this level, but in the notion that this level may merely be the lowest of several layers of abstraction towards the larger notion of computer composition. Imagine then, upper-level programs that can write the currently user-written score, and apply larger-scale stochastic gestures.

The RILEY-O-MATIC

The Riley-O-Matic generates a piece in the style of Terry Riley’s In C. It takes in 4 user parameters (tempo, length in measures, smallest allowed note value, and number of instruments) and returns either a SKINI score file (for use with the Synthesis Toolkit) or an ABC file (a format that is then translated into MIDI). The actual instrument(s) that play the piece are defined in those programs.

My implementation (like Riley's) first generates an array of random measures. To do this, a random integer "density" is created. "Density" is a percent (1-100) probability that an event will occur. The struct "melody" contains just three arrays: "ticker"(which signifies the start of a note), "ender" (signifies the end of the note on that beat, and the incrementation of the index to the pitch array), and "pitches"(many within an octave, are generated, though not all will be used). The input parameter "resolution" affects a variable "tickpermeasure", which is the number of events that can occur in a measure (for whole notes, it would be 1, for 16th notes, it would be 16). So for each possible event, we assign a "1" with a probability of "density".

So here's an example melody with 16 ticks per measure and a density of 40.

And here's an example with 16 ticks and a density of 10:

Once the measures have been created, the implementation is just like Riley’s In C. Each melody, once started, is repeated as many times as one likes until moving on to the next measure. This decision is made by a mere random chance within predefined bounds, but alternate choice methods (bell-curve distribution, external control, etc.) are easily implemented.

COUNTERPOINT GENERATOR

This is my Junior Project. The program takes an input consisting of the species desired, the lower and upper bounds of the desired range, and the pitch values of each cantus firmus tone (note: as we are in a 16th-century mindset, the program is completely diatonic, not chromatic. The mode is determined by the cantus firmus input, but key-wise is always in C. When this program was ported as a module to XEN, allowances were made for key transposition). On the command line, we can define how many of the best melodies we would like to see, and whether or not the counterpoint is above or below the cantus firmus (voice crossing is allowed, of course).

Whereas other counterpoint programs find a technically correct solution, this program finds every correct solution, then attempts to rank them on an aesthetic basis. Finding all the legal melodies is a daunting algorithmic task, as the number of legal melodies usually grows exponentially huge as the length of the cantus firmus increases (the number is especially unwieldy in 3rd and 5th species).

Each possible melody is put through a series of functions that test all the rules of counterpoint. My first attempt was mere brute force iteration. My second attempt iterated at whichever tone caused the earliest infraction, saving thousands of iterations for each error found, but still too slow. The best solution (though it has the traditional time-space tradeoff) is a bottom-up binary recursive algorithm. For each measure, all the legal melodies are found; then, each possible measure 1 is attached to each possible measure 2, and bad melodies are weeded out; this is done with measures 3 and 4, and the resulting melodies are then matched with those of measure 1 and 2, etc. until the first half of the melody is matched against the second half of the melody, and what remains is all the remaining legal melodies. If many melodies pass each stage, however, the running time of the program can still be quite high. This running time can be reduced somewhat by allowing a set number of leaps, which therefore reduces the number of melodies that pass each stage. This changes the result of the program from a global optimum, to the global optimum with under a certain number of leaps; but since an aesthetic value of 16th century counterpoint is a low number of leaps, this is an acceptable change.

Most legal melodies, however, are aesthetically unappealing. Each species has a particular formula for aesthetic appraisal. Admittedly, these are quite subjective, and will never substitute for a human with a critical ear. Yet the desires of 16th Century counterpoint are so well enumerated that these aesthetic formulas yield answers similar, and in the very best cases identical, to those in the textbook. The formulae take into account melodic redundancies, leaps, suspensions, contrary motion, etc. In addition, in the case of fifth species, an analysis of example in the textbook yielded a vague ratio of each note duration value’s appearance, and so a good aesthetic ranking is given to those melodies that have similar note duration distribution.

Through potential improvements to reduce running times in extreme cases, and the addition of a graphical interface, I feel that this program could be a significant tool in teaching counterpoint, and in the study of math, aesthetics, and music. With it, questions such as the following can be pondered: what variables influence the quality of a contrapuntal line? Can the aesthetic style of that era day be so mimicked as to be indistinguishable from a human output? To what degree can the aesthetics of an era be codified, and how has that degree changed over history?

BEAT INTERFERENCE COMPOSITION

This project was my COS325 midterm. The chosen question: can a melody be described as a sum of sine waves? The sine waves starting not at random points in the melody, but all starting at the same time? The crux of the problem was getting a particular frequency to appear when you want it and have it be canceled out the rest of the time. This requires the amplitude of a particular sine wave (with the frequency of the desired tone) to grow and recede predictably.

Early attempts merely stretched the amplitude modulation of the tone to the length of the entire output, and adjusted the phase so that the tone appeared at the right time; this of course, works poorly, as the attack of the note was far too gradual, especially, as the desired clip length grew.

Eventually, I found a better wave to use as the amplitude modulation: I want a spike, and I reasoned that I could create one with a series of odd harmonics (like a plucked string). So I add a bunch of (odd) cosine waves (cos(xt)+cos(3xt)+cos(5xt)...). The more items in the series, the more defined the spike.

An input scheme defining each melody tone’s pitch and rhythmic entrance (i.e. the phase of the amplitude modulation), led to a codified method of defining a melody. The more odd harmonics in the amplitude modulation equation, the more precisely defined the envelope of each note. Overall, the musical effect can range from ambient to emergent from a sea of frequencies.

FREQUENCY MORPHING

Morphing one sound into another in the time domain usually (in my experience) is done merely by cross-fading. By working in the frequency domain, I hoped to implement a more interesting morph in which the spectral qualities of one sound are changed into those of another. Right now, my software (with the use of Perry Cook’s FFT conversion program) implements two heuristics, both of which look at the fft window of the sounds and produce an fft window between the two. The first method looks at all frequencies whose magnitude is above a certain threshold, and for each of them, plots a change towards every occurring frequency in the destination This method is both operation-intensive and aurally less interesting when used on two spectrally rich sounds; it is better for morphing spectrally simple sounds, or for morphing a spectrally simple sound into a complex sound. The second method, which is faster and better for spectrally rich sounds, assigns a set of correlations between the frequency peaks of the files. Both methods use an integral control (adjusting the power of the spectrograms) to make sure that the output volume changes accordingly.

Real-Time Study

I have developed a series of simple MAX/MSP patches for real-time (improvisatory) performance use; I have played my current (and ever-changing) setup at multiple concerts at a local club. With Max, computer keyboard, and a midi controller, I control the looping of various concrete sound banks and put them through various delays and filters, all of whose parameters are under my control. A sample of my recent (but not current) setup is included.

A different patch of my own design was used in the piece 12 Line Ride; in it, vocal samples are morphed into melodic fragments by using a pitch/rhythm tracker, comb filters, and a plucked string algorithm. Yet another recent patch is a virtual implementation of Lucier's I am Sitting in a Room, using reverb and EQ to simulate the impulse response of a fictional room.