Schlagwort-Archiv Spectral Audio

VonBrandon Snyder

Machine Learning Clustering in ‚residual – i‘ for Prepared Piano

Introduction

I present in this article residual – i, a three-minute solo piece for prepared piano commissioned as a companion work to John Cage’s Sonatas and Interludes for prepared piano. In analyzing Cage’s work and subsequently composing a companion to it, I employed a self-designed texture synthesis tool driven by machine learning clustering. The technical overview of that tool can be read at this other blogpost, or in the proceedings of the 2022 International Conference on Technologies for Music Notation and Representation (TENOR 2022). The blogpost you are reading now will briefly explain how that tool (and generally, music informatics) was applied in composing this short piano piece.

Background

John Cage’s Sonatas and Interludes (1946-48) is a 60-minute work for solo prepared piano that involves placing various objects (metal screws, bolts, nuts, pieces of plastic, rubber and eraser) in the strings of the piano. These objects ‚prepare‘ the piano, altering its sound and bringing out a variety of different, heterogenous timbres. Some keys produce chords, others buzz, or even have the pitch completely removed. The sound profile of the Sonatas and Interludes are arguably the work’s most iconic aspect.

However, the form of the Sonatas and Interludes is also noteworthy. The work consists of sixteen sonatas and four interludes, with most movements lasting somewhere between 1 and 4 minutes each. As part of an ongoing commissioning project, pianist and composer Amy Williams premieres new ‚interludes‘ which are placed amidst the existing sonatas and interludes by Cage. In early 2022 I received the opportunity to compose a short piece that would use a piano with Cage’s „preparations“, and would be inserted as an interlude amidst the sonatas and interludes of Cage’s work.

Approach

I was interested in composing a piece that acknowledged both the sound- and time-identity of the Sonatas and Interludes. While arguably the most iconic aspect of Cage’s Sonatas and Interludes is its sounds, I feel that the work’s form, it’s time-based content, is equally impactful. Many of the its movements are cast in AABB form, reflecting classical period sonatas. Additionally, the distribution of the individual sonatas and interludes take a symmetrical form: four groups of four sonatas each, partitioned by the four interludes:

Sonatas I–IV    Interlude 1    Sonatas V–VIII    Interludes 2–3    Sonatas IX–XII    Interlude 4    Sonatas XIII–XVI

As a pre-compositional constraint, I decided that all sonorities in my piece would be taken/excerpted directly from the score of the Cage. To use the metaphor of a painter, the score of the Cage was my palette of colors, and not the prepared piano itself. This meant that not only every chord or single note in my piece would be excerpted from the Cage, it also meant that the chord or note’s particular duration would also be used in my piece. The sound and duration were joined as a single item. In a way, my piece was a form of granular synthesis, taking single-attack grains of the Sonatas and Interludes, and recontextualizing them in a new order.

Preprocessing

In order to observe and meaningfully comprehend all the individual sonorities in the 60-minute-long Cage, I used a simple machine learning clustering method to categorize all ~7k sonorities into 12 groups. Using my texture synthesis tool, I was not only able to organize audio features of these ~7k sonorities in a a visual editor, I was also able to export and listen to each individual sonority as a single, short audio file.

Figure 1: Clusters and audio features are visually represented and sorted, providing an out-of-time view of the Cage’s spectral content.

Once the sonorities have been extracted as individual transients, I used a k-means clustering method to sort these sonorities into 12 clusters. To briefly explain this machine learning method, the clustering algorithm receives a vector of several audio features as an input representing a sonority from the Cage (the audio features used were spectral centroid, spectral difference, and spectral covariance*). The algorithm then sorts these audio vectors into 12 groups, placing sounds with similar vector-values in the same group. This process in unsupervised, meaning it is not seeking to emulate a trained result that I predetermined. Rather, because these three audio features, as a trio, don’t represent any particularly given parameter in music, the algorithm returns clusters of sound that are correlated along multifaceted sound profiles that are aurally cohesive but not as simple as being sorted by a single parameter like pitch, duration, brightness, or noisiness.

Composition

My piece residual – i uses sonorities exclusively from clusters 2, 4, 9, 11. Referring back to the class-array figure, there is a clear line of differentiation between these clusters and the rest, correlated specifically to the spectral difference of the sonorities. These sonorities had an unusually high spectral difference, due either to their bright harmonic content (which creates a sharp delta between the attack and sustain of the transient) or their short duration (which creates a sharp delta between the attack and sustain/resonance of the transient). By placing each of these clusters in sequence, and the sounds within each cluster in sequence, this quality of shortness and brightness is clearly audible (see audio).

I treated this sequence as a kind of DNA for the piece. Large portions of it were copied into the score (sequences of around 20-30 transients. This process was done by hand, listening to each individual transient in the sequence, and looking up in the score of the Cage what the corresponding notes were). It was at this point that the machine learning methods involved in the piece are finished. From here, I began to sculpt and shape these longer sequences into shorter bursts. I also added repeat brackets at different moments, creating moments of ‚freeze‘ in the piece’s hurtling forward momentum.

Figure 3a: Loop A designates the first several (circa 20) sonorities in the cluster sequence, looped over and over. This sequence served as a scaffolding from which the piece was composed around.

Figure 3b: This is the same page of the score, after notes have been removed, transforming the work into short bursts of sound.

Conclusion

Many of the cutting edge applications of machine learning in audio are towards the improvement of automated transcription, neural audio synthesis, and other tasks which have a clear goal and benchmark to test against. My particular application of machine learning in this piece is not for optimizing any task like this. Rather, the act of clustering audio served more as a means to explore the Sonatas and Interludes from a vantage point that I had not yet seen them from. Similar to my previous works that involve machine learning, being aware of how the machine learning methods are implemented is an essential first step in mindfully composing a work using such methods. As suggested by the title, residual – i serves as a proof of concept for a possible larger set of companion pieces, in which machine learning methods are used as a means to critically reexamine and „re-hear“ a familiar piece of music.

Listen to a full performance of residual – i here.

*These three features are measurements typically used to categorize the timbre and spectral content of an audio signal. The spectral centroid represents the center of mass in a spectrum. The spectral difference represents the average delta in energy between adjacent windows of the spectrum. The spectral covariance represents the spectral variability of a signal, i.e. how much the signal varies between its frequency bins.

VonAnselm Weber

Spectral Select: Eine akusmatische 3D-Audio Studie

Abstract:
Spectral Select erkundet den spektralen Inhalt des einen, sowie den Amplitudenverlauf eines zweiten Samples und vereinigt diese in einem neuen musikalischen Kontext. Der durch Iteration entstehende meditative Charakter des Outputs wird durch lautere Amplituden-Peaks sowohl kontrastiert, als auch strukturiert.
In einer überarbeiteten Version wurde Spectral Select im Ambisonics HOA-5 Format spatialisiert.

Betreuer: Prof. Dr. Marlon Schumacher

Eine Studie von: Anselm Weber

Wintersemester 2021/22
Hochschule für Musik, Karlsruhe


Zur Studie:
In welchen Ausdrucksformen äußert sich die Verbindung zwischen Frequenz und Amplitude ? Sind beide Bereiche intrinsisch miteinander Verbunden und wenn ja, was könnten Ansätze sein, diese Ordnung neu zu gestalten ?
Derartige Fragen beschäftigen mich bereits seid einiger Zeit. Daher ist der Versuch ebendieser Neugestaltung Kernthema bei Spectral Select.
Inspiriert wurde ich dazu von AudioSculpt von IRCAM, welches wir in unserem Kurs: „Symbolische Klangverarbeitung und Analyse/Synthese“ gemeinsam mit Prof. Dr. Marlon Schumacher und Brandon L. Snyder kennenlernten und zum Teil nachbauten.

Spectral Edit funktioniert nach einem ähnlichen Prinzip, doch anstatt interessante Bereiche innerhalb eines Spektrums eines Samples von einem Benutzer herausarbeiten zu lassen, wurde entschieden, ein zweites Audiosample heranzuziehen. Dieses weitere Sample (im Verlauf dieses Artikels ab sofort als „Amplitudenklang“) bestimmt durch seinen Verlauf, wie das erste Sample (ab sofort als „Spektralklang“) durch OM-Sox verarbeitet werden soll.
Um dies zu erreichen wird mit zwei Loops gearbeitet:
Zunächst werden im ersteren „peakloop“ einzelne Amplitudenpeaks aus dem Amplitudenklang herausanalysiert. Daraufhin dient diese Analyse im Herzstück des Patches, dem „choosefreq“ Loop zur Auswahl interessanter Teilbereiche aus dem Spektralsample. Lautstarke Peaks filtern hierbei schmalere Bänder aus höheren Frequenzbereichen und bilden einen Kontrast zu schwächeren Peaks, welche etwas breiter Bänder aus tieferen Frequenzbereichen filtern.

peakloop – Analyse
choosefreq Loop – Audio Processing


Wie klein die jeweiligen Iterationsschritte sind, wirkt sich dabei sowohl auf die Länge, als auch auf die Auflösung des gesamten Outputs aus. So können je nach Sample-Material sehr viele kurze Grains oder weniger, aber dafür längere Teilabschnitte erstellt werden. Beide dieser Parameter sind jedoch frei und unabhängig voneinander wählbar.

Im beigefügten Stück wurde sich beispielsweise für eine relativ hohe Auflösung (also eine erhöhte Anzahl an Iterationsschritten) in Kombination mit längerer Dauer des ausgeschnittenem Samples entschieden. Dadurch entsteht ein eher meditativer Charakter, wobei kein Teilabschnitt zu 100% dem anderen gleichen wird, da es ständig minimale Veränderungen unter den Peak-Amplituden des Amplitudenklangs gibt.
Das noch relativ rohe Ergebnis dieses Algorithmus ist die erste Version meiner akusmatischen Studie.

Akusmatische Studie Version 1


Der darauffolgende Überarbeitungsschritt galt vor allem einer präziseren Herausarbeitung der Unterschiede zwischen den einzelnen Iterationsschritten. Dazu wurde eine Reihe an Effekten eingesetzt, welche sich wiederum je nach Peak-Amplitude des Amplitudenklangs unterschiedlich verhalten. Um dies zu ermöglichen, wurde die Effektreihe direkt in den Peakloop integriert.

Akusmatische Studie Version 2


Im dritten und letztem Überarbeitungsschritt erfolgte die Spatialisierung des Audios auf 8 Kanäle.
Hierbei klingen die einzelnen Kanäle ineinander und ändern ihre Position im Uhrzeigersinn. Somit bleibt der Grundcharakter des Stückes bestehen, jedoch ist es nun zusätzlich möglich, das „Durcharbeiten“ des choosefreq Loops räumlich zu verfolgen. Damit diese Räumlichkeit erhalten bleibt, wurde der Output anschließend mithilfe von Binauralix für den Upload in binaural Stereo umgewandelt.

Akusmatische Studie Version 3 – Binaural

Spectral Select – Ambisonics

Im Zuge einer weiteren Überarbeitung wurde Spectral Select über die spatialisation class „Hoa-Trajectory“ von OM-Prisma neu spatialisiert und in das Ambisonics Format gebracht.
Damit sich dieser Schritt konzeptionell und klanglich gut in die bisherigen Bearbeitungen eingliedert, soll der Amplitudenklang auch bei der Raumposition eine wichtige Rolle spielen.
Die Möglichkeiten mithilfe von Open-Music und OM-Prisma Klänge zu spatialisieren sind zahlreich. Letzten Endes wurde entschieden, mit Hoa-Trajectory zu arbeiten. Hierbei ist die Klangquelle nicht an eine feste Position im Raum gebunden und kann mit einer Trajektorie beschrieben werden, welche auf die Gesamtdauer des Audio-Inputs skaliert wird.

Spatialisierung mit HOA.TRAEJECTORY

Die Trajektorie wird in Abhängigkeit der Amplituden-Analyse im vorhergehenden Schritt erstellt.
Dabei wird eine simple, dreidimensionale Kreis Bewegung, welche sich in Spiralbewegung nach unten dreht, mit einer komplexeren, zweidimensionalen Kurve perturbiert. Die Y-Werte der komplexeren Kurve entsprechen dabei den herausanalysierten Amplitudenwerten des Amplitudenklanges.
Somit ergeben sich je nach skalierung der Amplitudenkurve mehr oder weniger starke Abweichungen der Kreisbewegung. Höhere Amplitudenwerte sorgen also für ausuferndere Bewegungen im Raum.


Interessant hierbei ist, dass OM-Prisma auch Doppler-Effekte mitberücksichtigt. Dadurch ist zusätzlich hörbar, dass bei höheren Amplitudenwerten extremere Abstände zur Hörposition in der selben Zeit zurückgelegt werden. Dadurch nimmt dieser Arbeitsschritt unmittelbar Einfluss auf die Klangfarbe des gesamten Stückes.
Je nach Skalierung der Trajektorie können schnelle Bewegungen dadurch stark überbetont werden, allerdings können (ab einer zu großen Entfernung) auch Artfakten entstehen.
Damit ein besserer Eindruck Ensteht folgen 2 verschiedene durchläufe des Algorithmus mit unterschiedlichen Abständen zum Hörer.

Version mit extremen Doppler Effekten wodurch Artfakte enstehen können – Binaural Stereo

Version mit näherem Abstand und moderateren Doppler Effekten – Binaural Stereo

Spektralklang sowie Amplitudenklang wurden in diesem Beispiel im Gegensatz zu den vorherigen Klangbeispielen ausgetauscht. Es handelt sich hierbei um ein längeres Soundfile zur Analyse der Amplituden und einen weniger verzerrten Drone als Spektralklang.
Die Idee hinter diesem Projekt ist ohnehin, mit verschiedenen Klangdateien zu experimentieren.
Daher wurde auch der alter Algorithmus noch einmal überarbeitet um mehr Flexibilität bei unterschiedlichen Klangdateien zu bieten:

Überarbeitete skalierbare Version des alten Algorthimus zur Auswahl aus dem Spektralklang

Außerdem wird nun aus dem Spektralklang auf der Zeitachse randomisiert ausgewählt. Dadurch soll jeglicher formgebender Zusammenhang aus der Magnitude des Amplitudenklangs stammen und jegliche Klangfarbe aus dem Spektralklang extrahiert werden.