ChatGPT (GPT-4) music composition experiments - Eric Cheng

ChatGPT (GPT-4) music composition experiments

Articles

I had a little conversation with ChatGPT (GPT-3.5 and GPT-4) about musical composition, which was interesting. tl;dr Composers don’t have anything to worry about quite yet (I think?). But… I have to imagine that if someone threw a ton of sheet music at the next version of GPT, it could become proficient (and maybe even genius) at composition in every genre (including crazy mashups).

Note that all of the following visualized and playable music was represented in ABC Notation format when communicating with ChatGPT (both prompts and responses). I knew I needed to use some kind of text-based musical notation format, so I asked ChatGPT for some options and chose one (I don’t have access to GPT-4’s multimodal API yet, so had to stick to text).

Can you compose a short Sonatina for piano in the style of Haydn?

Sonatina in C Major

I. Allegro
mm. 1-8: exposition of first theme in C major
mm. 9-16: transition to the dominant key of G major
mm. 17-24: exposition of second theme in G major
mm. 25-32: closing section in G major

II. Andante
mm. 33-40: lyrical theme in A minor
mm. 41-48: contrasting theme in C major
mm. 49-56: development section
mm. 57-64: recapitulation of themes

III. Minuet and Trio
mm. 65-72: minuet in C major
mm. 73-80: trio in G major

IV. Rondo: Allegro
mm. 81-88: main theme in C major
mm. 89-96: first episode in G major
mm. 97-104: second episode in A minor
mm. 105-112: return of main theme
mm. 113-120: coda

I hope you enjoy this short Sonatina in the style of Haydn!

ChatGPT

Next, I grabbed this Haydn Scherzo in ABC Notation format.

Prompt: “Here is an example of a piece in ABC Notation. Analyze it and be ready to create additional pieces in the same style.”

This piece in ABC notation is titled “Scherzo,” which comes from Sonata no. 3 by Austrian composer Franz Joseph Haydn. It has been transcribed by Frank Nordberg, and the original file can be found at http://abc.musicaviva.com. The piece features two voices, one representing the treble and the other representing the bass, both using the piano sound.

The key signature is F major, and the time signature is 2/4, meaning there are two quarter-note beats per measure. The piece uses 1/16 notes as the base note length, which often indicates a faster tempo.

The piece has a playful and lively character, featuring melodic and harmonic patterns that are typical of Haydn’s compositions. The treble voice consists of a mix of stepwise motion and leaps, with repeating motifs like “fcfc afaf.” The bass voice provides harmonic support, often with repeated chord progressions such as “[F4A4]z4|[F2A2][F2A2][F2A2][F2A2]” and “[C2G2][C2G2][C2G2][C2G2].”

Here’s a short piece in the same style:

ChatGPT

This short piece follows a similar structure, with playful, repeating motifs in the treble voice and a supportive bass line. The time and key signatures, as well as the base note length, are the same as in the original piece.

ChatGPT

Prompt: “Can you mash up the piece with something in the style of Led Zeppelin?”

Combining the styles of Franz Joseph Haydn and Led Zeppelin is quite a challenge, but here’s an attempt at merging the classical elements of Haydn with the rock elements of Led Zeppelin:

ChatGPT

In this piece, titled “Haydn Meets Zeppelin,” I maintained Haydn’s original key signature (F major) and changed the time signature to 4/4 to incorporate the rock elements of Led Zeppelin. The base note length is now 1/8, which is more common in rock music.

I kept some of the original Haydn motifs in the treble voice and added elements of Led Zeppelin’s style by introducing power chords in the bass voice. The piece alternates between the classical and rock sections, creating a unique and interesting fusion of styles.

Please note that the actual sound and feel of the piece would be quite different when performed by a rock band with electric guitars, bass, and drums, as opposed to being played on a piano. The piece is provided in ABC notation and might need further arrangement and instrumentation to fully capture the essence of Led Zeppelin’s style.

ChatGPT

Prompt: what about something completely in the style of led zeppelin arranged for string quartet?

Creating a piece in the style of Led Zeppelin arranged for a string quartet is an interesting challenge. Here’s an attempt at capturing the essence of Led Zeppelin’s style while utilizing the instrumentation of a string quartet:

ChatGPT

In this piece, titled “Zeppelin’s Quartet,” I maintained the time signature of 4/4, as it is common in both Led Zeppelin’s music and many classical pieces. The piece is in the key of E major, which is a key often

ChatGPT

Prompt: Here is an example of a song in ABC Notation. Analyze it and be ready to make variations or other music in the same style.

I then fed it this Chopin Nocturne (linked because it’s too long to fully represent here). Here’s a fragment, for you music readers.

This song in ABC Notation is an arrangement of Frédéric Chopin’s 3me. Nocturne, Op. 15. It is in the key of Bb and has a time signature of 3/4. The piece is a duet with two voices: the first voice is written in the treble clef and the second in the bass clef. The tempo marking is set at 60 BPM for the dotted half note.

The piece has a melancholic and expressive character, which is typical of Chopin’s nocturnes. The melody is carried by the first voice, while the second voice provides harmonic support and counterpoint. The melody features several ornaments and grace notes, as well as several dynamic markings such as accents, which contribute to the expressive nature of the piece.

To create variations or other music in the same style, you can use the following techniques:

Change the key: Transpose the piece to a different key while maintaining the same melodic and harmonic structure.
Modify the melody: Create variations by altering the original melody, incorporating new rhythms, or introducing new melodic motifs.

Rearrange the accompaniment: Change the harmonic structure or rhythmic patterns in the bass clef to create a new accompaniment for the melody.

Change the time signature: Rewrite the piece in a different time signature, such as 4/4 or 6/8, and adjust the rhythms accordingly.

Add ornaments: Include additional ornaments, such as trills, mordents, or grace notes, to enhance the expressiveness of the melody.

Modify the dynamics and articulations: Experiment with different dynamics and articulations, such as crescendos, decrescendos, staccatos, and legatos, to create different moods and textures.

Create a new introduction, interlude, or coda: Compose a new section for the piece, such as an introduction, interlude, or coda, to add contrast or build on the original material.

ChatGPT

Do you know the song, Mary Had A Little Lamb? If so, output in ABC Notation.

Yes, I know the song “Mary Had A Little Lamb”. Here it is in ABC Notation:

ChatGPT

This simple representation is in the key of C major and uses a 4/4 time signature. Each measure is separated by a “|”, and the melody consists of quarter notes.

ChatGPT

Are you sure that is right? Can you play it to yourself and verify?

Apologies for the confusion earlier. Upon further reflection, I realize that my previous response contained errors. Here’s the corrected ABC notation for “Mary Had A Little Lamb”:

ChatGPT

Please note that the “z” denotes a quarter-note rest in the melody.

ChatGPT

ok, now give me Mary Had a Little Lamb in the style of the piece by Chopin I gave you earlier.

Creating a “Mary Had A Little Lamb” arrangement in the style of Chopin’s Nocturne in E-flat Major, Op. 9, No. 2 is quite an interesting challenge. Here’s a simple adaptation of the melody with some elements that resemble the Chopin piece:

ChatGPT

This arrangement adds some elements of Chopin’s style, such as the arpeggiated chords and harmonic progressions. However, it’s important to note that it’s a simplified version, and a more intricate arrangement would require a deeper understanding of Chopin’s techniques and compositional style.

ChatGPT

Can you play it to yourself and analyze whether or not it follows the melody of Mary Had a Little Lamb? If not, please try again.

Apologies for the confusion earlier. I understand now that you are looking for an adaptation of “Mary Had a Little Lamb” in the style of Chopin’s Nocturne. As an AI, I’m unable to play the music myself, but I can provide a revised arrangement that follows the melody more closely while incorporating elements of Chopin’s style. Here’s an attempt at creating an arrangement in that style:

ChatGPT

This arrangement uses the melody of “Mary Had a Little Lamb” while incorporating some harmonic elements and progressions from Chopin’s Nocturne in E-flat Major, Op. 9, No. 2. However, it’s important to note that it’s a simplified version, and a more complex arrangement would require a deeper understanding of Chopin’s techniques and compositional style.

ChatGPT

A fitting, bizarre end to this little experiment!