hi everyone I hope your all well
if I have sonic pi running thru an audio device with multiple outputs and I have a few live loops in a project how can I get each loop to run through a different audio output? your help with this question would be most welcome, kind regards trey.
hi thanks for your help so I have the following code:
“”"
live_loop :kick do
use_bpm 140
if ring(:true, :true, :true, :true).tick
sample “/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_kick-classic_bitleash.wav”
end
sleep 1
end
live_loop :snare do
use_bpm 140
sync :kick
if ring(:false, :true, :false, :true).look
sample “/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/909 Snare.wav”
end
sleep 1
end
live_loop :hh do
use_bpm 140
sync :kick
if ring(:true, :true, :true, :false).tick
sample “/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_hi-hat_acutran-b.wav”
end
sleep 1
end
how would I get those live loops to different outputs of my sound card? I red the tutorial but if some one could make a real world sample from these that would be great thanks
Hi @soundwarrior, did you fix this?
If you go bottom of log @ %userprofile%\.sonic-pi\log\scsynth.log
you can see the devices and the outputs, which may help with :sound_out
config.
Let’s keep it simple and assume your default device is the sound card you want to target, and has multiple outputs, and we’re targeting each individually, in mono.
by default, the :sound_out FX outputs a mono mix of the stereo input to a specific channel
with_fx :sound_out, output: 1
sample :bd_haus
end
If you simply want some loops to go to one channel and other loops to another, this may work:
NB: As you’re using external samples I moved these, for easier adjusting, to :symbols
To pass a sample’s path (that’s a symbol) to the sample
method you need to use set
and get
(check the docs for examples - type
set
then press “ctrl+i”)
To avoid having to write sample get[:sample_path]
every time, I wrapped it up in a sampl
method, then edited the code and ran to make sure it worked.
your code rewritten WITHOUT :sound_out
#your_sample_paths
##| set :k,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_kick-classic_bitleash.wav”
##| set :s,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/909 Snare.wav”
##| set :h,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_hi-hat_acutran-b.wav”
set :k, :drum_heavy_kick
set :s, :drum_snare_hard
set :h, :hat_snap
define :sampl do |sam|
sample get[sam]
end
live_loop :kick do
use_bpm 140
if ring(:true, :true, :true, :true).tick
sampl :k
end
sleep 1
end
live_loop :snare do
use_bpm 140
sync :kick
if ring(:false, :true, :false, :true).look
sampl :s
end
sleep 1
end
live_loop :hh do
use_bpm 140
sync :kick
if ring(:true, :true, :true, :false).tick
sampl :h
end
sleep 1
end
Then to add the :sound_out to make loops go to particular outputs you can wrap as required
#your_sample_paths
##| set :k,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_kick-classic_bitleash.wav”
##| set :s,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/909 Snare.wav”
##| set :h,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_hi-hat_acutran-b.wav”
set :k, :drum_heavy_kick
set :s, :drum_snare_hard
set :h, :hat_snap
define :sampl do |sam|
sample get[sam]
end
live_loop :kick do
use_bpm 140
if ring(:true, :true, :true, :true).tick
with_fx :sound_out, output: 1 do
sampl :k
end
end
sleep 1
end
live_loop :snare do
use_bpm 140
sync :kick
if ring(:false, :true, :false, :true).look
with_fx :sound_out, output: 2 do
sampl :s
end
end
sleep 1
end
live_loop :hh do
use_bpm 140
sync :kick
if ring(:true, :true, :true, :false).tick
with_fx :sound_out output: 2 do
sampl :h
end
end
sleep 1
end
You may notice there’s some repetition of code there.
You may also notice that the default output:
option is 1 , so that doesn’t need writing explcitly…
One last rewrite, to make the sampl
method also control the output, we can do something like this
#add default value to out argument
define :sampl do |sam, out = 1|
with_fx :sound_out, output: out do
sample get[sam]
end
end
Then whenever you want a sample to go to a different output you can just add that option… Here’s the version that shows this.
#your_sample_paths
##| set :k,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_kick-classic_bitleash.wav”
##| set :s,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/909 Snare.wav”
##| set :h,“/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/delay rave 140/delay rave drum samples/dt02_hi-hat_acutran-b.wav”
set :k, :drum_heavy_kick
set :s, :drum_snare_hard
set :h, :hat_snap
define :sampl do |sam, out = 1|
with_fx :sound_out, output: out do
sample get[sam]
end
end
live_loop :kick do
use_bpm 140
if ring(:true, :true, :true, :true).tick
sampl :k #no option provided so out=default(1)
end
sleep 1
end
live_loop :snare do
use_bpm 140
sync :kick
if ring(:false, :true, :false, :true).look
sampl :s, 2 #output to channel 2
end
sleep 1
end
live_loop :hh do
use_bpm 140
sync :kick
if ring(:true, :true, :true, :false).tick
sampl :h #channel 1
end
sleep 1
end
Hope this helps someone!