# Using degree and scale\_degree

**URL:** <https://in-thread.sonic-pi.net/t/using-degree-and-scale-degree/912>\
**Category:** Creations & Ideas\
**Created:** [March 26, 2018, 4:28pm UTC](https://in-thread.sonic-pi.net/t/using-degree-and-scale-degree/912 "2018-03-26T16:28:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kniknoo](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/kniknoo/32/146_2.png) [@kniknoo](https://in-thread.sonic-pi.net/u/kniknoo)\
**Post date:** [March 26, 2018, 4:28pm UTC](https://in-thread.sonic-pi.net/t/using-degree-and-scale-degree/912/1 "2018-03-26T16:28:14Z")

</div>

Hello all.  
Here’s a look at how to use degree and chord degree. Please point out anything unclear or sloppily worded, I plan to revise this.

Degree

In section 8.3, the notion of using a scale is introduced. A scale is a collection of notes, often 7, which together provide the key signature of all or part of a song. Sonic Pi provides a number of common and uncommon scales, from the familiar :major and :minor to the exotic :bhairav and :iwato that are stored as lists.

Using the scale function, we are easily able to ascend and descend through the scale by ticking through rings, or play a random note by choosing. By creating a pattern of index values for a scale, we can even create a more complex arpeggio.

```ruby
loop do
  i = [1, 3, 7, 2, 1, 3, 7, 5].ring.tick
  play (scale, :c4, :major)[i], release: 0.15
  sleep 0.25
end

```

The degree command gives us another way to achieve the same thing using a musically inspired notation. The degree of a scale is typically represented by a Roman numeral, and Sonic Pi provides the labels :i, :ii, :iii, :iv, etc to represent that. Therefore, the above example could be represented by:

```ruby
loop do
  deg = [:i, :iii, :vii, :ii, :i, :iii, :vii, :v].ring.tick
  play degree(deg, :c4, :major), release: 0.15
  sleep 0.25
end

```

Note that if you use a number higher than the scale has notes, a :vii in a :major\_pentatonic for example, you will hear silence.

Chord Degree

The chord\_degree command is a real powerhouse of a tool, one that can grow your compositional options dramatically. Like degree, it uses a :i - :vii notation related to the notes within a scale, but generates the appropriate chord for each degree to stay in key.

```ruby
loop do
  use_synth :fm
  deg = [:i, :iv, :i, :v].ring.tick
  play chord_degree(deg, :e4, :major, 3)
  sleep 1
end

```

The 3 after the scale name tells the command that we want 3 notes instead of the default 4.

Now we can get wild with parallel scales and key changes, allowing our composition to use complex techniques without needing to identify each chord independently. In this example, the chords have been broken apart into an arpeggio. The inner loop cycles between the 4 degrees and the outer loop switches between a parallel major and minor, alternating.

```ruby
loop do
  use_synth :fm
  scl = [:major, :minor].ring.tick(:scl)
  4.times do
    deg = [:i, :iv, :i, :v].ring.tick(:deg)
    4.times do
      play chord_degree(deg, :c4, scl, 3).ring.reverse.tick(:nt)
      sleep 0.25
    end
  end
end

```

Now let’s bring these two loops together and see how cohesive they sound even when we switch from a major to a minor key.

```ruby
in_thread do
  loop do
    use_synth :fm
    scl = [:major, :minor].ring.tick(:scl)
    4.times do
      deg = [:i, :iv, :i, :v].ring.tick(:deg)
      play chord_degree(deg, :c4, scl, 3)
      sleep 2
    end
  end
end

loop do
  scl = [:major, :minor].ring.tick(:scl)
  32.times do
    deg = [:i, :iii, :vii, :ii, :i, :iii, :vii, :v].ring.tick
    play degree(deg, :c4, scl), release: 0.25
    sleep 0.25
  end
end

```

---

<div class="post-metadata">

**Author:** ![jonny](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jonny](https://in-thread.sonic-pi.net/u/jonny)\
**Post date:** [October 27, 2023, 5:24pm UTC](https://in-thread.sonic-pi.net/t/using-degree-and-scale-degree/912/2 "2023-10-27T17:24:23Z")

</div>

> [@kniknoo](#):
>
> Note that if you use a number higher than the scale has notes, a :vii in a :major\_pentatonic for example, you will hear silence.

Hi, I just found this thread after reading the one where it was proposed / discussed 👍  
also I read the PR added by emelyn and tested, and if I understand correctly, the limitation mentioned here is no longer present 🕶

**TEST: add higher number** `:m`

```ruby
loop do
  deg = [:i, :iii, :vii, :ii, :i, :iii, :vii, :v, :m].ring.tick
  play degree(deg, :c4, :major), release: 0.15
  sleep 0.25
end

```

to double-check I tried this

```ruby
loop do
  deg = [9, 10, 11].ring.tick
  play degree(deg, :c4, :major), release: 0.15
  sleep 0.25
end

```

I hear sound! Just thought I’d mention, back to ya breakdown on sp\_degrees👍
