## Saturday, August 19, 2023

### Rick and Morty theme on Sonic Pi.

I first started with a MIDI and converted that to something I could feed in to chatGPT, XML to the resuce.

### Attempt 1

# Setting the BPM use_bpm 86 # Define the notes notes1 = [:Bb4, :Db5, :C5, :Eb5, :Ab4, :Gb4] durations1 = [0.75, 0.25, 0.25, 0.25, 0.25, 0.25] # duration in beats for measure 1 notes2 = [:F4] durations2 = [4] # duration in beats for measure 2 (tied to next measure) notes3 = [:Bb4, :Db5, :C5, :Eb5, :Ab5, :Gb5] durations3 = [0.75, 0.25, 0.25, 0.25, 0.25, 0.25] # duration in beats for measure 4 notes4 = [:F5, :Bb4] durations4 = [2, 2] # duration in beats for measure 5 notes5 = [:Bb4, :C5, :C5, :Db5] durations5 = [0.5, 2, 0.25, 0.25] # duration in beats for measure 6 notes6 = [:C5, :Eb5, :Ab5, :Gb5, :F5] durations6 = [0.25, 0.25, 0.25, 0.25, 2] # duration in beats for measure 7 # Play the notes notes1.zip(durations1).each do |note, duration| play note, sustain: duration sleep duration end play notes2[0], sustain: 8 # Considering the tie across measures sleep 8 notes3.zip(durations3).each do |note, duration| play note, sustain: duration sleep duration end notes4.zip(durations4).each do |note, duration| play note, sustain: duration sleep duration end notes5.zip(durations5).each do |note, duration| play note, sustain: duration sleep duration end notes6.zip(durations6).each do |note, duration| play note, sustain: duration sleep duration end

### Attempt 2

# Set up BPM use_bpm 86 # Set up Synth (Mallets, since the MuseScore instrument was a Mallet Synthesizer) use_synth :fm # Function for dynamics def dynamic_value(d) return d.to_f / 127.0 end # Play the melody play_pattern_timed [:Bb4, :Db5, :C5, :Eb5, :Ab4, :Gb4], [1.5, 0.5, 0.5, 0.5, 0.5, 0.5], amp: dynamic_value(105.56) play :F4, sustain: 4, amp: dynamic_value(105.56) sleep 4 play :F4, sustain: 4, amp: dynamic_value(105.56) sleep 4 play_pattern_timed [:Bb4, :Db5, :C5, :Eb5, :Ab5, :Gb5], [1.5, 0.5, 0.5, 0.5, 0.5, 0.5], amp: dynamic_value(105.56) play_pattern_timed [:F5, :Bb4, :Bb4, :C5], [2, 2, 1, 1], amp: dynamic_value(105.56) play_pattern_timed [:C5, :Eb5, :Ab5, :Gb5, :F5], [0.5, 0.5, 0.5, 0.5, 2], amp: dynamic_value(105.56)