# Using Chat gpt AI Tool to generate music

**URL:** <https://in-thread.sonic-pi.net/t/using-chat-gpt-ai-tool-to-generate-music/7489>\
**Category:** Creations & Ideas\
**Created:** [January 25, 2023, 12:01am UTC](https://in-thread.sonic-pi.net/t/using-chat-gpt-ai-tool-to-generate-music/7489 "2023-01-25T00:01:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![squiqui](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@squiqui](https://in-thread.sonic-pi.net/u/squiqui)\
**Post date:** [January 25, 2023, 12:01am UTC](https://in-thread.sonic-pi.net/t/using-chat-gpt-ai-tool-to-generate-music/7489/1 "2023-01-25T00:01:08Z")

</div>

I just tried to ask chat gpt to create a song for sonic pi as a professional programmer and musician and got after changing my questions this result.  
It is a running code and it is not too bad. Whats your opinion about this?

# Welcome to Sonic Pi

use\_bpm 120

# Drums

live\_loop :drums do  
sample :drum\_heavy\_kick  
sleep 0.5  
sample :drum\_snare\_hard  
sleep 0.5  
sample :drum\_heavy\_Kick  
sleep 0.5  
sample :drum\_snare\_hard  
sleep 0.5  
end

# Bass

live\_loop :bass do  
use\_synth :tb303  
play :c2, release: 0.1, cutoff: rrand(70, 130)  
sleep 0.5  
play :g1, release: 0.1, cutoff: rrand(70, 130)  
sleep 0.5  
end

# Chords

live\_loop :chords do  
use\_synth :piano  
play\_chord [:c4, :e4, :g4], release: 2  
sleep 2  
play\_chord [:e4, :g4, :b4], release: 2  
sleep 2  
end

# Lead melody

live\_loop :melody do  
use\_synth :blade  
play :c5, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :e5, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :g5, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :b5, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
end

# Structure

in\_thread do  
4.times do  
sync :drums  
cue :bass  
cue :chords  
cue :melody  
sleep 8  
end  
sync :drums  
stop  
end

# Effects

live\_loop :reverb do  
use\_synth :piano  
play :c4, release: 2, cutoff: rrand(70, 130), reverb: 0.8  
sleep 2  
end

# Drop

define :drop do  
with\_fx :reverb, room: 0.8 do  
with\_fx :distortion, distort: 0.8 do  
sample :drum\_heavy\_kick  
sleep 0.5  
sample :drum\_snare\_hard  
sleep 0.5  
end  
end  
end

# Refrain

define :refrain do  
with\_fx :reverb, room: 0.8 do  
use\_synth :piano  
play\_chord [:c4, :e4, :g4], release: 2  
sleep 2  
play\_chord [:e4, :g4, :b4], release: 2  
sleep 2  
end  
end

# additional instruments

live\_loop :strings do  
use\_synth :chipbass  
play :e4, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :g4, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :b4, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :d5, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
end

live\_loop :guitar do  
use\_synth :pluck  
play :e3, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :g3, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :b3, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :d4, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
end

live\_loop :vocals do  
use\_synth :saw  
play :c3, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :e3, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :g3, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
play :b3, release: 2, cutoff: rrand(70, 130)  
sleep 0.5  
end

# Drops and refrains

in\_thread do  
sync :drums  
drop  
sleep 8  
refrain  
sleep 8  
drop  
sleep 8  
refrain  
sleep 8  
stop  
end

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [January 25, 2023, 2:11pm UTC](https://in-thread.sonic-pi.net/t/using-chat-gpt-ai-tool-to-generate-music/7489/2 "2023-01-25T14:11:00Z")

</div>

Welcome to in thread. I copied your code and gave it a play. Sounds not bad. By the way, it would be helpful if in future you could paste code between two sets of ``` characters one on the line before the other the line after the code. This makes it much easier to copy and paste the code straight into Sonic Pi.

In the case of the code you supplied it was fairly straight forward to extract, and I just had to comment out the bold headings such as Drums, Chords, Lead melody etc

It would be interesting to get more detail on the actual interaction you had with the robot. What questions did you actually ask? Unfortunately it is oversubscribed at present, but I would like to have a go later.

---

<div class="post-metadata">

**Author:** ![simonepXb](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@simonepXb](https://in-thread.sonic-pi.net/u/simonepXb)\
**Post date:** [March 5, 2023, 4:03am UTC](https://in-thread.sonic-pi.net/t/using-chat-gpt-ai-tool-to-generate-music/7489/4 "2023-03-05T04:03:36Z")

</div>

ccol! i will test this out later. I am doing the same thing. I will share my github link once I post the code i received from chatGPT

---

<div class="post-metadata">

**Author:** ![simonepXb](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@simonepXb](https://in-thread.sonic-pi.net/u/simonepXb)\
**Post date:** [March 5, 2023, 3:55pm UTC](https://in-thread.sonic-pi.net/t/using-chat-gpt-ai-tool-to-generate-music/7489/5 "2023-03-05T15:55:18Z")

</div>

i am new to sonic pi but not python. Before diving into learning I posed the question to chatGPT to see results. My findings are here: [GitHub - panchaX3000/sonic\_pi\_beatz: experimenting with Sonic Pi to create music through Live Code](https://github.com/panchaX3000/sonic_pi_beatz)

as i learn sonic py i will update 🙂
