Step triggered chords?

I’m looking for suggestions on how to do step triggered chords, as in starting around the 2:00 mark in this video (or pretty much any Deadmau5 track!). Love the sound but haven’t been able to do it in Sonic Pi.

Hi @birv2 ,

well, one solution could be to work with the slicer fx:

use_bpm 120
use_synth :dsaw
use_synth_defaults attack: 0.125, sustain: 1.5, release: 1
chords = (ring
          (chord :d, :m7),
          (chord :d, :m7),
          (chord :g, :sus4),
          (chord :g, :dom7, invert: -1),
          (chord :c, :maj9),
          (chord :c, :maj9),
          (chord :a, :minor7, invert: -1),
          (chord :a, :minor7, invert: -2))

live_loop :chordees do
  with_fx :slicer do
    play chords.tick
  sleep 2

Woohoo! I love what you did there. Couple of questions, of course!

  1. What does the invert -1 or -2 do?
  2. I think the step chords sound good for just the chords, but I’d love to add the percussive attack (if that’s the right word). Any thoughts?

Again, thanks!

Specifies chord inversions. The docs don’t show use of negative numbers so I’m guessing that is indexing into a ring of inversions for the chord. A seventh chord will have three inversions so you’d have:
(no inversion (7), firsrt inversion (6/5), second inversion (4/3), third inversion (4/2)) with -1 corresponding to the third inversion and -2 corresponding to the second inversion.

Just an addition: The reason for the use of the inversion option is (arguably) better voice leading. In classical harmonic the individual notes of chords in a progression can be seen as voices. It is recommended to keep the movement of these voices as economical as possible (which is by no means a must, see e. g. parallel harmony in house music).

1 Like

Yeah… I see. That, I think, won’t be possible with the slicer fx. But you can drastically shorten the length of the loop and play the chords as sixteenth notes (much more repetitions needed) and additionally add an increased attack_level in the use_synth_defaults. Probably comes with higher performance costs.

Thanks for the replies. I don’t want to turn this into a private music lesson, but by “inversion”, does that mean the chord is played backwards? Sorry, I’m a guitarist who doesn’t read music, so I’m wondering does that mean strumming the chord from top to bottom, instead of the other way?

“Inversion” simply means to take the lowest note of the chord in root position (in C this is C4-E4-G4), remove it and put it (one octave higher) on top of the chord (E4-G4-C5). For a 3-note-chord this makes one root position and 2 inversions, see " Root position and inverted chords"; so rather than backwards (it is not a matter of time but stacking) you could say sort of upside down.

To listen to a nice application of inversions go to Help > Examples > Chord Inversions in Sonic Pi and copy this code into a buffer. (This is also a good read if you want to see what you can do with nested loops :wink: )

Hope this helps.

Edit: It has nothing to do with a specific instrument. The effect of inversions in a way presupposes that you let all notes sound at the same time. Nevertheless you will note that having the C from the above example at the bottom or at the top makes the chord sound differently. Moreover it has an effect which note is the base note. I’d recommend to experiment with the option and let your ear decide whether this is something you need or want to explore further.


Thanks! I get nested loops ok, but I’m having to learn the music theory here. Which is a good thing! That example is lovely btw.

I will no doubt have more questions as I stumble along!

… tell me about it :wink:

1 Like