# 240121 0009 On My Love - by Zara Larsson and David Guetta in Sonic Pi
# Saved 240121 0009
# https://in-thread.sonic-pi.net/t/on-my-love-by-zara-larsson-and-david-guetta-in-sonic-pi/8560
# Original https://www.youtube.com/watch?v=Gudx8Bvnqsg
# My cover with Sonic Pi https://youtu.be/9cCqlP-fEtc
set_volume! 3
use_bpm 123#123
with_fx :ixi_techno, phase: 32, mix: 0.4 do
with_fx :reverb, room: 0.4, mix: 0.2 do
live_loop :a1 do
tick
/ kick /
sample :bd_fat, amp: 2 if spread(1,4).look
/ patterns for piano and bass /
# Midi piano https://www.youtube.com/watch?v=M9U-Gc6q_qw
# Sheet music https://www.sachinsen.com/product-page/on-my-love-sheet-music-midi
t = :c4
u = :cs4
x = :ds4
y = :f4
z = :as3
n = nil
g = :gs4
h = :as4
p = 32
pattern = knit(1,p, 2,p, 3,p, 4,p).look
#pattern = 4
case pattern
when 0
when 1
puts '1' if spread(1,32).look
b = :as3
# |1 2 3 4 5 6 |7 8 9 10 11
top = [t,n,n, u,n,n, u,n,n, u,n,n, t,n,n, u,n,n, u,n,n, u,n,n, x,n,n, x,n,n, x,n]
top2 = [nil]
amp = [1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0]
bass = [b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n]
when 2
puts '2' if spread(1,32).look
b = :cs3
top = [x,n,n, y,n,n, y,n,n, y,n,n, x,n,n, y,n,n, y,n,n, y,n,n, z,n,n, z,n,n, t,n]
top2 = [nil]
amp = [1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0]
bass = [b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n]
when 3
puts '3' if spread(1,32).look
b = :fs3
top = [g,n,n, h,n,n, h,n,n, h,n,n, g,n,n, h,n,n, h,n,n, h,n,n, g,n,n, h,n,n, h,n]
top2 = [nil]
amp = [1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0]
bass = [b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n]
when 4
puts '4' if spread(1,32).look
b = knit(:ds3,24, :gs3, 8).look
top = [g,n,n, h,n,n, h,n,n, h,n,n, g,n,n, h,n,n, h,n,n, h,n,n, g,n,n, h,n,n, h,n]
top2 = [n,n,n, n,n,n, n,n,n, n,n,n, n,n,n, n,n,n, n,n,n, n,n,n, t,n,n, t,n,n, t,n]
amp = [1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0]
bass = [b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n,n, b,n]
end
/ top piano and saw /
oct = knit(0,32*4, -12,32*4).look
#oct = 0
#oct = -12
cu = line(60,90,steps: 128).mirror.look
use_synth :piano
use_synth_defaults release: [0.2,0.25,0.3].choose-0.12, cutoff: cu-30, amp: amp.look
play top.look+12+oct, pan: rdist(0.25)
play top2.look+12+oct, pan: rdist(0.25)
play bass.look+oct, pan: 0.5
/bass/
oct = 0
use_synth :saw
use_synth_defaults release: [0.2,0.25,0.3].choose, cutoff: cu-10, amp: amp.look
play bass.look-12+oct+0.1, pan: 0.5
play bass.look-12+oct, pan: -0.5
sleep 0.25
end
end
end
# Hydra code for visuals
# https://hydra.ojack.xyz/?code=JTJGJTJGczEuaW5pdFNjcmVlbigpJTBBJTIwJTIwJTBBc3JjKHMxKSUwQS5waXhlbGF0ZSgxNjAqMiUyQzkwKjIpJTBBJTJGJTJGLnBpeGVsYXRlKCU1QjE2KjQlMkM5KjQlNUQuZmFzdCgyKSUyQyU1QjIwJTJDNTAwJTVELnNtb290aCgpLmZhc3QoMykpJTBBLmx1bWEoMC4yKSUwQS5pbnZlcnQoLTUpJTIwJTJGJTJGTk8lMEEubW9kdWxhdGUoc3JjKHMxKSUyQ01hdGgudGFuKHRpbWUqMTApKSUwQSUyRiUyRi5yb3RhdGUoMCUyQzAuMSklMEElMkYlMkYua2FsZWlkKDQpJTBBJTJGJTJGLnJvdGF0ZSgwJTJDMC4xKSUwQS5zY2FsZSgxKSUwQSUyRiUyRi5zY2FsZSgyKSUwQSUyRiUyRi5zY3JvbGxZKDAlMkMlNUIwLjAyJTJDLTAuMDEqdGltZSUyRjEwMCUyQzAuMDElNUQpJTBBJTJGJTJGLnNjcm9sbFgoMCUyQyU1Qi0wLjAyKnRpbWUlMkYxMDAwJTJDMC4wMSUyQzAuMDMlNUQpJTBBJTJGJTJGLmNvbG9yYW1hKDElMkMwJTJDMCklMjAlMkYlMkZ0aGluJTIwb3IlMjB0aGljayUwQSUyRiUyRi5jb2xvcmFtYSgwLjQlMkMtMTAlMkMwKSUyMCUyRiUyRk5PJTBBJTJGJTJGLnRocmVzaCgwLjI2KSUyMCUyRiUyRmIlMjZ3JTIwb3IlMjBjb2xvciUwQS5tYXNrKHNoYXBlKDIlMkMwLjgpLnNjYWxlKDElMkM5JTJGMTYpKSUwQS5vdXQoKSUwQQ%3D%3D
Hydra visuals
//s1.initScreen()
src(s1)
.pixelate(160*2,90*2)
//.pixelate([16*4,9*4].fast(2),[20,500].smooth().fast(3))
.luma(0.2)
.invert(-5) //NO
.modulate(src(s1),Math.tan(time*10))
//.rotate(0,0.1)
//.kaleid(4)
//.rotate(0,0.1)
.scale(1)
//.scale(2)
//.scrollY(0,[0.02,-0.01*time/100,0.01])
//.scrollX(0,[-0.02*time/1000,0.01,0.03])
//.colorama(1,0,0) //thin or thick
//.colorama(0.4,-10,0) //NO
//.thresh(0.26) //b&w or color
.mask(shape(2,0.8).scale(1,9/16))
.out()