I make a lot of chiptune with SP, even though its most well-known use is the bland genre known as dub techno. I decided to release some of my secrets on here (first post here, too!) because we’re all programmers here anyway, and SP is open-source, so we should be too.
# initializing stuff. t = true f = false #Sequencer for :bd. 3 measures, 4/4. bdSeq = (bools 1,1,1,0, 1,0,1,1, 1,1,0,0) #HiHat sequencer. hhSeq = (bools 1,1,0,1, 0,0,1,1, 0,1,1,0) #Kickdrum sequencer kiSeq = (bools 1,1,1,1, 1,1,1,1, 1,1,1,1) bdOn = t hhOn = t kiOn = t use_bpm 120 with_fx :bitcrusher, bits: 4 do live_loop :bd do if (bdSeq.tick) and (bdOn) then sample :bd_haus, amp: 2 end sleep 1 end sleep 5 live_loop :hh do if (hhSeq.tick) and (hhOn) then sample :drum_cymbal_pedal end sleep 1 end sleep 2 live_loop :kik do if (kiSeq.tick) and (kiOn) then sample :drum_heavy_kick, amp: 1.25 end sleep 1.5 end end
This first bit (heh, heh) is, obviously, the drumkit. It’s in 4-bit, but 6- or 8-bit works better if you want to make higher-rez chip.
It includes a sequencer for each drum in the kit, which you can fiddle with to change the beat.
use_bpm 120 melody = [:bb4, :c4, :a4, nil, :b4].ring melody2 = [:c4, :eb3, :as4, nil, :cs4].ring with_fx :bitcrusher, bits: 4 do live_loop :bass do synth :chipbass, note: melody.tick, amp: 0.5 sleep 1 end live_loop :syn do synth :mod_pulse, note: melody2.tick, amp: 0.35, mod_phase: 0.25, pulse_width: 0.125 sleep 0.5 end end
The second portion is the melody and an arp-y additional melody. I tried the :tri and :dtri synths, but :tri was too loud, even at 50% amplitude, and :dtri just sounded weird with this particular melody. Obviously, you can change all of the settings and opts, but this is what I used in a track that I’m going to release on SoundCloud later today.
use_bpm 120 with_fx :bitcrusher do live_loop :needleArp do t = Time.now.to_i use_random_seed t synth :mod_tri, note: rrand_i(55, 70), attack: 1, release: 1, mod_phase: 0.25, amp: 0.25, pulse_width: 0.125 t += rrand_i(1, 4) use_random_seed t sleep 1.5 end end
This final portion is a true needle arp. It uses the :mod_tri synth (triangle = standard in needles), although depending on your track you can make it faster or slower by modifying the mod_phase opt.
You can put these in one buffer or in many. To change timing between threads/live loops, you can put a simple “sleep” line between threads. This works because the steps of a thread are run at the same time as the steps after that thread, allowing a pause before the next thread starts.