Hello!
First, let me say thank you for sonic pi: It sweetened my last month, and I have a hard time to put it aside. Even at office, where I should do other stuff.
Ok, my problem is this:
I got two identical midi controllers, one at the office (win10), and one at home (osx). They both use the same live_loop to get the midi_notes. It seemed to work fine at home, but when I tried the today program at office, the behaviour was … unexpected.
ok, this is the setting:
I got a button on my midi-controller, that sends out two notes. One for the selected mode, and one for the actual button push.
It looks like this on the controller - in case you wonder -:
[] CUE (led/midi65)
[] LOOP (led/midi66)
[x] SAMPLE (led/midi67)
[button midi9]
with x being a lit led. So note 65,66 and 67 tell me what the selected item is.
Looks like this in cues-log:
/midi/dj_tech_dj_for_all/3/1/note_on [9, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [67, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [9, 0]
/midi/dj_tech_dj_for_all/3/1/note_on [9, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [65, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [9, 0]
/midi/dj_tech_dj_for_all/3/1/note_on [9, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [66, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [9, 0]
/midi/dj_tech_dj_for_all/3/1/note_on [9, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [67, 127]
/midi/dj_tech_dj_for_all/3/1/note_on [9, 0]
I get two notes with v127 for every button-down of button 9, and one v0 for the button9-up.
This is the code:
DJ Tech Dj for all test
midi_connection_note = “/midi/dj_tech_dj_for_all///note_on”
live_loop :INGOInput do
#use_real_time
n,v = sync midi_connection_note
puts n
if v == 127 then
case n
# wemnn sequenz läuft, dann laut spielsheibe ton abspielen
# wirklich sichern erst bei loslassen
when 65 # SAMPLE, im Edit-mode
puts "SET SAMPLE MODE"
set :mode, :mode_sample
when 67 # CUE, im Edit-mode
puts "SET TON MODE"
set :mode, :mode_TON
when 66 # LOOP, im Edit-mode
puts "SET LOOP MODE"
set :mode, :mode_LOOP
end
end
# sleep 0.01
end
This code does very nice switching between the modes on my home-pc. Never looked back, because it just worked.
But at office, it does not work.
When I push the button, it puts out 9s with every button press, but it rarely goes into the case. Just in about 1 out of 10 times.
I dont understand why.
when to use n,v= get midi, and when to use n,v = sync midi?
I really dont understand why my code does not work …