My experiments with Sonic Pi: 1. No Surprises.

The purpose of this experiment.

To see how easy it was to arrange No Surprises by Radiohead on Sonic Pi.

Every exploration has to start somewhere and my exploration of Sonic Pi has started with what I would classify as a successful attempt at coding a cover of No Surprises. Why No Surprises? Because I like it. And Sonic Pi’s default keys reminded me of the keys on the intro of the song.

The track itself

Structurally, No Surprises is fairly straightforward. Of course, there’s a lot of nuance when it’s performed on ‘real instruments’, but at it’s core, it’s an intro that leads to a long verse that leads to a chorus, then a shorter verse that leads to the second chorus, then a bridge, followed by a final verse and chorus. Musically, therefore, there were only these parts to consider while writing the code:

  • the intro

  • the verse

  • the chorus

  • the bridge

Ideally, I planned to write a function for each of these, then just call them in order, but since these are basically my first few hours writing on Sonic Pi (and my first few hours writing any non SQL, no web development code in several years), I ended up writing some filthy mish-mash of smaller functions. But it’s functional and is pasted at the end of this.

Conclusions

The purpose of Sonic Pi isn’t to cover Radiohead. It would be much easier to do that with on Logic Pro or any other digital audio workstation (DAW). Besides, what is MIDI but a no-code layer on top of code similar to the sort that I’m writing here. As far as I’m concerned, I’m most excited about using Sonic Pi to do things I wouldn’t be able to easily do with an acoustic guitar, a mic, a MIDI keyboard and a DAW.

I can think of certain things that are likely to be easier to accomplish: odd grooves, automating effects, building strange progressions, playing notes that aren’t present on standard keyboards (like what’s between these keys? 🎹) The possibilities seem, well not endless, but finite but large.

That said, now that I have the basics + arrangement out of the way, step 2 is composition.

The (highly highly inefficient) code.

#the define command is to define functions; function names self-explanatory hopefully
define :main_melody do
  3.times do
    play_pattern_timed [:e5, :g4, :c5, :g4], 0.5
  end
  play_pattern_timed chord(:f4, :m6), 0.5
end

define :verse_melody do
  2.times do
    play_pattern_timed [:e5, :g4, :c5, :g4], 0.5
  end
end

define :verse_melody_3 do
  2.times do
    play_pattern_timed [:f5, :a4, :c5, :a4], 0.5
  end
end

define :verse_melody_4 do
  2.times do
    play_pattern_timed [:b4, :g4, :d4, :g4], 0.5
  end
end

define :intro_bass do
  play :c3, release: 1
  sleep 2
  play :c3, release: 0.5
  sleep 0.5
  play :c3, release: 1
  sleep 1.5
  play :c3, release: 1
  sleep 2
  play :f3, release: 1
  sleep 0.75
  play :f3, release: 1
  sleep 0.75
  play :e3, release: 1
  sleep 0.5
end

#intro rhythm function
define :intro_rhythm do
  6.times do
    play chord(:c4,:major)
    sleep 1
  end
  2.times do
    play chord(:f3,:minor)
    sleep 1
  end
end

define :verse_bass_1 do
  4.times do
    play :c3
    sleep 2
  end
end

define :verse_rhythm_1 do
  8. times do
    play chord(:c4,:major)
    sleep 1
  end
end

define :verse_bass_2 do
  4.times do
    play :a2
    sleep 2
  end
end

define :verse_rhythm_2 do
  8.times do
    play chord(:a3,:minor)
    sleep 1
  end
end

define :verse_bass_3 do
  2.times do
    play :f2
    sleep 2
  end
end

define :verse_rhythm_3 do
  4.times do
    play chord(:f3,:major)
    sleep 1
  end
end

define :verse_bass_4 do
  2.times do
    play :g2
    sleep 2
  end
end

define :verse_rhythm_4 do
  4.times do
    play chord(:g3,:major)
    sleep 1
  end
end

define :bridge_melody do
  play :b4, release: 1
  sleep 0.5
  play :g4, release: 1
  sleep 0.5
  play :b4, release: 1
  sleep 0.75
  play :g4, release: 1
  sleep 0.25
  play :c5, release: 1
  sleep 0.25
  play :b4, release: 1
  sleep 0.25
  play :g4, release: 1
  sleep 0.5
  play :b4, release: 1
  sleep 0.75
  play :g4, release: 1
  sleep 0.25
  play_pattern_timed chord(:f4, :m6), 0.5
  play :ds5, release: 1
  sleep 0.5
  play :d5, release: 1
  sleep 0.5
  play :c5, release: 1
  sleep 0.5
  play :g4, release: 1
  sleep 0.5
end

define :bridge_bass do
  4.times do
    play :g2
    sleep 1
  end
  4.times do
    play :f2
    sleep 1
  end
end


define :bridge_rhythm do
  4.times do
    play chord(:g3,:major)
    sleep 1
  end
  4.times do
    play chord(:f3,:minor)
    sleep 1
  end
end

#intro

2.times do
  main_melody
end

in_thread do
  2.times do
    main_melody
  end
end

in_thread do
  2.times do
    intro_bass
  end
end

2.times do
  intro_rhythm
end

#verse 1, part 1

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_1
end

verse_rhythm_1

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_2
end

verse_rhythm_2

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  main_melody
end

in_thread do
  intro_bass
end

intro_rhythm

#verse 1, part 2

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_1
end

verse_rhythm_1

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_2
end

verse_rhythm_2

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  main_melody
end

in_thread do
  intro_bass
end

intro_rhythm

#verse 1, part 3

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_1
end

verse_rhythm_1

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_2
end

verse_rhythm_2

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

2.times do
  main_melody
end

in_thread do
  2.times do
    verse_melody
  end
end

#verse & chorus 3

verse_bass_1

in_thread do
  2.times do
    verse_melody
  end
end

verse_bass_2

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  main_melody
end

in_thread do
  intro_bass
end

intro_rhythm

#bridge

in_thread do
  bridge_melody
end

in_thread do
  bridge_rhythm
end

bridge_bass

in_thread do
  bridge_melody
end

in_thread do
  bridge_rhythm
end

bridge_bass

in_thread do
  bridge_melody
end

in_thread do
  bridge_rhythm
end

bridge_bass

#verse & chorus 3

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_1
end

verse_rhythm_1

in_thread do
  2.times do
    verse_melody
  end
end

in_thread do
  verse_bass_2
end

verse_rhythm_2

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

in_thread do
  verse_melody_3
end

in_thread do
  verse_bass_3
end

verse_rhythm_3

in_thread do
  verse_melody_4
end

in_thread do
  verse_bass_4
end

verse_rhythm_4

main_melody

play chord(:c4,:major)
Previous
Previous

My experiments with Sonic Pi: 2. Are Microwaves Friends?

Next
Next

Sonic Pi: a short introduction