hi everyone I’ve written this drum pattern with audio samples
“”"
live_loop :drums do
use_bpm 140
if spread(2,3).tick
sample “/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/handpan test 140/drum samples/BDE04DDK.aif”
end
if spread(2,8).look
sample “/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/handpan test 140/drum samples/IL02-ECA_Hrd.aif”
end
if spread(2,12).look
sample “/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/handpan test 140/drum samples/IL02-Hnd_Hr2_02.aif”
end
if spread(1,7).look
sample “/Users/soundwarrior/Documents/reaper personal/projects/sound warrior/handpan test 140/drum samples/IL02-HH_ASIA_OPN_02.aif”
end
sleep 0.8
end
live_loop :handpan do
set :seed, 0
use_bpm 140
set :seed, (get(:seed) + 971) if tick % 16 == 0
use_random_seed get(:seed)
8.times do
midi scale(:c3, :minor_pentatonic).choose, sustain: 0.1,channel: 3
sleep 0.8
end
end
I want to convert it to midi so I wrote this
“”"
live_loop :drums do
use_bpm 140
if spread(2,3).tick
midi :a0, channel: 10
end
if spread(2,8).look
midi :g1, channel: 10
end
if spread(2,12).look
midi :f2, channel: 10
end
if spread(1,7).look
midi :e3, channel: 10
end
sleep 0.8
end
however the midi code won’t play I have reaper set up correctly to receive midi from sonic pi but the code is not working does anyone know why?
your help with this question would be most welcome, kind regards trey.
I tried your midi code on my Mac, driving qsynth, looping the audio output back to Sonic Pi with a live_audio input and it worked fine, so I think that your problem lies in the setup with reaper.
The only other thing I can think of is that the midi command in fact sends a midi_on followed by a midi_off, by default 1 beat apart (1s at 60bpm). With your settings the next “note” is sent before the previous one ends. With percussive notes it is probably OK, but try adding a sustain value of say 0.4.
eg. midi :e3,sustain: 0.4, channel: 10
The 0.4 is jhalf your loop time of 0.8
You could also use midi defaults for this and the channel:
use_midi_defaults channel: 10, sustain: 0.4
The program that worked on my mac was:
use_midi_defaults port: "fluidsynth_virtual_port_(qsynth)", channel: 10, sustain: 0.4
live_loop :drums do
use_bpm 140
if spread(2,3).tick
midi :a0
end
if spread(2,8).look
midi :g1
end
if spread(2,12).look
midi :f2
end
if spread(1,7).look
midi :e3
end
sleep 0.8
end
live_audio :qsynth_in,stereo: true #audio from qsynth fed back to Sonic Pi
thanks for this I’ll do some more tests and update the thread when I know more.
something interesting I tried to trigger reapers sampler with this code: “”"
live_loop : gen do
set :seed, 0
use_bpm 140
set :seed, (get(:seed) + 971) if tick % 16 == 0
use_random_seed get(:seed)
8.times do
midi scale(:c3, :minor_pentatonic).choose, sustain: 0.1,channel: 1
sleep 1
end
end
the input in reaper was set to the iac buss and last time I tried the code it worked no problem so I looked in the audio midi settings iac buss online so I’ve know idea whats going on.
Does it (iac_bus)appear in the list of midi devices on SP? Depending on the order in which you set things up, remember that SP on a Mac doesn’t react automatically to changes in Midi Configuration. You have to click the Reset Midi button on Sonic Pi IO Prefs for it to pick up the changes.
On the audio side, Sonic Pi uses the default audio in and audio out selected on the Mac. If you change these, you have to restart Sonic Pi for it to pick up the changes.