Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR1775: Sonic Pi

Hosted by Steve Bickle on 2015-05-22 00:00:00
Download or Listen

In this review of the Sonic Pi software I have mentioned a couple of programs that I wrote the listings are here:

============================
The Hippopotamus Song
============================
use_bpm 180
# use_transpose -12
use_synth :fm
2.times do
play_pattern_timed [:D3,:G3,:G3,:G3], [1,1,1,1]      # 1 extra note from bar an bar 2
play_pattern_timed [:G3,:D3,:B2,:G2], [0.5,0.5,1,1]  # 3
play_pattern_timed [:a2,:b2,:c3], [1,1,1]            # 4
play_pattern_timed [:b2,:b2,:a2], [2,0.5,0.5]        # 5
play_pattern_timed [:g2,:g3,:g3], [1,1,1]            # 6
play_pattern_timed [:fs3,:g3,:e3], [1,1,1]           # 7
play_pattern_timed [:d3,:d3], [4,1]                  # 8 9
play_pattern_timed [:g3,:g3,:g3], [1,1,1]            # 10
play_pattern_timed [:g3,:d3,:b2,:g2], [0.5,0.5,1,1]  # 11
play_pattern_timed [:a2,:b2,:c3], [1,1,1]            # 12
play_pattern_timed [:b2,:b3,:a3], [2,0.5,0.5]        # 13
play_pattern_timed [:g3,:fs3,:e3], [1,1,1]           # 14
play_pattern_timed [:a3,:fs3,:e3], [1,1,1]           # 15
play_pattern_timed [:d3,:d3], [4,1]                  # 16 17
play_pattern_timed [:a3,:a3,:a3], [1,1,1]            # 18
play_pattern_timed [:e3,:e3,:e3], [1,1,1]            # 19
play_pattern_timed [:a3,:a3,:a3], [1,1,1]            # 20
play_pattern_timed [:e3,:a3], [2,1]                  # 21
play_pattern_timed [:c4,:b3,:a3], [1,1,1]            # 22
play_pattern_timed [:a3,:b3,:gs3], [1,1,1]           # 23
play_pattern_timed [:a3,:d3], [4,1]                  # 24 25
play_pattern_timed [:e3,:fs3,:g3], [1,1,1]           # 26
play_pattern_timed [:fs3,:d3,:d3], [1,1,1]           # 27
play_pattern_timed [:e3,:fs3,:g3], [1,1,1]           # 28
play_pattern_timed [:fs3,:d3,:d3], [1,1,1]           # 29
play_pattern_timed [:c4,:b3,:a3], [1,1,1]            # 30
play_pattern_timed [:g3,:fs3,:e3], [1,1,1]           # 31
play_pattern_timed [:fs3],[1], sustain_level: 0.6, sustain: 1, decay: 3   # 32 sustain note into next bar
play_pattern_timed [:g3,:fs3], [1,1]                 # 32
play_pattern_timed [:e3,:d3,:fs3], [1,1,1]           # 33
play_pattern_timed [:g3,:d3],[3,3]                   # 34 35
play_pattern_timed [:c3,:b2,:a2], [1,1,1]            # 36
play_pattern_timed [:d3],[3]                         # 37
play_pattern_timed [:g3,:fs3,:g3], [1,1,1]           # 38
play_pattern_timed [:e3,:a3,:g3], [1,1,1]            # 39
play_pattern_timed [:fs3,:e3,:fs3], [1,1,1]          # 40
play_pattern_timed [:d3,:d3],[2,1]                   # 41
play_pattern_timed [:b3,:b3,:a3], [0.5,1.5,1]        # 42
play_pattern_timed [:g3,:d3,:d3], [0.5,1.5,1]        # 43
play_pattern_timed [:c4,:c4,:b3], [1,1,1]            # 44
play_pattern_timed [:a3,:e3,:d3], [0.5,1.5,1]        # 45
play_pattern_timed [:e3,:fs3,:g3], [1,1,1]           # 46
play_pattern_timed [:d3,:b2,:g2], [1,1,1]            # 47
play_pattern_timed [:a2],[3], decay: 3               # 48
play_pattern_timed [:a2,:b2,:a2], [1,1,1]            # 49
play_pattern_timed [:g2],[3], decay: 3               # 50
play_pattern_timed [:g2],[1]                         # 51
sleep 2
end

=======================================
The HPR Outro theme - hack on this improve it and make a show
=======================================
in_thread do
  use_bpm 180
  use_transpose 24
  use_synth :beep
  19.times do
    play_pattern_timed [:a,:as,:a,:a], [0.5],release: 0.02, amp: 0.3 #
    play_pattern_timed [:as,:f,:as,:a], [0.5],release: 0.02, amp: 0.3  #
  end
end
use_bpm 180
sample :elec_hi_snare
sleep 0.5
sample :elec_hi_snare
sleep 0.5
sample :drum_bass_hard
sleep 0.5

use_transpose -0
use_synth :saw
2.times do
  play_pattern_timed [:a,:a,:a,:a], [0.5,1,0.5,1] # 3
  play_pattern_timed [:a,:as,:a], [1,1,1]
  play_pattern_timed [:c5], [3], decay: 2   # 6
  play_pattern_timed [:a,:a,:a,:a], [0.5,1,0.5,1] # 3
  play_pattern_timed [:a,:as,:a], [1,1,1]    # 6
  play_pattern_timed [:f], [3], decay: 2   # 6
end
use_synth :dsaw
play_pattern_timed [:f],[1]
play_pattern_timed [:c5],[2], decay: 1.5
play_pattern_timed [:as,:a,:as],[1,1,1]
play_pattern_timed [:a],[1]
play_pattern_timed [:c5],[2], decay: 1.5
play_pattern_timed [:f],[1]
play_pattern_timed [:c5],[2], decay: 1.5
play_pattern_timed [:as,:a,:as,],[1,1,1]
play_pattern_timed [:a],[1]
play_pattern_timed [:f],[2], decay: 1.5
play_pattern_timed [:f],[1]
play_pattern_timed [:c5],[2], decay: 1.5
play_pattern_timed [:as,:a,:as],[1,1,1]
play_pattern_timed [:a],[1]
play_pattern_timed [:c5],[2], decay: 1.5
play_pattern_timed [:f],[1]
play_pattern_timed [:c5],[2], decay: 1.5
play_pattern_timed [:as,:a,:as,:a],[1,1,1,1]
play_chord [:c4,:f], decay: 4
===========================
------------------------------------------------------------

Comments



More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.