Swing & Walking Bass

A tutorial on how to create a swing rhythm and a walking bass in Sonic Pi.

It’s Jazz time!

One of the most iconic aspects of jazz is the swing rhythm, that is usually played on a ride cymbal and notated as a quarter and two eighth notes.

The two eighth notes are played more like eighth note triplets, and sleep times of 0.7 and 0.3 are a good aproximation.

use_bpm 120

live_loop :swing do
sample :drum_cymbal_soft
sleep (ring 1,0.7,0.3).tick
end

With the swing feel done, we can turn to the harmony. To make the chords clear, I use a piano sound to play the chords that are saved in a ring.

The chord_degree function is explained in this post.

chords = (ring 1,1,5,5,1,4,5,1)

live_loop :harmony do
use_synth :piano
tick
4.times do
play_chord (chord_degree chords.look, :c3,:major,3)
sleep 1
end
end

The walking bass plays four quarternotes that come from the chords in the progression.

live_loop :walking_bass do
tick
use_synth :dpulse
play (chord_degree chords.look,
:c3,:major)[0]
sleep 1
play (chord_degree chords.look, :c3,
:major,5).choose
sleep 1
play (chord_degree chords.look, :c3,
:major)[(ring 1,2,3).choose]
sleep 1
play (chord_degree chords[look + 1],
:c3,:major)[0] + (ring -2,-1,1,2).choose
sleep 1
end

The first note:

The first note that the walking bass plays in a bar is usually the root of the chord.

The chord_degree function returns a ring of notes in the chord, and the index 0 refers to the root.

The second note:

For the second note, the bass has a lot of freedom. In this case, the bass can play the root, third, fifth, seventh and nineth of the current chord(look here for more details on the chord_degree function.)

The third note:

The third beat is similar to the first beat, but here the bass can play the third, fifth or seventh. One of these notes is randomly selected.

The fourth note:

The fourth note is different from the others, because it doesn’t come from the current chord, instead it leads to the next chord.

The next chord in the progression is accessed with the [look + 1] index.

To lead to the root of that chord that will be played on the first beat in the next bar, we access that root and go one or two halfsteps up or down – randomized again.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s