Hi,
Have some fun with sonic pi to prepare some sessions for pupils. The goal : play with samples.
So i met an issue if tempo is higher.
# nlb - 01/07/2020
# small sequencer with samples
#
# définir quel sample pour chaque instrument
# set up samples
drums_bd = :drum_heavy_kick
drums_sn = :loop_breakbeat
drums_hithat = :loop_amen
drums_voice = :loop_3d_printer
# S'assurer que les samples sont bien chargés en mémoire
# to load samples to be sure they are loaded :-)
load_sample drums_bd
load_sample drums_sn
load_sample drums_hithat
load_sample drums_voice
# methodes pour jouer chaque instrument
# methods to play each instrument with fx if wanted
define :drums_bd_play do
sample drums_bd, sustain: 0.25, amp:3, compress:1
end
define :drums_sn_play do
with_fx :reverb do
sample drums_sn, start: 0.25, finish: 0.5, amp: 3
end
end
define :drums_hithat_play do
with_fx :hpf, cutoff: 110 do
sample drums_hithat, sustain: 0.1, release:0.15,
start: 0.1, end: 0.25,
amp: [4, 2, 3, 1.5].tick('vol')
end
end
define :drums_voice_play do
sample drums_voice, slice: [2, 7].tick("foo"), num_slices: 8, finish: 0.25
end
# bpm = 60 >> no problem
# bpm = 120 >> issues... :-(
use_bpm 60
bd_pattern = (ring 1, 1, 0, 0, 0, 0,0, 0, 1, 0, 1, 0, 1, 0, 0, 0)
sn_pattern = (ring 0, 0, 0, 0, 1, 0,0, 0, 0, 0, 0, 0, 1, 0, 0, 1)
hithat_pattern = (ring 1, 0, 1, 0)
voice_pattern = (spread 4,7)
##| voice_pattern = (knit false, 1, true,2, false,1, true,2, false,4, true,1, false,3)
live_loop :sequencer do
tick
bd_on = bd_pattern.look
sn_on = sn_pattern.look
hithat_on = hithat_pattern.look
voice_on = voice_pattern.look
with_fx :lpf, cutoff: 60, mix: 0.5, pre_amp:1 do
drums_bd_play if bd_on==1
end
drums_sn_play if sn_on==1
drums_hithat_play if hithat_on==1
drums_voice_play if voice_on # spread send back us true or false
sleep 0.25
end
If i set tempo to 120, bim bam boum
{run: 73, time: 0.0, thread: :live_loop_sequencer}
├─ sample "C:/Program Files/Sonic Pi/etc/samples",
│ "drum_heavy_kick.flac", {sustain: 0.25, amp: 3, compress: 1}
├─ sample "C:/Program Files/Sonic Pi/etc/samples",
│ "loop_amen.flac", {sustain: 0.1, release: 0.15, start: 0.1, end: 0.25, amp: 4}
└─ sample "C:/Program Files/Sonic Pi/etc/samples",
"loop_3d_printer.flac", {slice: 2, num_slices: 8, finish: 0.2813, start: 0.25}
{run: 73, time: 0.125, thread: :live_loop_sequencer}
├─ Timing warning: running slightly behind...
└─ sample "C:/Program Files/Sonic Pi/etc/samples",
"drum_heavy_kick.flac", {sustain: 0.25, amp: 3, compress: 1}
{run: 73, time: 0.25, thread: :live_loop_sequencer}
├─ Timing warning: running slightly behind...
├─ sample "C:/Program Files/Sonic Pi/etc/samples",
│ "loop_amen.flac", {sustain: 0.1, release: 0.15, start: 0.1, end: 0.25, amp: 2}
└─ !! Out of time, skipping: sample "C:/Program Files/Sonic Pi/etc/samples/loop_3d_printer.flac", {slice: 7, num_slices: 8, finish: 0.9063, start: 0.875}
{run: 73, time: 0.375, thread: :live_loop_sequencer}
└─ Timing warning: running slightly behind...
=> Completed run 72
{run: 73, time: 0.5, thread: :live_loop_sequencer}
├─ Timing warning: running slightly behind...
├─ !! Out of time, skipping: sample "C:/Program Files/Sonic Pi/etc/samples/loop_breakbeat.flac", {start: 0.25, finish: 0.5, amp: 3}
├─ !! Out of time, skipping: sample "C:/Program Files/Sonic Pi/etc/samples/loop_amen.flac", {sustain: 0.1, release: 0.15, start: 0.1, end: 0.25, amp: 3}
└─ !! Out of time, skipping: sample "C:/Program Files/Sonic Pi/etc/samples/loop_3d_printer.flac", {slice: 2, num_slices: 8, finish: 0.2813, start: 0.25}
{run: 73, time: 0.625, thread: :live_loop_sequencer}
└─ Timing error: can't keep up...
{run: 73, time: 0.75, thread: :live_loop_sequencer}
├─ Timing error: can't keep up...
├─ !! Out of time, skipping: sample "C:/Program Files/Sonic Pi/etc/samples/loop_amen.flac", {sustain: 0.1, release: 0.15, start: 0.1, end: 0.25, amp: 1.5}
└─ !! Out of time, skipping: sample "C:/Program Files/Sonic Pi/etc/samples/loop_3d_printer.flac", {slice: 7, num_slices: 8, finish: 0.9063, start: 0.875}
Some ideas to resolve that ? What am i doing wrong ?
Cheers