I ckecked out the chatbot at
https://chat.openai.com/chat
Asked it to do some coding examples in Sonic Pi.
This is the result for generative music:
use_bpm 120
Set the root note of the scale
root = :c4
Choose a random scale mode
mode = [:ionian, :dorian, :phrygian, :lydian, :mixolydian, :aeolian, :locrian].choose
Generate a scale using the root note and mode
music_scale = scale(root, mode)
Set the number of notes to play
num_notes = 32
Choose a random synth
synth = [:sine, :square, :tri, :saw].choose
Set the release time for the notes
release = 0.5
Set the cutoff frequency for the synth
cutoff = rrand(60, 120)
Set the sleep time between notes
sleep_time = 0.125
Set the number of times to loop
num_loops = 4
Play the music indefinitely
loop do
num_loops.times do
# Play the notes of the scale
num_notes.times do
use_synth synth
play music_scale.choose, release: release, cutoff: cutoff
sleep sleep_time
end# Choose new options for the next loop root = music_scale.choose mode = [:ionian, :dorian, :phrygian, :lydian, :mixolydian, :aeolian, :locrian].choose music_scale = scale(root, mode) synth = [:sine, :square, :tri, :saw].choose release = rrand(0.1, 1) cutoff = rrand(60, 120) sleep_time = rrand(0.1, 0.5)
end
end
I also tried to get it to code a fugue. After some nudging, this is what it came up with:
G Major Scale
g_major_scale = [:g3, :a3, :b3, :c4, :d4, :e4, :fis4]
Subject
subject = [:g3, :g3, :g3, :b3, :d4]
Voice 1
in_thread do
use_synth :saw
play_pattern_timed subject, [0.5, 0.5, 0.5, 1, 1]
sleep 1
play_pattern_timed subject, [0.5, 0.5, 0.5, 1, 1]
endVoice 2
sleep 0.5
in_thread do
use_synth :square
play_pattern_timed subject, [0.5, 0.5, 0.5, 1, 1]
sleep 1
play_pattern_timed subject, [0.5, 0.5, 0.5, 1, 1]
endVoice 3
sleep 1
in_thread do
use_synth :tri
transposed_subject = subject.map { |note| g_major_scale[(g_major_scale.index(note) + 7) % 7] }
play_pattern_timed transposed_subject, [0.5, 0.5, 0.5, 1, 1]
sleep 1
play_pattern_timed transposed_subject, [0.5, 0.5, 0.5, 1, 1]
endVoice 4
sleep 1.5
in_thread do
use_synth :saw
transposed_subject = subject.map { |note| g_major_scale[(g_major_scale.index(note) + 12) % 7] }
play_pattern_timed transposed_subject, [0.5, 0.5, 0.5, 1, 1]
sleep 1
play_pattern_timed transposed_subject, [0.5, 0.5, 0.5, 1, 1]
end
Both examples are not impressive in itself, but I suppose in not much time we will be directing a bot to code stuff for us?
Has anyone else tried this?