DEV Community

Cover image for Crafting Songs with ChatGPT and Sonic Pi: A Creative Collaboration

Crafting Songs with ChatGPT and Sonic Pi: A Creative Collaboration

Philip John Basile on May 03, 2023

Music is a universal language that has the power to evoke emotions, communicate stories, and connect people. With advances in artificial intelligen...
Collapse
 
michaeltharrington profile image
Michael Tharrington

Wow, it's absolutely wild that you can use AI to write lyrics, compose the music, structure the song, and even play/sing the tune for ya when you're done. I'm gonna have to experiment with this later!

As you become more comfortable with both tools, you can even incorporate live coding techniques to improvise and perform your songs in real-time.

That's a seriously cool idea! I can imagine a DJ set being run like this.

Really appreciate you writing this post up and walking us through Sonic Pi. This has been super interesting!

Collapse
 
philipjohnbasile profile image
Philip John Basile

It's pretty cool Sam Aaron does live performances too!!

Live Sonic Pi Performance

Collapse
 
michaeltharrington profile image
Michael Tharrington

So dope!! Really cool tune, I feel like I'm floating through space... as a lover of funky synthesizer sounds, this is def tickling that itch.

The visualizer is really cool too. Not sure if that's built into SonicPi or not, but it fits well!

Collapse
 
highcenburg profile image
Vicente G. Reyes • Edited

This is super wild!!!! I tried this with both bing and chatGPT and chatGPT wins. Normally I'd use the one from bing but this time, I liked what chatGPT responded with and with how the answer was presented

Collapse
 
philipjohnbasile profile image
Philip John Basile

Try it with google Bard too. So far Bard has been terrible.

Collapse
 
highcenburg profile image
Vicente G. Reyes

Just joined the waitlist! Can't wait!! Thanks for the suggestion

Collapse
 
sebelga profile image
Sébastien Loix

The future is looking more sad every day with this AI and computers trying to replace art. The other day I went to see a concert of 4 musicians (actual musicians, you know, those who know the notes of a scale of Eb and its chords) and that was awesome.

Who knows, maybe in 50 years it won't be possible to feel that live energy coming from 4 human souls anymore.

Everything AI, everything the same, everything soulless.

Collapse
 
philipjohnbasile profile image
Philip John Basile

AI is created from known human creations. Nothing willl replace the soul of human design.

Collapse
 
valeriavg profile image
Valeria

Precisely what I needed! Thank you for this post! I’ve been planning on arranging my songs for a while now and couldn’t sit down and learn how to do so in Garage Band, but I completely forgot about Sonic Pi! Makes so much sense to incorporate my two passions together!

I’m not sure I’m entirely fine with using AI generated lyrics as is, but it can definitely be a source of great inspiration!

Just like this article :)

P.S. Do you have the final version of the song available somewhere? I’d love to listen!

Collapse
 
philipjohnbasile profile image
Philip John Basile

I dont but if you copy the code above into sonic pi you can listen to it live! Feel free to tinker with it. It's freeeeeee.

Collapse
 
emmaly profile image
Emmaly

I asked GPT-4 via the Playground to help me make a Majestic Wakeup Routine and it gave me this: gist.github.com/emmaly/24947176d2c...

While I would say it's neat, it's not majestic. But I guess it would suitably wake someone up. Using the kalimba would probably be better for putting someone to sleep, though. 😜

use_bpm 60
use_synth :kalimba

define :calm_section do
  play_pattern_timed [:c4, :e4, :g4, :c5], [0.5, 0.5, 0.5, 1]
  play_pattern_timed [:c4, :e4, :g4, :b4], [0.5, 0.5, 0.5, 1]
  play_pattern_timed [:c4, :d4, :g4, :a4], [0.5, 0.5, 0.5, 1]
  play_pattern_timed [:c4, :d4, :g4, :g4], [0.5, 0.5, 0.5, 1]
end

define :majestic_section do
  play_pattern_timed [:c4, :e4, :g4, :c5], [0.25, 0.25, 0.25, 0.5]
  play_pattern_timed [:c4, :e4, :g4, :b4], [0.25, 0.25, 0.25, 0.5]
  play_pattern_timed [:c4, :d4, :g4, :a4], [0.25, 0.25, 0.25, 0.5]
  play_pattern_timed [:c4, :d4, :g4, :g4], [0.25, 0.25, 0.25, 0.5]
end

define :motivating_section do
  play_pattern_timed [:c4, :e4, :g4, :c5], [0.125, 0.125, 0.125, 0.25]
  play_pattern_timed [:c4, :e4, :g4, :b4], [0.125, 0.125, 0.125, 0.25]
  play_pattern_timed [:c4, :d4, :g4, :a4], [0.125, 0.125, 0.125, 0.25]
  play_pattern_timed [:c4, :d4, :g4, :g4], [0.125, 0.125, 0.125, 0.25]
end

# Wakeup Routine
live_loop :thing do
  2.times do
    calm_section
  end

  3.times do
    majestic_section
  end

  6.times do
    motivating_section
  end

  2.times do
    majestic_section
  end

  1.times do
    motivating_section
  end

  1.times do
    majestic_section
  end

  1.times do
    calm_section
  end

  1.times do
    majestic_section
  end

  1.times do
    motivating_section
  end

  1.times do
    majestic_section
  end
end
Enter fullscreen mode Exit fullscreen mode
Collapse
 
philipjohnbasile profile image
Philip John Basile

But you made music! That's what counts. I wouldn't call the music maker majestic either. It's def more chip tune'y.

Collapse
 
alex_escalante profile image
Alex Escalante

Thank you for letting me know about Sonic Pi!