Sunday, 9 August 2020

Quick play with Sonic Pi



I often play with the brilliant Sonic Pi https://sonic-pi.net/ for a bit of fun, but let's be clear I have no musical ability.

To get my head around it I tried turning thee one tune I know "Hot Cross Buns" for the recorder into a tune. I found a useful webpage https://newt.phys.unsw.edu.au/jw/notes.html to turn the notes into the MIDI number (60, etc) . Played with the synthesier sounds and choose tech_saw just because I liked it. The code is below

use_synth :tech_saws
2.times do
  play 71
  sleep 0.5
  play 69
  sleep 0.5
  play 67
  sleep 0.5
end
4.times do
  play 67
  sleep 0.25
end
4.times do
  play 69
  sleep 0.25
end
play 71
sleep 0.5
play 69
sleep 0.5
play 67

Also tried it with changing the synth to prophet

Also tried to make it a bit more mournful (possible slightly aggressive) with minor chords - I used https://en.wikipedia.org/wiki/Minor_chord#:~:text=In%20music%20theory%2C%20a%20minor,is%20called%20a%20minor%20triad. to get the notes in combination with the MIDI notes list (I still think I got it wrong!)
use_synth :prophet
2.times do
  play 71
  play 62
  play 66
  sleep 0.5
  play 69
  play 60
  play 64
  sleep 0.5
  play 67
  play 70
  play 62
  sleep 0.5
end
4.times do
  play 67
  play 70
  play 62
  sleep 0.25
end
4.times do
  play 69
  play 60
  play 64
  sleep 0.25
end
play 71
play 62
play 66
sleep 0.5
play 69
play 60
play 64
sleep 0.5
play 67
play 70
play 62
sleep 0.5


Adding sound effects is great fun - same code as above with a slightly techno sound to it

use_synth :prophet
with_fx :ixi_techno do
  2.times do
    play 71
    play 62
    play 66
    sleep 0.5
    play 69
    play 60
    play 64
    sleep 0.5
    play 67
    play 70
    play 62
    sleep 0.5
  end
  4.times do
    play 67
    play 70
    play 62
    sleep 0.25
  end
  4.times do
    play 69
    play 60
    play 64
    sleep 0.25
  end
  play 71
  play 62
  play 66
  sleep 0.5
  play 69
  play 60
  play 64
  sleep 0.5
  play 67
  play 70
  play 62
  sleep 0.5
end

or alternatively

use_synth :prophet
with_fx :ixi_techno do
  2.times do
    play chord(:b4, :minor7)
    sleep 0.5
    play chord(:a4, :minor7)
    sleep 0.5
    play chord(:g4, :minor7)
    sleep 0.5
  end
  4.times do
    play chord(:g4, :minor7)
    sleep 0.25
  end
  4.times do
    play chord(:a4, :minor7)
    sleep 0.25
  end
  play chord(:b4, :minor7)
  sleep 0.5
  play chord(:a4, :minor7)
  sleep 0.5
  play chord(:g4, :minor7)
  sleep 0.5
end

I am the first to admit I have little musical knowledge but playing with Sonic Pi is still good fun; just changing the sound effects (like changing it to whammy and getting it sounding like aliens) is enjoyable.


All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon

No comments:

Post a Comment