Writing Songs with GPT-4: Part 1, Lyrics

Author:Murphy  |  View: 27786  |  Time: 2025-03-23 18:53:21

I have been writing about the various iterations of OpenAI's large language models for the last three years, including using GPT-3 [1] to compose music and ChatGPT [2], a.k.a. GPT-3.5, to write poetry. After experimenting with the latest language model, GPT-4 [3], I found that it can write song Lyrics that tell coherent stories with rhyming words.

In this article, part one in a series of three, I will discuss the background of GPT-4 and compare its ability to write lyrics and music with GPT-3. Next, I'll show how GPT-4 can read lyrics from current bands and compose songs in their style. I'll end with a general discussion on using AI to write music and some next experimentation steps.

In part two of the series, I will explore how GPT-4 can write chords for songs, and in part three, I will use the system to create new melodies to accompany the lyrics.

Introducing GPT-4

On March 14th, I got an email from OpenAI letting me know I had access to their new language model, GPT-4. Here's what they said about their model in their technical report.

We report the development of GPT-4, a large-scale, multimodal model which can accept image and text inputs and produce text outputs. While less capable than humans in many real-world scenarios, GPT-4 exhibits human-level performance on various professional and academic benchmarks, including passing a simulated bar exam with a score around the top 10% of test takers. GPT-4 is a Transformer-based model pre-trained to predict the next token in a document. The post-training alignment process results in improved performance on measures of factuality and adherence to desired behavior. OpenAI, GPT-4 Technical Report [3]

The report also discussed the steps OpenAI made toward improving the safety and alignment of their GPT-4 model to have the system "follow human values and follow human intent." They highlighted their use of over 50 domain experts for adversarial testing, how they built a model-assisted safety pipeline, and how they improved safety metrics over prior models [3].

The new model is not free. OpenAI charges US$20 per month for ChatGPT Plus, which allows access to the new GPT-4 chatbot. When I signed up and logged in, I could see three options for chat models.

A Description of the Three Model Options for ChatGPT, Screenshots from OpenAI

You can see how OpenAI cranked up the "reasoning" and "conciseness" levels for GPT-4.

Note that, by default, OpenAI will retain users' inputs and generated responses "to improve model performance," as spelled out in their data policy doc. This means they can use the data to train their models. I chose to opt out of their data collection by using the form, here.

Comparing the Models for Writing Lyrics

After experimenting with the new GPT-4 system, I found a substantial increase in the quality of responses compared to the original GPT-3 model, especially with rhyming words.

Composing Lyrics with the OG, GPT-3

Here's my attempt at composing a song with the original GPT-3 model. I am using the word "couplet," which means two lines of rhyming lyrics.

RobG: Write lyrics for the first verse of a rock song about dogs and cats that end with rhyming words for each couplet.

GPT-3: Dogs and cats living together Mingling in perfect harmony Running around and playing Until it's time for bed

Curled up side by side In a furry little ball The pets we love the best Are the ones who make our house a home

OK, these lyrics paint a cute little story. However, none of the couplets rhyme, and the meter of the lines doesn't match very well.

Composing Lyrics with the New Model

Here's how the new GPT-4 model responded to the same prompt.

RobG: Write lyrics for the first verse of a rock song about dogs and cats that end with rhyming words for each couplet.

GPT-4: Dogs and cats, they roam the streets Furry friends with hearts that beat Claws and paws, they rule the land Tails a-waggin', they understand

Side by side, they chase the wind Bound together, best of friends They're rockin' in the moonlit night Dogs and cats, they're out of sight

Ah, much better! For the most part, the rhymes are good. The word "wind" rhyming with "friends" is a stretch. But the phrasing is solid, with a similar meter for each line.

Composing Music in the Style of Your Band

To see if GPT-4 could write music in a specified style, I contacted several local bands and asked if I could compose a song using their lyrics as references. They all agreed.

I started by having GPT-4 compose lyrics in the style of Rhode Iceland, an alternative rock band from Lowell, MA, Hi Fi Monk, a hip-hop/funk/reggae outfit based in Boston, MA, and The Agents, a ska band based in Providence, RI.

Analyzing Lyrics

To enable GPT-4 to analyze songs from the three bands, I wrote some code to get a transcription of lyrics from audio files using two open-source projects. I used Whisper, a speech-to-text AI model by OpenAI [4], to transcribe the lyrics. I then ran the transcribed lyrics through GPT-4 to indicate the song parts, i.e., verse, chorus, etc. You can run my code on my Google Colab, here.

Rhode Iceland, Image Used with Permission

Welcome to Rhode Iceland

First, I had GPT-4 analyze Rhode Iceland's song, "Bloody Brain," by passing in the lyrics. Note that the new model can process more text than previous models. GPT-3.5 could only process 4,000 tokens, which is equivalent to 3,125 words. But GPT-4 has two versions. One processes 8,000 tokens, and the other processes 32,000 tokens, equivalent to a whopping 25,000 words. Here's my prompt.

RobG: Analyze the lyrics for the song "Bloody Brain" by the band Rhode Iceland.

[Verse 1] Walkin' down a hidden upstream Towards a bloody gone brain I wanna make nothin' mine I wanna take everything And let it burn I wanna take everything And make it mine Hopin' to lose my good times And it was too late

[Chorus] Walk on Walk on and out Get me out of your head Get me out of your heart Get out of my head Get out of my heart

[Chorus] Walk on and out Get me out of your head Walk on and out Get me out of your heart Walk on Walk on

[Outro] Get me out of your head Get out of my heart Get out of my head Get me out of your heart

GPT-4:"Bloody Brain" by Rhode Iceland appears to be an introspective and emotionally charged song that deals with themes of detachment, control, and the struggle to let go of past relationships.

The lyrics in verse 1 convey a sense of ambivalence, where the speaker desires both to possess and relinquish control over certain aspects of their life. The repeated chorus emphasizes the need to move on and detach from emotional connections that are causing turmoil. The lines "Get me out of your head" and "Get me out of your heart" suggest a plea for both the speaker and the subject to release themselves from the lingering bonds of a past relationship, demonstrating the internal battle between wanting to hold on and the need for freedom. The song's outro reiterates the chorus, driving home the importance of letting go and moving forward.

Overall, "Bloody Brain" portrays the complexity of emotions and the difficulty in relinquishing control in relationships, providing a cathartic release for both the artist and the listener.

That analysis is spot on. If you listen to Bloody Brain, it does seem introspective and emotionally charged. However, It didn't pick up on the shift of perspective in the first chorus, so I asked about it.

RobG: What do you make of these lyrics in the first chorus. Get me out of your head Get me out of your heart Get out of my head Get out of my heart

ChatGPT: In the first chorus of "Bloody Brain," the lyrics seem to convey a sense of emotional entanglement and the desire to break free from it. The lines "Get me out of your head" and "Get me out of your heart" suggest the singer wants to remove themselves from someone else's thoughts and feelings. This may be because their presence is causing pain or complicating the other person's life.

On the other hand, the lines "Get out of my head" and "Get out of my heart" indicate that the singer is also struggling with the thoughts and emotions tied to the other person. They want to release themselves from this mental and emotional attachment to gain clarity, heal, and move on with their life.

That seems clear enough. Changing the pronouns made a big difference in the meaning of the phrases. After GPT-4 provided the analysis of the lyrics, I asked it to create a song in a similar style.

RobG: Write a follow-up song to "Bloody Brain" in the same style.

GPT-4: Title: "Fading Echoes"

[Verse 1] Driftin' through the shadows unseen Chasin' memories like a broken dream Searchin' for solace in the space between Left in a daze I wanna break these chains that bind No longer have to be confined I've tried to heal, but I'm still blind Lost in the maze

[Chorus] Move on Move on and through Set me free from your grasp Set me free from your soul Break free from my grasp Break free from my soul

[Chorus] …

[Bridge] As the echoes slowly die We spread our wings to fly Embracing the unknown A journey we face alone

[Verse 2] Steppin' into a brand new day The ghost of us begins to fray I wanna breathe the air so fine And let it heal I wanna paint a world so bright Where love and pain can reunite I've found the strength to win this fight I'm learning to feel

[Chorus x 2] …

The lyrics seem good. It's a bit bland and has quite a few clichés. But I do like the visuals that were conjured up as abstract vignettes. GPT-4 spelled out all the choruses, but I omitted the repetition. I noticed how the system mostly rhymed every couplet in the new song. The rhymes are solid, but the style diverged from "Bloody Brain," which had very few rhymes. However, I did like the complex AAAB-CCCB rhyming structure in the verses.

Hi Fi Monk, Image Used with Permission

Say Hi to Hi Fi Monk

Hi Fi Monk has a great video showing the recording of their tune, "Break," with a deeply funky groove.

First, I got the transcription from Whisper. Here is a comparison of the original lyrics on the left, and the automatic transcription on the right. The transcription errors are highlighted in yellow.

(left) Lyrics to "Break" Courtesy of Hi Fi Monk, (right) Lyrics Transcribed by Whisper, Image by Author

The transcription was decent, considering there was music playing under the vocals. But it did miss a few key phrases like "brown skin blood."

I asked GPT-4 to analyze the song. I am only showing an excerpted version of the lyrics here, but I sent all 1,000 words into the system for analysis.

RobG: Analyze the lyrics and rhyming style for the song "Break" by Hi Fi Monk.

[Intro] St. John, the fearless, come to break all these chains. But you've got to tell the truth, son. You've got to tell the truth.

_[Chorus]_This the real. This the deal. No more brown skin blood can spill No more Red man land to steal Somehow find a way to heal Break chains. Break through. Break free before they break you. Shit's real. Stay true. Freedom Cry. Take 2.

GPT-4: The lyrics of "Break" by Hi Fi Monk revolve around themes of struggle, oppression, and resilience faced by marginalized communities, particularly African Americans. The lyrics touch on racism, cultural appropriation, police brutality, mass incarceration, and the urge to break free from societal constraints.

The rhyming style in the song can be characterized as a mix of end rhyme and internal rhyme, employing both to create a sense of rhythm and flow. End rhyme refers to the rhyming of the final syllables of lines, while internal rhyme refers to rhymes occurring within a line. The song has an inconsistent rhyme scheme, which contributes to its raw and organic feel.

This is a good analysis of the song. It picked up on the key themes in the lyrics centered on the impact of social injustice. It provided a quick breakdown of the style of rhymes in the song, defining a few terms along the way.

This time, when I prompted GPT-4 to write a new song, I told it expressly to match the rhyming style.

RobG: Write a follow-up song to "Break" in the same style, including the rhyming pattern. Label the song parts.

GPT-4"Battleground Voices"

[Verse 1] Cracked pavement, children play, Beneath the sun, another day, Street's heartbeat, dreams unchained, In the chaos, voices gained.

Broken bottles, tales untold, Stories of the brave and bold, Corner prophets, speaking truth, Against the backdrop of our youth.

[Chorus] Rise up, stand tall No more chains, we'll break 'em all Shatter walls, tear 'em down Our voice will shake this battleground Rise up, stand tall No more chains, we'll break 'em all Shatter walls, tear 'em down Our voice will shake this battleground

[Verse 2] Crumbling walls, graffiti stained, Messages of hope ingrained, Fire escapes, a makeshift stage, For battles fought and disengaged.

Flash of sirens, mothers cry, Tears that fall from tired eyes, In the darkness, a spark ignites, Flickers of hope in starless nights.

[Chorus] …

[Bridge] In the shadows, we find strength Through the cracks, we'll pave the way Hand in hand, we'll rise above United we stand, a force of love

[Verse 3] Streetlights flicker, as the dusk, Gives way to night, a hush, Beats of life, the city's song, In the rhythm, we belong.

Shared laughter, breaking bread, Love and kindness, hearts well-fed, Unified, we face the fight, With open arms, embrace the light.

[Chorus] …

[Outro] In the silence, echoes ring, The tales of hope, that we bring, Side by side, we'll forge our fate, Together, we'll illuminate.

This seems reasonable, too. The song's tone is similar to "Break," with a hard-charging and uplifting chorus. I like the word pictures of city life in the verses and the clever turn of phrase in the bridge, "In the shadows, we find strength. Through the cracks, we'll pave the way."

Most of the couplets have end rhymes, and there are a few internal rhymes, like with "darkness" and "spark" in the lines, "In the darkness, a spark ignites. Flickers of hope in starless nights."

Overall, these lyrics appear to be thought out and well-crafted, but they are a bit basic, without any of the finesse seen in the lyrics for "Break."

The Agents, Image Used with Permission

The Agents: License to Trill

My third and final project was writing a song in the style of the ska band, The Agents. I started by having the system analyze the Agent's song "Grow."

RobG: Analyze the lyrics and chords of the song "Grow" by the ska band The Agents.

[Verse 1] Arm at D, the very first day I met you girl The very first time I held your hand The very first time I looked into your eyes I told you that I loved you

[Verse 2] From that day till ever after The troubling times, the sorrow, the laughter Hand in hand, now we walk together Can't imagine anything better now

[Chorus] Grow, let your love grow, grow Let your love come, rise up, rise up Plant the seed and let your love grow Higher and higher

GPT-4 "Grow" by the ska band The Agents is a love song that reflects on the various stages and moments of a romantic relationship. The lyrics portray the initial feelings of love, the growth of the relationship, and the deepening bond between the two people. The song's overall message is to nurture love and let it grow to its fullest potential.

The lyrics emphasize the importance of love and companionship, as seen in lines like "The very first day I met you girl," "Hand in hand, now we walk together," and "Can't imagine anything better now." The repetition of the phrase "Grow, let your love grow, grow" highlights the song's central theme of growth and development in love.

The system produced an excellent and concise analysis of the song. It picked up the song's central theme as being about the growth of a relationship and pulled out a few key lines in the lyrics to emphasize this.

Unlike the first two experiments described above, this time I gave GPT-4 a new theme and asked it to write five possible song titles with descriptions.

RobG: Create the titles for five songs in this style about overcoming fears. Include a one-sentence description of the meaning of each song.

GPT-4: "Break Through the Shadows" This song is about finding inner strength and courage to step out of one's comfort zone and face the unknown.

"Fearless Heartbeat" A powerful anthem celebrating the resilience of the human spirit, encouraging listeners to embrace their fears and turn them into a driving force for personal growth.

"Rising Above the Storm" This song tells the story of overcoming adversity and challenges, illustrating how facing one's fears can lead to newfound strength and self-discovery.

"Unchained Courage" A motivational tune that highlights the importance of breaking free from the chains of fear and self-doubt, urging individuals to pursue their dreams with relentless determination.

"Dance with the Fear" An upbeat track that encourages listeners to accept and acknowledge their fears, using them as a catalyst for personal growth and transformation.

These were all good, although they read like motivational posters. But overall, I thought that "Dance with the Fear" was the best of the batch. And I know that ska is an excellent style of music for dancing.

As I did in the examples above, I asked GPT-4 to write the lyrics for the new song.

RobG: Write the lyrics for "Dance with the Fear."

GPT-4: [Verse 1] Waking up to a brand new day, Feeling the fear but not turning away, Facing the unknown, that's where we'll start, With an open mind and a fearless heart.

[Pre-Chorus] No more hiding, no more doubts, It's time to let our courage out.

[Chorus] Dance with the fear, don't run away, Embrace the challenge, come what may. Find your rhythm, face the unknown, With every step, your strength has grown.

[Verse 2] In the darkness, we'll find the light, Guided by dreams that take flight. No more trembling, no more fright, Together we'll soar to new heights.

[Pre-Chorus] … [Chorus] …

[Bridge] When fear is knocking at your door, Stand tall, and face it once more. The journey's long, but you'll find, You're stronger than you realized.

[Chorus] …

[Outro] So dance with the fear, let courage lead, Together we'll conquer, together we'll succeed. Take the leap, and you'll see, You'll find your strength, and you'll be free.

Wow, this was very nice! It's a little corny as it's chock full of motivational decrees. And, once again, it rhymed all the couplets, which is fine for the song. I noticed the last couplet in the bridge didn't exactly rhyme.

The journey's long, but you'll find, You're stronger than you realized.

So I asked GPT-4 to see if it could fix it.

RobG: Rewrite the last two lines of the bridge so the words rhyme.

GPT-4: The journey's long, but keep in mind, You're stronger than the fears you'll find.

That was a nice, creative fix. If you don't like something it wrote, give it some constructive feedback; it usually does an excellent job of making positive changes. This aligns with my view of using AI systems as a writing partner.

Summary

I showed how GPT-4 could write new song lyrics, incorporating different rhyming schemes. I showed the technique of engaging the system in a discussion about the style and meaning of existing lyrics before having it write new ones, as a form of preconditioning.

Next Steps

The next steps might include a more rigorous exploration of the strengths and limitations of the system when balancing the dual goals of writing good prose while adhering to a defined rhyming structure. The next steps might also include an examination of the meter by charting syllables and stress patterns in the lyrics. Check out parts two and three of this series to learn how to use GPT-4 to write chords and melodies for songs.

Discussion

Although GPT-4 is better at writing lyrics than earlier language models, it is far from perfect. At best, it's an OK songwriter and a helpful writing partner. However, the trend of AI/ML advances in natural language processing is currently on an exponential trajectory of improvement. What does this mean for songwriters and music fans?

From what I have seen, songwriters and musicians have diverse opinions regarding the use of new technology; some embrace it, some denounce it, but most will eventually use it if it is helpful. I think that this will be true for using AI models. It's like using an online rhyming dictionary to finish off a verse. It might help, or it might not, but the songwriter will try it and make that decision.

And, for the most part, I don't think that the audiences care too much about which tools songwriters and musicians use to create their songs. For example, we know that Auto-Tune is used a lot behind the scenes to fix vocal performances. When used with the normal setting for a decent singer, most people can't tell and probably don't care. It wasn't publicly noticed until Cher cranked it up to the hard-tune mode in "Believe," and T-Pain used it as an explicit effect for his music. I think that the same cycle will play out with language models. As the models improve, most fans won't be able to tell that they are being used, and probably won't care. If the songs are good, they will like them.

Source Code

The source code for this project is available on GitHub.

Creative Commons Attribution Sharealike

Acknowledgments

I want to thank Jon Gryckiewicz from Rhode Iceland, Fez Aswat from Hi Fi Monk, and Pete Fayan from the Agents for their engagement with this project. I also want to thank Jennifer Lim for reviewing the article and providing feedback.

More on Writing Songs with GPT-4

Here are the second and third articles in this series.

Writing Songs with GPT-4: Part 2, Chords

Writing Songs with GPT-4: Part 3, Melodies

References

[1] T. Brown et al., Language Models are Few-Shot Learners (2020) NeurIPS 2020

[2] J. Schulman et al., Introducing ChatGPT (2022)

[3] OpenAI, GPT-4 Technical Report (2023)

[4] A, Radford et al., Robust Speech Recognition via Large-Scale Weak Supervision (2022)

Tags: Artificial Intelligence Gpt 4 Lyrics Machine Learning Songwriting

Comment