My first but long try ^^
Inspiration :
- SWING & WALKING BASS
- Trap beat for sonic pi
Comments in French
##########################################################################
# Coded by ThemePlard
#
# Suite de 7 accords en do majeur.
#
# Inspiration :
# -SWING & WALKING BASS
# https://davidsfiddleblog.wordpress.com/2017/09/18/swing-walking-bass/
# -Trap beat for sonic pi
# https://gist.github.com/interstar/4ed48718cb44ae6d9715988ae160e3f1
##########################################################################
use_debug false
use_bpm 120 # Définir la vitesse
########################
# Mixage #
########################
set_mixer_control! amp:1 #définir l'amplitude du son global
# Pour finir le morceau en douceur décommenter la ligne ci-dessous, relancer l'execution du script.
# Après la fin recommenter et arrêter l'execution du script.
##| set_mixer_control! amp: 0, amp_slide: 16
org_amp = 1
cym_amp = 0.5
bas_amp = 1
drub_amp = 4
drus_amp = 1.3
tabb_amp = 1.3
tab_amp = 0.4
melo_amp = 0.6
all = (ramp *(line 1,0,steps: 32)).look
########################
# Live sample #
########################
##| sample :ambi_lunar_land, amp: 0.4 # faire Alt +R pour rejouer ce sample pendant le morceau
##:| sample :guit_em9, rate: [0.25, 0.5, -1].choose, amp: 0.6
##| sample :guit_e_slide, rate: [0.25, 0.5, -1].choose
##| sample :guit_e_fifths, rate: [0.25, 0.5, -1].choose
##| sample :guit_harmonics, rate: [0.25, 0.5, -1].choose
########################
# Orgue #
########################
chords = (ring 1, 6, 4, 2, 7, 5, 3) # Suite d'accord en degree
live_loop :harmony do #Début de boucle
with_fx :flanger do #Ajouter un effet flanger
use_synth :sine #choisir un synthétiseur sine
tick # Incrémenter de 1 le tick par defaut et retourne la valeur
4.times do # faire 4 fois
play_chord (chord_degree chords.look, :c3,:major,4), amp: org_amp # Jouer l'accord (4 notes) suivant de la suite chords en do majeur octave 3
sleep 1 # 1 temps avant le prochain son
end
end
end
########################
# Cymbale Swing #
########################
live_loop :swing, delay: 4 do #Début de boucle après 4 temps
sample :drum_cymbal_soft, cutoff: rrand(105, 130), amp: cym_amp #Jouer le sample :drum_cymbal_soft, en modifiant les fréquences aléatoirement(plus naturel) et une amplitude 0.5
sleep (ring 1,0.7,0.3).tick # Swing
end
########################
# WALKING BASS #
########################
live_loop :walking_bass, delay: 32 do
tick
use_synth :fm
play (chord_degree chords.look,
:c2,:major)[0], amp: bas_amp # Jouer la fondamentale de l'accord
sleep 1
play (chord_degree chords.look, :c2, # Jouer une note choisie dans les 5 premières(pas sûr)
:major,5).choose, amp: bas_amp
sleep 1
play (chord_degree chords.look, :c2, # Jouer une note choisie dans le ring
:major)[(ring 1,2,3).choose], amp: bas_amp
sleep 1
play (chord_degree chords[look + 1],
:c2,:major)[0] + (ring -2,-1,1,2).choose, amp: bas_amp # Jouer la fondamentale de l'accord modifier par la valeur choisie dans le ring
sleep 1
end
########################
# Drum #
########################
live_loop :drum, delay: 32 do
x = [0,0,0,1,0,0,0,2,0,0,0,3].choose #Choisir au hasard un des modèles ci-dessous à jouer
case x
when 0
sample :bd_boom, cutoff: rrand(70, 100), amp: drub_amp
sleep 2
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 2
when 1
sample :bd_boom, cutoff: rrand(70, 100), amp: drub_amp
sleep 2
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 1
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 1
when 2
sample :bd_boom, cutoff: rrand(70, 100), amp: drub_amp
sleep 2
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 0.75
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 1.25
when 3
sample :bd_boom, cutoff: rrand(70, 100), amp: drub_amp
sleep 2
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 0.6
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 0.7
sample :drum_snare_soft, cutoff: rrand(100, 120), amp: drus_amp
sleep 0.7
end
end
########################
# Tabla Bass #
########################
live_loop :smpl, delay: 56, sync: :drum do # Boucle syncronisée avec la boucle :drum
#stop
a = [0,0,0,0,1,2,1,2,3,3,3].choose #Choisir au hasard un des modèles ci-dessous à jouer
case a
when 0
sample :tabla_ghe2, cutoff: rrand(70, 100), amp: tabb_amp
sleep 1.5
sample :tabla_ghe4, cutoff: rrand(70, 100), amp: tabb_amp
sleep 2.5
when 1
sample :tabla_ghe2, cutoff: rrand(70, 100), amp: tabb_amp
sleep 0.6
sample :tabla_ghe4, cutoff: rrand(70, 100), amp: tabb_amp
sleep 0.7
sample :tabla_ghe4, cutoff: rrand(70, 100), amp: tabb_amp
sleep 0.7
when 2
sample :tabla_ghe3, cutoff: rrand(70, 100), amp: tabb_amp
sleep 1.5
sample :tabla_ghe4, cutoff: rrand(70, 100), amp: tabb_amp
sleep 0.5
sample :tabla_ghe4, cutoff: rrand(70, 100), amp: tabb_amp
sleep 2
when 3
sample :tabla_ghe2, cutoff: rrand(70, 100), amp: tabb_amp
sleep 1.5
sample :tabla_ghe4, cutoff: rrand(70, 100), amp: tabb_amp
sleep 1.5
sample :tabla_ghe4, cutoff: rrand(70, 100), amp: tabb_amp
sleep 1
end
end
########################
# Tabla #
########################
def hat(v) #création d'une fonction
sample [:tabla_na_o,:tabla_tas1,:tabla_na_s,:tabla_tas2,:tabla_na,:tabla_tas3,:tabla_tun1].choose, cutoff: rrand(60, 120), amp: v
end
live_loop :hats, delay: 56, sync: :swing do
#stop
b = [0,0,0,0,1,2,2,2,3,3].choose #Choisir au hasard un des modèles ci-dessous à jouer
case b
when 0
4.times do
hat(tab_amp)
sleep 0.5
end
when 1
8.times do
hat(tab_amp)
sleep 0.25
end
when 2
2.times do
hat(tab_amp)
sleep 0.3
hat(tab_amp)
sleep 0.3
hat(tab_amp)
sleep 0.4
end
when 3
1.times do
hat(tab_amp)
sleep 0.6
hat(tab_amp)
sleep 0.7
hat(tab_amp)
sleep 0.7
end
end
end
########################
# Mélodie #
########################
def melo(mamp)
chords = (ring 1,1,6,6,4,4,2,2,7,7,5,5,3,3)
use_synth :beep
play (chord_degree chords.look, :c4,:major,4).choose, amp: mamp
end
live_loop :melo, delay: 60 do
with_fx :reverb, room: 1 do
sync :swing
c = [0,0,0,0,1,2,3,3,3,3].choose
case c
when 0
1.times do
melo(melo_amp)
sleep 2
end
when 1
2.times do
melo(melo_amp)
sleep 1
end
when 2
4.times do
melo(melo_amp)
sleep 0.5
end
when 3
1.times do
melo(melo_amp)
sleep (ring 0.6, 0.7, 0.7).look
end
end
end
end