Sonic Pi Monthly Challenge #2

Hello Sonic Pi’ers, it is time for challenge number 2 :smiley:

This challenge is “Acoustic Song Covers”.

Instructions:

  1. Choose an acoustic song that you like, and create a Sonic Pi version of it.
    You may use the built in synths and samples or use external samples, it is up to you.
    The length is also up to you.

  2. Post the code and/or audio link (Youtube/Soundcloud/Bandcamp, etc) in this topic.

Make sure that you tell us about the song you have covered, and supply a link to it, if possible.

The deadline for this challenge is 30th November.

Code and audio links will get added to the challenge repo.

Happy coding :computer:

Submissions playlist :point_down:

3 Likes

Acoustic as in only non-electric instruments, or just not synthy?

  • 1 ???
    Acoustic cover of song ?
    Cover of acoustic song ?

Cover of an acoustic song (non electronic instruments).

############## Go'in Home ############

mn=[:r]; for jn in 1..1023
  mn[jn]=hz_to_midi(4*jn)
end; use_bpm 120

c=[36,36,34,32,30,30,30,30,
   30,30,30,30,30,30,30,30,
   27,27,27,27,30,30,30,30]
v=[0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0]
e=[0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0]
p=[1,1,2,0,1,1,4,0,1,1,2,0,1,1,4,0]
k=[60,72,81,90,108,0]; t=[1,2,3,4]

for y in 0..31
  synth :zawa, note:mn[120], release: 0.01, amp: p[y%8]/2.0
sleep 0.25; end

live_loop :main do
  for x in 0..23; for b in 0..7; y=((x%2)*8)+b
      synth :fm, note: mn[c[x]], release: e[y]/1.5,
    amp: v[y]
  synth :zawa, note:mn[120], release: 0.01, amp: p[y]/2.0
sleep 0.25; end; end; end

live_loop :lead do; n=choose(k); a=choose(t)/4.0
  s=choose(t)/4.0; r=choose(t)/4.0
  synth :hollow,note: mn[n], attack: a, sustain: s,
    release: r, amp: 0.4
  synth :beep, note: mn[n], attack: a, sustain: s,
    release: r, amp: 0.3
sleep (a+s+r); end
3 Likes

Re-issued for the Sonic Pi Monthly Challenge, this is a bit of a cheat, as I wrote it back in 2015 when the current version of Sonic Pi was 2.5! It is now nearing 3.3.0 However I think it stands the test of time, as it covers a song which was brought to prominence by The Animals in 1964 This was in the days of my youth…(I am getting on a bit now)… and I always loved the strong bass part. Covering songs is not my forte or something that I do a lot, but I have enjoyed doing one or two including this classic. If I were to redo it from scratch now, the code would be a bit different and more compact. The coding was by hand and included routines to help with checking for errors. I can remember it took some time to get it right. I did a separate video some time ago where I used this track as a backing for a visual using Visor Live which is here

You can hear it on Sound Cloud

You can find the the code here

A video of tthe Animals in action is here

3 Likes

I didn’t have time to participate in the last monthly challenge, so I made extra sure I found time to put together something for this one.

I decided to write a cover of Signe by Eric Clapton, and came up with this:

I could spend lots more time tweaking it, but I think it’s good enough for now. If I do spend more time on it I’d like to play around with the rhythm a bit, as I think it feels a bit mechanical.

And here’s the code (it needs to be saved to a file and then run with run_file as it’s too big to run directly from a Sonic Pi buffer:

use_bpm 176

define :s do |t|
  sleep t
end

define :p do |n, r, a=1|
  if (n.respond_to? :each) then
    n.each do |i|
      play i, release: r, amp: a
    end
  else
    play n, release: r, amp: a
  end
end

define :c do |s, n|
  control s, note: n, amp: 2, slide: 0.1
end

define :ride do |t|
  sample :drum_cymbal_soft, release: t, amp: 0.5
  sleep t
end

define :sn do |t|
  sample :tabla_te_ne, release: t, amp: 0.5
  sleep t
end

define :hi do |t|
  sample :drum_cymbal_closed, release: t, amp: 0.3
  sleep t
end

with_fx :reverb, room: 0.95 do
  in_thread do # drums
    s 0.5
    # bar 1
    s 4
    # bar 2
    s 2.5
    ride 1.5
    # bar 3
    s 0.5
    ride 1
    ride 0.5
    s 0.5
    ride 1.5
    # bar 4
    s 1
    ride 2
    ride 1
    # bar 5
    ride 1.5
    ride 0.5
    s 1.5
    ride 0.5
    # bar 6
    s 1.5
    ride 0.5
    ride 2
    # bar 7
    ride 1.5
    ride 0.5
    s 0.5
    ride 0.5
    ride 0.5
    sn 0.5
    # bar 8
    s 3
    hi 1
    16.times do
      at [1, 3] do
        sn 1
      end
      8.times do
        hi 0.5
      end
    end

    s 0.5

    ## Bridge
    8.times do
      at [1, 3] do
        sn 1
      end
      8.times do
        hi 0.5
      end
    end

    with_fx :level, amp: 2 do
    hi 0.5
    hi 0.5
    s 0.5
    hi 0.5
    s 0.5
    hi 1
    in_thread do
      hi 1
    end
    s 0.5
    end

    at [1, 3] do
      sn 1
    end
    s 0.5
    7.times do
      hi 0.5
    end

    9.times do
      at [1, 3] do
        sn 1
      end
      8.times do
        hi 0.5
      end
    end

    with_fx :level, amp: 1 do |fx|
      control fx, amp: 0.2, slide: 4
      at [1, 3] do
        sn 1
      end
      8.times do
        hi 0.5
      end
    end

    s 1
    ride 2
  end

  in_thread do # guitar
    use_synth :pluck
    use_synth_defaults pan: 0.5, attack: 0.05
    # Intro
    p :a2, 1.5
    s 0.5
    # bar 1
    p [:a3, :cs4], 1.5
    s 1
    p :a2, 2.5
    s 0.5
    p [:gs3, :b3], 1
    s 1
    p :b3, 1, 0.5
    p :e4, 1
    s 1
    p :a2, 2
    p [:a2, :cs4], 1
    s 1
    p [:cs4, :e4], 1.5
    s 1
    p :a2, 1.5
    s 0.5
    p [:gs3, :b3], 2
    s 1
    p :e2, 0.5, 0.5
    s 0.5
    p :e2, 0.5, 0.5
    s 0.5
    # bar 3
    2.times do
      p :a2, 1.5
      p [:a3, :cs4], 1
      s 1
      p :cs4, 0.5, 0.5
      p :e4, 0.5
      s 0.5
      p :a2, 2
      p [:gs3, :b3], 1
      s 1
      p :b3, 1, 0.5
      p :e4, 1
      s 1
      p :a2, 2
      p [:a3, :cs4], 1
      s 1
      p [:cs4, :e4], 1.5
      s 1
      p :a2, 2.5
      s 0.5
      p [:gs3, :b3], 2
      s 2
      # bar 5/7
    end
    p :a2, 1.5
    p [:a3, :cs4], 1
    s 1
    p :cs4, 0.5, 0.5
    p :e4, 0.5
    s 0.5
    p :a2, 2
    p [:gs3, :b3], 1
    s 1
    p :b3, 1, 0.5
    p :e4, 1
    s 1
    p [:a2, :a3, :cs4], 0.5
    p :e3, 0.5, 0.5
    s 0.5
    # bar 8
    s 1.5
    p :e3, 0.5
    s 0.5
    x = p :gs3, 1
    s 0.5
    c x, :a3
    s 0.5
    p :b3, 0.5
    s 0.5
    p [:a2, :gs3, :cs4], 2
    p :gs3, 1, 0.5
    s 1 #bar 9
    p [:cs4, :e4], 1
    s 1
    p :a2, 2
    s 0.5
    p :fs3, 0.3, 0.5
    p [:b3, :ds4], 0.5
    s 0.5
    p :e4, 1
    s 1
    p :gs2, 2
    p [:b3, :e4], 1
    s 1 # bar 10
    p [:e4, :gs4], 1
    s 1
    p :fs2, 2
    x = p :a3, 1
    s 0.5
    c x, :as3
    s 0.5
    p :cs4, 1
    s 1
    p [:b2, :a3, :d4], 2
    p :fs3, 1, 0.5
    s 1 # bar 11
    p [:d4, :fs4], 1
    s 1
    p :b2, 2
    s 0.5
    p :a3, 1.5
    x = p :d4, 1.5
    s 0.5
    c x, :cs4
    s 1
    p [:e2, :gs3, :b3], 2
    p :e3, 1, 0.5
    s 1 # bar 12
    p [:b3, :e3], 1
    s 1
    p :e2, 2
    s 0.5
    x = p :d4, 1
    s 0.5
    c x, :cs4
    s 0.5
    p :b3, 0.5
    s 0.5
    p [:a2, :a3, :cs4], 2
    p :e3, 1, 0.5
    s 1 # bar 13
    p :cs4, 1, 0.5
    p :e4, 1
    s 1
    p :a2, 2
    s 0.5
    x = p :cs4, 1
    s 0.5
    c x, :b3
    s 0.5
    p :a3, 0.5, 0.5
    x = p :a3, 1.5
    s 0.5
    c x, :as3
    p [:fs2, :e3], 2
    s 1 # bar 14
    p [:cs4, :fs4], 1
    s 1
    p :a3, 2
    s 0.5
    x = p :as3, 1
    s 0.5
    c x, :b3
    s 0.5
    p :cs4, 0.5
    s 0.5
    p :b2, 2
    p :fs3, 1, 0.5
    p [:a4, :d4], 1
    s 1 # bar 15
    p [:d4, :fs4], 1
    s 1
    p :b2, 2
    s 0.5
    p :a3, 1.5
    x = p :d4, 1.5
    s 0.5
    c x, :cs4
    s 0.5
    x = p :g3, 1.5
    s 0.5
    c x, :gs3
    p :e2, 2
    p :e3, 1, 0.5
    p :b3, 1
    s 1 # bar 16
    p [:b3, :e4], 1
    s 1
    2.times do
      p :a2, 2
      s 0.5
      p :b3, 0.5
      s 0.5
      x = p :a3, 1
      s 0.5
      c x, :gs3
      s 0.5
      p :a2, 2
      p :e3, 1, 0.5
      p [:a3, :cs4], 1
      s 1 # bar 17/21
      p [:cs4, :e4], 1
      s 1
      p :a2, 2
      s 0.5
      p [:a3, :cs4], 0.5
      s 0.5
      p [:cs4, :e4], 1
      s 1
      p :fs2, 2
      p [:a3, :d4], 1
      s 1 # bar 18/22
      p [:d4, :e4], 1
      s 1
      p :fs2, 2
      s 0.5
      p [:a4, :d4], 0.5
      s 0.5
      p [:d4, :e4], 1
      s 1
      p :e2, 2
      p [:a4, :d4], 1
      s 1 # bar 19/23
      p [:d4, :e4], 1
      s 1
      p :e2, 2
      s 0.5
      p [:a4, :d4], 0.5
      s 0.5
      p [:d4, :e4], 1
      s 1
      p :e2, 2
      p [:gs3, :d4], 1
      s 1 # bar 20/24
      p [:d4, :e4], 1
      s 1
    end
    p :e2, 2
    s 0.5
    x = p :gs3, 0.5
    s 0.5
    c x, :a3
    s 0.5
    p :b3, 0.5
    s 0.5
    p [:a2, :a3, :cs3], 0.5
    p :e3, 0.5, 0.5
    s 0.5

    s 0.5

    # Bridge
    puts "b1", beat
    p :cs3, 1
    x = p :fs3, 1
    p :b3, 1
    y = p :ds4, 1
    s 0.5
    c x, :gs3
    c y, :e4
    s 1
    p [:cs3, :gs3, :b3, :e4], 0.5
    s 1
    p [:cs3, :gs3, :b3, :e4], 0.5
    s 1
    p :fs2, 2
    p :cs3, 1.5, 0.5
    p [:e3, :a3, :cs4], 1.5
    s 1.5 # bar 2
    p :e3, 1, 0.5
    p [:a3, :cs4], 1
    s 0.5
    p :fs2, 1.5
    s 0.5
    p :e3, 0.5, 0.5
    p [:a3, :cs4], 0.5
    s 0.5
    p [:cs4, :fs4], 0.5
    s 1
    p :b2, 2
    p [:fs3, :a3, :d4], 1
    s 0.5
    puts "b3", beat
    # bar 3
    s 0.5
    p [:d4, :fs4], 1.5
    s 1
    p :b2, 2
    s 0.5
    p :a3, 1.5
    x = p :d4, 1.5
    s 0.5
    c x, :cs4
    s 1
    p :e2, 2
    p :e3, 1, 0.5
    p [:gs3, :b3], 1
    s 1 # bar 4
    p [:b3, :e4], 1
    s 1
    p :e3, 1.5
    s 0.5
    x = p :gs3, 1
    s 0.5
    c x, :a3
    s 0.5
    p :b3, 0.5
    s 1
    puts "b5", beat
    # bar 5
    p :cs3, 1
    x = p :fs3, 1
    p :b3, 1
    y = p :ds4, 1
    s 0.5
    c x, :gs3
    c y, :e4
    s 1
    p [:cs3, :gs3, :b3, :e4], 0.5
    s 1
    p [:cs3, :gs3, :b3, :e4], 0.5
    s 1
    p :fs2, 2
    p :cs3, 1, 0.5
    p [:e3, :a3, :cs4], 1
    s 0.5
    # bar 6
    puts "b6", beat
    s 0.5
    p [:cs4, :fs4], 1
    s 1
    p :fs2, 2
    s 0.5
    p :e3, 0.5, 0.5
    p [:a3, :cs4], 0.5
    s 0.5
    p [:a3, :cs4], 0.5
    s 1
    p :b2, 2
    p :fs3, 1, 0.5
    p [:a3, :d4], 1
    s 0.5
    # bar 7
    puts "b7", beat
    s 0.5
    p [:d4, :fs4], 1
    s 1
    p :b2, 1.5
    s 0.5
    p :fs3, 0.5, 0.5
    p :a3, 1
    x = p :d4, 1
    s 0.5
    c x, :cs4
    s 1
    p :e2, 2
    p :e3, 1, 0.5
    p [:gs3, :b3], 1
    s 0.5
    # bar 8
    puts "b8", beat
    s 0.5
    p [:b3, :e4], 1
    s 1
    p :e3, 1.5
    s 0.5
    x = p :gs3, 1
    s 0.5
    c x, :a3
    s 0.5
    p :b3, 0.5
    s 1
    puts "b9", beat
    # bar 9
    s 0.5
    p [:cs3, :b3, :e4, :gs4], 0.5
    p :gs3, 0.5, 0.5
    s 1
    p [:cs3, :b3, :e4, :gs4], 0.5
    p :gs3, 0.5, 0.5
    s 1
    p [:cs3, :b3, :e4, :gs4], 0.5
    p :gs3, 0.5, 0.5
    s 1
    p :fs2, 2
    p :cs3, 1, 0.5
    p [:e3, :a3, :cs4], 1
    s 0.5
    # bar 10
    puts "b10", beat
    s 0.5
    with_synth_defaults coef: 0.7 do
      p :cs4, 1
      p :fs4, 1
      s 1
    end
    p :fs2, 1.5
    s 0.5
    p :e3, 0.5, 0.5
    p [:a3, :cs4], 0.5
    s 0.5
    p :fs4, 0.5
    s 1
    p :b2, 2
    p :fs3, 1
    p [:a3, :d4], 1
    s 1 # bar 11
    p [:d4, :fs4], 1
    s 1
    p :b2, 2
    s 0.5
    p :a3, 1
    x = p :d4, 1
    s 0.5
    c x, :cs4
    s 1
    p :e2, 2
    p :e3, 1, 0.5
    p [:gs3, :b3], 1
    s 0.5
    # bar 12
    puts "b12", beat
    s 0.5
    p [:b3, :e4], 1
    s 1
    p :e2, 2
    s 0.5
    p :b3, 0.5
    s 0.5
    x = p :a3, 1
    s 0.5
    c x, :gs3
    s 0.5
    p :a2, 2
    p :e3, 1, 0.5
    p [:a3, :cs4], 1
    s 1 # bar 13
    p :cs4, 1, 0.5
    p :e4, 1
    s 1
    p :a2, 2
    s 0.5
    p [:a3, :cs4], 0.5
    p :cs4, 0.5
    s 0.5
    p :e4, 1
    s 1
    p :fs2, 2
    p [:a3, :d4], 1
    s 1 # bar 14
    p [:d4, :e4], 1
    s 1
    p :fs2, 2
    s 0.5
    p [:a4, :d4], 0.5
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :e2, 2
    p [:a4, :d4], 1
    s 0.5
    # bar 15
    puts "b15", beat
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :e2, 2
    s 0.5
    p [:a4, :d4], 0.5
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :e2, 2
    p [:gs3, :d4], 1
    s 0.5
    # bar 16
    puts "b16", beat
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :e3, 1.5
    s 0.5
    p :b3, 0.5
    s 0.5
    x = p :a3, 1
    s 0.5
    c x, :gs3
    s 0.5
    p :a2, 2
    p :e3, 1, 0.5
    p :a3, 1
    p :cs4, 1, 0.5
    s 1 # bar 17
    p :cs4, 1, 0.5
    p :e4, 1
    s 1
    p :a2, 2
    s 0.5
    p [:a3, :cs4], 0.5
    s 0.5
    p :cs4, 1, 0.5
    p :e4, 1
    s 1
    p :fs2, 2
    p [:a3, :d4], 1
    s 0.5
    # bar 18
    puts "b18", beat
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :fs2, 2
    s 0.5
    p [:a4, :d4], 0.5
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :e2, 2
    p [:a4, :d4], 1
    s 1 # bar 19
    p [:d4, :e4], 1
    s 1
    p :e2, 2
    s 0.5
    p [:a4, :d4], 0.5
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :e2, 2
    p [:gs3, :d4], 1
    s 0.5
    # bar 20
    puts "b20", beat
    s 0.5
    p [:d4, :e4], 1
    s 1
    p :e2, 1
    s 0.5
    x = p :b3, 1
    s 0.5
    c x, :a3
    s 0.5
    p :gs3, 0.5
    s 2
    p :a2, 2
    s 0.2
    p :e3, 2, 0.5
    s 0.2
    p :a3, 2
    s 0.2
    p :cs4, 2
    s 0.2
    p :a4, 2
  end
end
2 Likes

@emlyn … Just paste in the url … No embed code
Seems to automatically show the player …

Thanks! I tried that first but it wasn’t showing up in the preview so I assumed it needed something more complicated. But I just edited it and it appeared in the preview just fine this time… oh well.

That’s great! Did you carve that out by hand? Amazing.

I’m struggling with this challenge. While I’m finding SPi fantastic for loopy backing tracks, including melodies is really tricky. It would be a interesting exercise, but I’ve not got all the time - I think I’m going to investigate automating this. I’ve seen some stuff about converting midi files to SPi format, that seems like a sensible way.

At the moment I’m including melodies and phrases (other than short riffs) by recording them from a DAW and included them as samples.

One day wouldn’t it be nice to have a native midi file reader/player equivalent to sample. I know, I know… :smile:

1 Like

Yes, that was all done by hand using the sheet music as a reference. I wrote a few helper functions to reduce the amount of typing required, but basically it’s just a sequence of plays (or samples for the drums) and sleeps, with a couple of controls for slurs. Although transcribing it all felt daunting at first, once you get going it advances surprisingly quickly.

1 Like

Right. Looks like a good pattern. I think I’d need to write some helper functions along the lines of play(note, duration,amp) rather than hand-craft all the sleeps

with duration being codes like m for mini, dc for dotted crotchet etc.

Just two weeks left for this one now, thanks for the submissions so far :smiley: :musical_note:

Well, I had so much fun with the first piece that I decided to make another entry… again a guitar piece but this time more classical: Recuerdos de la Alhambra by Francisco Tárrega (here it is being played by Ana Vidovic, about a million times better than my version).

Here’s the code:

define :trem do |n1, n2, acc=1|
  play n1, release: 0.5, amp: acc
  time_warp [0.125, 0.25, 0.375 + 0.02] do
    time_warp rrand(-0.01, 0.01) do
      play n2, release: 0.125, amp: 0.88
    end
  end
  sleep 0.5
end

define :trem2 do |n1, n2, n3|
  play n1, release: 0.5
  at 0.125 do
    play n2, release: 0.125, amp: 0.8
    sleep 0.125
    s = play n2, release: 0.25, slide: 0.02, amp: 0.8
    sleep 0.25/3
    control s, note: n3, amp: 1.5
    sleep 0.25/3
    control s, note: n2
  end
  sleep 0.5
end

define :bar do |thumbs, trems, acc=false|
  trems *= 2 if trems.length == 1
  trems = [trems[0]] + trems if trems.length == 2
  trems = stretch(trems, 2) if trems.length == 3
  assert_equal thumbs.length, trems.length
  thumbs.zip(trems).each_with_index do |n, i|
    n1, n2 = n
    a = 1
    a = 2 if acc and i > 0 and i % 2 == 0
    trem n1, n2, a
  end
end

define :part1 do |fx|
  # bar 1
  control fx, amp: 0.8
  bar [:a2, :e3, :c4, :e3, :b3, :e3], [:e4, :d4], true
  
  control fx, amp: 2
  bar [:a2, :e3, :c4, :e3, :b3, :e3], [:c4, :d4], true
  
  control fx, amp: 0.8
  bar [:a2, :e3, :c4, :e3, :c3, :e3], [:e4], true
  
  control fx, amp: 2
  bar [:a2, :e3, :c4, :e3, :d4, :e3], [:e4, :f4], true
  
  # bar 5
  bar [:c3, :g3, :e4, :g3, :d4, :g3], [:g4, :f4]
  
  bar [:c3, :g3, :c4, :g3, :d4, :g3], [:e4, :f4]
  
  bar [:c3, :g3, :e4, :g3, :e4, :g3], [:g4]
  
  bar [:c3, :g3, :c4, :g3, :e4, :g3], [:g4]
  
  # bar 9
  bar [:f3, :c4, :f4, :c4, :g4, :c4], [:c5, :b4]
  
  bar [:f3, :c4, :f4, :c4, :d3, :f4], [:a4, :b4]
  
  trem :e2, :a4
  trem2 :b3, :a4, :b4
  2.times do
    trem :e4, :gs4
    trem :b3, :gs4
  end
  
  bar [:e2, :d4, :e4, :d4, :e4, :d4], [:gs4]
  
  # bar 13
  bar [:a2, :cs4, :e4, :cs4, :e4, :cs4], [:bf4, :a4]
  
  bar [:cs3, :a3, :e4, :a3, :f4, :a3], [:g4, :a4]
  
  trem :d3, :g4
  trem2 :e4, :g4, :a4
  2.times do
    trem :d4, :f4
    trem :a3, :f4
  end
  
  bar [:d3, :a3, :d4, :a3, :d4, :a3], [:f4]
  
  # bar 17
  bar [:d3, :a3, :b3, :a3, :b3, :a3], [:e4, :d4]
  
  bar [:f2, :ds3, :a3, :ds3, :a3, :ds3], [:c4, :d4]
  
  trem :e2, :c4
  trem2 :e3, :c4, :d4
  2.times do
    trem :gs3, :b3
    trem :e3, :b3
  end
  
  bar [:e2, :e3, :gs3, :e3, :gs3, :e3], [:b3]
end

define :part2 do |fx, n|
  # bar 21
  bar [:a2, :e3, :cs4, :e3, :b3, :e3], [:e4, :d4]
  
  bar [:a2, :e3, :a3, :e3, :b3, :e3], [:cs4, :d4]
  
  2.times do
    bar [:a2, :e3, :cs4, :e3, :cs4, :e3], [:e4]
  end
  
  #bar 25
  bar [:a2, :fs3, :d4, :fs3, :d4, :fs3], [:fs4]
  
  bar [:a2, :d4, :b4, :d4, :d4, :fs3], [:d5, :fs4]
  
  trem :a2, :fs4
  trem2 :d4, :fs4, :gs4
  2.times do
    trem :cs4, :e4
    trem :e3, :e4
  end
  
  bar [:a2, :e3, :cs4, :e3, :cs4, :e3], [:e4]
  
  # bar 29
  bar [:fs2, :fs3, :a3, :cs4, :a3, :fs3], [:a4]
  
  bar [:e2, :gs3, :bs3, :ds4, :bs3, :gs3], [:gs4, :ds3]
  
  bar [:cs3, :gs3, :cs4, :gs3, :cs4, :gs3], [:fs4, :e4, :e4]
  
  bar [:cs3, :gs3, :cs4, :gs3, :cs4, :gs3], [:e4]
  
  # bar 33
  bar [:b2, :f3, :f3, :d3, :e3, :f3], [:d4]
  
  bar [:e2, :e3, :e3, :e3, :e2, :d3], [:cs4, :b3]
  
  trem :a2, :b3
  trem2 :e3, :b3, :cs3
  trem :e3, :a3
  trem :e3, :a3
  trem :fs3, :a3
  trem :gs3, :a3
  
  if n == 1 then
    bar [:a2, :e3, :cs3, :e3, :a3, :b3], [:a3, :a3, :a3, :b3, :cs4, :d4]
  elsif n == 2 then
    bar [:a2, :e3, :e3, :gs3, :a3, :b3], [:a3, :a3, :a3, :b3, :c4, :d4]
  elsif n == 3 then
    bar [:a2, :e3, :e3, :e3, :e3, :e3], [:a3]
  else
    assert false
  end
end

define :coda do |fx|
  # bar 39
  bar [:a2, :f3, :f3, :f3, :f3, :f3], [:a3]
  
  bar [:a2, :f3, :a3, :f3, :a3, :f3], [:b3, :c4, :d4]
  
  2.times do
    bar [:a2, :e3, :cs4, :e3, :cs4, :e3], [:e4]
  end
  
  # bar 43
  bar [:e2, :gs3, :gs3, :gs3, :gs3, :gs3], [:e4]
  
  bar [:e2, :fs3, :e3, :e3, :e2, :d3], [:d4, :cs4, :b4]
  
  bar [:a2, :e3, :e3, :es3, :fs3, :es3], [:a3]
  
  bar [:a2, :e3, :e3, :e3, :e3, :e3], [:a3]
  
  # bar 47
  bar [:a2, :f3, :f3, :f3, :f3, :f3], [:a3]
  
  bar [:a2, :f3, :a3, :f3, :a3, :f3], [:b3, :c4, :d4]
  
  2.times do
    bar [:a2, :e3, :cs4, :e3, :cs4, :e3], [:e4]
  end
  
  # bar 51
  bar [:e2, :e3, :e4, :e3, :e4, :e3], [:gs4]
  
  bar [:e2, :e3, :cs4, :e3, :b3, :e3], [:fs4, :e4, :d4]
  
  bar [:a2, :e3, :a3, :e3, :fs3, :a3], [:cs4]
  
  trem :a2, :cs4
  use_bpm_mul 0.98
  trem :e3, :cs4
  use_bpm_mul 0.98
  trem :a3, :cs4
  use_bpm_mul 0.98
  trem :e2, :cs4
  use_bpm_mul 0.98
  trem :bs2, :cs4
  use_bpm_mul 0.98
  trem :cs3, :cs4
  use_bpm_mul 0.98
  
  # bar 55
  control fx, amp: 1, slide: 1
  bar [:a2, :e3, :a3, :e2, :bs2, :cs3], [:cs4]
  
  control fx, amp: 0.5, slide: 0.5
  play :a2, release: 3
  sleep 0.5
  [:e3, :a3, :cs4, :e4, :a4].each do |n|
    play n, release: 1
    sleep 0.5
  end
  
  time_warp line(0, 0.5), [:a2, :cs4, :a4, :e5] do |n|
    play n, release: 3
  end
  sleep 3
  
  time_warp line(0, 0.5), [:a2, :cs3, :e4, :a4] do |n|
    play n, release: 3
  end
  sleep 3
  
end

use_synth :pluck
use_synth_defaults attack: 0.05
use_bpm 82

with_fx :reverb, room: 1, amp: 2, slide: 3 do |fx|
  2.times do
    part1 fx
  end
  2.times do |n|
    part2 fx, n+1
  end
  part1 fx
  part2 fx, 3
  coda fx
end
3 Likes

I might loose out on this one :frowning:

I was planning in taking the instructions more like a suggestion. My idea was to make an “acoustic” cover of smashing pumpkins’ 1979 with my brother. He loves the song and plays it all the time on his acoustic guitar and a few days ago I figured out the drumming pattern and wrote a script on sonic pi to trigger my old Roland JV 1010.

I was inspired by this version of radiohead’s present tense where they play one of their more bossa nova-ish songs with two guitars and a drum machine. Because the song’s groove is very static it works great with a drum machine or loop instead of real drums. I heard a while ago that smashing pumpkins actually use sampled programmed drums all the way on the original recoding of 1979 so I think it makes a perfect fit to cover with a more robotic percussion.

I told my brother about doing a cover and he is down with the idea but a sting of his guitar just broke the day I told him about covering 1979 :frowning:

Amway’s here’s the code for the drums of 1975 without MIDI and just using some samples from sonic pi. I we get new strings for his guitar maybe we’ll get arround to recording a full cover, but I reckon it may happen after the deadline for the monthly challenge.

##| 1979

use_bpm 127

define :pattern do |pattern|
  return pattern.ring.tick == "x"
end

live_loop :kicks do
  sample :drum_heavy_kick, lpf: 90 if pattern "x-------x-x---x---x-----x-x-----"
  sleep 0.25
end

live_loop :snares do
  sample :drum_snare_hard, lpf: 85 if pattern "----x-------x-------x-------x---"
  sleep 0.25
end

live_loop :hihat do
  sample :drum_cymbal_soft, lpf: 90 if pattern "x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-"
  sleep 0.25
end
2 Likes

That’s a great code scheme for drum patterns. I’ll adopt that immediately :smile:

That’s excellent @emlyn and btw instantly transported me back to my childhood sitting watching kids TV - it was the theme tune to Jack Hargreaves’ Out of Town. Talk about a petit madeleine moment, good grief

1 Like

In fact @alexsec that’s not great. It’s genius!!! I’m a bit wary of adding complex code structures, I’d rather keep it bare - but three lines and it makes patterns so much easier. You’ve just opened a new door :smiley: