MIDI and FL Studio help

Hello. I am new to coding and Sonic Pi. I have been using FL Studio for years. I should note that I am working on a Mac. Through the Mac MIDI set up I was able to connect Sonic Pi to FLS. However it is not behaving the way I imagined. FLS only plays whatever channel I happen to have selected no matter what MIDI channel I am telling Sonic Pi to play. I was hoping I could have Sonic Pi playing to several MIDI channels in FLS (bass, lead, drums, etc).

Is this a problem with my MIDI settings or my understanding of how MIDI works? I have attached screen shots of my FLS MIDI settings.

hi,

i don’t know FL studio but could you post your sonic pi code ?

This is all I have so far just to test it out.

live_loop :midi_piano do
midi_note_on :c3, channel: 1
sleep .2
midi_note_on :c3, channel: 1
sleep .2
midi_note_on :f3, channel: 1
sleep .2
midi_note_on :g3, channel: 1
end

If it helps here is my Sonic Pi IO settings.

Screen Shot 2020-08-21 at 4.05.40 PM

Hi @reverend-G,

welcome to our forums! Hopefully we can get you over this hurdle and up and running as soon as possible.

I’m not quite sure yet what your issue is - it could either be with Sonic Pi or FL.

One thing I do notice though is that you’re just using midi_note_on without a following midi_note_off. Your code when looped is essuentially like an infinite series of fingers pressing an infinite series of piano notes and not letting go.

The typical option here is to call midi which automatically calls midi_note_off after 1 second (which can be modified with the sustain: opt). Alternatively, you can manually call midi_note_off for very specific levels of control.

Also of note, if you don’t specify a port: to your call to midi_* then the message will be sent to all MIDI outputs, so in your case:

  • iac_driver_fl_studio
  • iac_driver_sonic_pi
  • network_sonic_pi

If you just want to send to one port (such as iac_driver_fl_studio) then you need to specify that explicitly:

midi :g3, channel: 1, port: "iac_driver_fl_studio"

I’m not sure if either of these will fix your issue, but it’s worth getting them sorted now :slight_smile:

I’m completely stumped. Now I have no sound at all. I have not changed any settings. Sonic Pi is receiving MIDI from FLS, but not sending anything. Here is my code.

midi :c3, channel: 1, port: "iac_driver_fl_studio"

I’m not sure what the issue is, but when I’ve run into similar problems I’ve found Midi Monitor to be useful to look at exactly what midi message are being sent.

Maybe try to put your code into a loop with a sleep to give sonic pi time to send the midi message.
Could you send us a video via YouTube as example. You can try to use another software, helm a free synth and see if helm can receive midi notes

Here is my current code:

live_loop :midi_piano do
  midi :c3, channel: 1, port: "iac_driver_fl_studio"
  sleep .5
  midi :c3, channel: 1, port: "iac_driver_fl_studio"
  sleep .5
  midi :c3, channel: 1, port: "iac_driver_fl_studio"
  sleep .5
  midi :c3, channel: 1, port: "iac_driver_fl_studio"
end

I get the following error:

Runtime Error: [buffer 0, line 781] - SyntaxError
Thread death!
 workspace_zero:30: no .<digit> floating literal anymore; put 0 before dot
  sleep .5
        ^~
workspace_zero:32: no .<digit> floating literal anymore; put 0 before dot
  sleep .5
        ^~
workspace_zero:34: no .<digit> floating literal anymore; put 0 before dot
  sleep .5
        ^~
/Applications/Sonic Pi.app/Contents/Resources/app/server/ruby/lib/sonicpi/runtime.rb:781:in `eval'
/Applications/Sonic Pi.app/Contents/Resources/app/server/ruby/lib/sonicpi/runtime.rb:781:in `block (2 levels) in __spider_eval'
/Applications/Sonic Pi.app/Contents/Resources/app/server/ruby/lib/sonicpi/runtime.rb:1042:in `block (2 levels) in __in_thread'

Try 0.5 instead of .5 :slight_smile:

1 Like

Sorry the error isn’t more obvious but if you read carefully you should hopefully see that you need to use 0.5 as mentioned by @nlb.

OK, my loop plays, but still no sound in FL. I used @emlyn’s suggestion and installed MIDI Monitor. It shows the source s being from iac_driver_fl_studio. Shouldn’t the source be iac_driver_sonic_pi?

I got it. I changed the port in the code to “iac_driver_sonic_pi”. Now to learn to send to multiple channels. Thanks everybody.

3 Likes

If you want to send the same thing to all channels, the easiest way is probably to leave off the channel: param, then I believe it will send the note to every channel.
But it may be better to call midi multiple times, one for each channel you want to send to, that way you get full control of what gets sent to each channel.

1 Like