Contents

Interplay F blues with Sonic Pi

Environment

  • MacOS Monterey 12.0, M1 Apple silicon
  • Sonic Pi v3.3.1 on Mac, for live coding
  • Garageband v10.4.4, for getting guitar sound from audio interface into Mac with sound source
  • Backgroud music version 0.4.0 snapshot, a virtual sound interface app for screen recording with computer internal sound

Interplay F blues with Sonic Pi

1 min version

{{/< instagram CV_fL7GhZBh >/}}

From scratch (full movie in 23 min.)


Sources

drums

  • Swing rate is 0.65 : 0.35 ?
  • Randomize simple fill-in
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

live_loop :hihat do
  4.times do
    sample :drum_cymbal_closed
    sleep 0.65
    sample :drum_cymbal_pedal
    sleep 0.35
  end
  
  fill = rrand(0,1)
  if (fill < 0.4)
    sleep 0.33
    sample :drum_cymbal_closed
    sleep 0.33
    sample :drum_cymbal_pedal
    sleep 0.34
    sample :drum_cymbal_pedal
  else
    sample :drum_cymbal_closed
    sleep 0.65
    sample :drum_cymbal_open
    sleep 0.35
  end
end

bass

  • Retrieve scale notes from list in ring of relevant chord
  • 1 and 3 beat comprises chord notes of root or 3, 5, 7
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
scales = [(scale :F, :mixolydian), (scale :Bb, :mixolydian),(scale :F, :mixolydian),(scale :F, :mixolydian),
          (scale :Bb, :mixolydian), (scale :B, :diminished),(scale :F, :mixolydian),(scale :D, :mixolydian),
          (scale :G, :minor), (scale :C, :mixolydian),(scale :F, :mixolydian),(scale :C, :mixolydian)].ring

s = scales[0]

live_loop :bass do
  use_synth :fm
  use_octave -2
  play s[0]
  sleep 1
  play s[rrand(0,6)]
  sleep 1
  play s[[2,4,6].choose]
  sleep 1
  play s[rrand(0,6)]
  sleep 0.65
  play s[[2,4,6].choose]
  sleep 0.35
  
  s = scales.tick
end

backing

  • Backing is intentionally generated in 3/4 (kind of polyrhythm)
  • Retrieve chord notes from relevant scale
  • Randomize fill-in
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
live_loop :backing do
  use_synth :blade
  use_octave -1
  play s[2]
  play s[4]
  sleep 1
  
  play s[[2,4,6].choose]
  play s[[0,1,6].choose]
  sleep 1
  
  fill = rrand(0,1)
  if (fill < 0.3)
    sleep 0.33
    play s[[2,4,6].choose]
    play s[[0,1,6].choose]
    sleep 0.33
    play s[[2,4,6].choose]
    play s[[0,1,6].choose]
    sleep 0.34
    play s[2]
    play s[[0,4,6].choose]
  end
end

obbligato

  • Retrieve scale notes
  • Randomize sleep interval from typical beat (1/4, 1/3, 2/4, 2/3 etc.)
1
2
3
4
5
6
7
8
9
live_loop :rehamo do
  interval = [0.25, 0.33, 0.5, 0.66, 0.75, 1].choose
  if four_verse % 2 == 0
    
    play s.choose
  end
  sleep interval
  
end

Result from improvisation 😅 is uploaded in github


Option. Setup virtual MIDI device

Garage band can take MIDI input as “Software Instrumental track” and assign any sound source. Above setting enables Sonic Pi

Audio MIDI Setup.app > window > Show MIDI studio > IAC Driver > Check “Device is online”

../../../images/sonicpi/IACDriverProperties_trim.jpg
IAC Driver properties

Sonic Pi > IO > MIDI Outputs > “IAS_driver_bus1” in this case.

../../../images/sonicpi/SonicPi_MIDI_output.jpg
Sonic Pi MIDI Output

Garageband cannot assign multiple MIDI channels to it’s tracks. All MIDI channels assign to one track in Garageband. That’s no way to reduce the variety of sounds in liveloops in Sonic Pi. It’s endurable to assign one note for MIDI like this way:

1
2
3
4
5
6
7
8
9
live_loop :melody do
  use_synth :sine
  r = [0.25, 0.33, 0.5, 0.66, 0.75, 1].choose
  # r = rrand(0, 1)
  if (four_verse % 2 == 0)
    midi s.choose, attack: 0, release: r, cutoff: rrand(50, 100)
  end 
  sleep r
end

References