Hi Sonic Pi’ers, you’re probably sick of seeing my tunes in here by now
I’ve been playing about with alternative tunings recently, and came up with the below (which is in 12-19 TET).
The Soundcloud version is different to the in_thread version below, because I stripped out a few external samples and effects etc, so that you can hopefully copy and paste straight into SP, and hit run.
# Title: Edu-19 (disquiet0456) in_thread edit
# Artist: Binarysweets
# Date: September 2020
# License: cc-by 4.0
# Sonic Pi v3.2.2 (Win 10)
# Settings
use_bpm 100
bar_length = 32
use_random_seed 1
swing = (ring 0.01, -0.01)
# Functions
define :micro_tune do |note, is_sample|
# 12 out of 19-tET
cents = [0,
63.15,
189.47,
252.63,
378.94,
505.26,
568.42,
694.73,
757.89,
884.21,
947.36,
1073.68]
tuned_notes = []
idx = 0
scale_length = 12
if !note.kind_of?(Integer)
note.each do |n|
idx = n - (scale_length * (n / scale_length))
tuned_notes.push(n + (cents[idx] - (idx * 100)) / 100)
end
else
idx = note - (scale_length * (note / scale_length))
tuned_notes.push(note + (cents[idx] - (idx * 100)) / 100)
end
if is_sample
return (cents[idx] - (idx * 100)) / 100
else
return tuned_notes
end
end
define :bar do
sleep bar_length
end
# Loops
define :lew do
in_thread do
idx = get[:lew_counter]
steps = scale(:a2, :chromatic)
(bar_length).times do ; tick
idx = idx + 1
play micro_tune(steps.tick.to_i, false), amp: rrand(0.8, 1),
release: (line 0.125, 1, steps: 64)[idx]
sleep 1 + swing.look
set :lew_counter, idx
end
end
end
define :med do |pattern = 1|
in_thread do
steps = scale(:a3, :chromatic).take(4).repeat(2) +
scale(:a2, :chromatic).take(8).shuffle
with_fx :echo, decay: 4, phase: 0.25, mix: 0.2 do
with_fx :bitcrusher, bits: 4 do
(bar_length * 2).times do ; tick
with_synth :blade do
play micro_tune(steps.tick.to_i, false), amp: rrand(0.8, 1.0),
release: (line 0.125, 0.5, steps: bar_length).look
end
sleep 0.5 + swing.look
end
end
end
end
end
define :chrds do |pattern = 1|
in_thread do
slp = 4 if pattern == 1
slp = 8 if pattern == 2
(bar_length / slp).times do ; tick
with_synth :square do
with_fx :echo, phase: 0.5, decay: 16, mix: 0.5 do
play micro_tune((chord_degree (ring 1,3,5,1,3,5,9).look, :a3, :chromatic).look, false),
decay: 2, env_curve: 2, release: 4, sustain: 2, amp: rrand(0.12, 0.14)
end
end
sleep slp + swing.look
end
end
end
define :bass do
in_thread do
scl = scale(:a1, :chromatic)
sleeps = (ring 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 0.25, 0.25, 0.5)
notes = (ring scl[0], scl[1], scl[0], scl[1], scl[0], scl[1], scl[2], scl[2],
scl[2], scl[2], scl[4], scl[5], scl[5], scl[6], scl[7], scl[9])
(bar_length).times do ; tick
with_synth :tri do
if one_in(8)
with_fx :echo, decay: 4, phase: 0.125 do
play micro_tune(notes.look, false), amp: rrand(0.7, 0.9),
release: sleeps.look, pan: -0.3
end
else
play micro_tune(notes.look, false), amp: rrand(0.7, 0.9),
release: sleeps.look, pan: 0.2
end
end
sleep sleeps.look
end
end
end
define :drm_noise do
in_thread do
s = :loop_compus
s_length = 50.76
pattern = (ring 1,0,3,0,1,3,3,1, 1,0,3,0,4,2,4,1).repeat(3) +
(ring 1,0,2,0,1,3,3,1, 1,0,3,0,4,3,4,1).reverse
with_fx :eq, mid_note: 60, mid: -1 do
(bar_length * 4).times do ; tick
start = 3.26 if pattern.look == 1
start = 17.03 if pattern.look == 2
start = 17.76 if pattern.look == 3
start = 25.09 if pattern.look == 4
with_fx :octaver do
with_fx :ping_pong do
sample s, start: start / s_length, finish: (start + 0.66) / s_length,
amp: rrand(2.8, 2.9), rate: -1 if pattern.look > 0
end
end
sleep 0.25 + swing.look
end
end
end
end
# Reset globals
set :lew_counter, 0
# Structure
with_fx :compressor, threshold: 0.4 do
lew ; bar
lew ; med ; bar
bass ; drm_noise ; bar
bass ; drm_noise ; lew ; bar
bass ; drm_noise ; lew ; chrds ; bar
bass ; drm_noise ; lew ; chrds 2 ; med ;bar
bass ; drm_noise ; lew ; bar
drm_noise ; lew ; bar
end