# MIDI and FL Studio help

**URL:** <https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312>\
**Category:** Support, Help & Resources\
**Created:** [August 21, 2020, 8:07pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312 "2020-08-21T20:07:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![reverend-G](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/reverend-g/32/1539_2.png) [@reverend-G](https://in-thread.sonic-pi.net/u/reverend-G)\
**Post date:** [August 21, 2020, 8:07pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/1 "2020-08-21T20:07:34Z")

</div>

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.

 ![Screen Shot 2020-08-21 at 4.02.32 PM](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/1/1f705a1a1d541f4b34d795e7f85dc68f97f44371.png)

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [August 21, 2020, 8:10pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/2 "2020-08-21T20:10:22Z")

</div>

hi,

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

---

<div class="post-metadata">

**Author:** ![reverend-G](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/reverend-g/32/1539_2.png) [@reverend-G](https://in-thread.sonic-pi.net/u/reverend-G)\
**Post date:** [August 21, 2020, 8:36pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/3 "2020-08-21T20:36:23Z")

</div>

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](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/c/c2af76d1345887e50ae46341f1312e99956836b0.png)

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [August 21, 2020, 8:43pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/4 "2020-08-21T20:43:25Z")

</div>

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:

```ruby
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 🙂

---

<div class="post-metadata">

**Author:** ![reverend-G](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/reverend-g/32/1539_2.png) [@reverend-G](https://in-thread.sonic-pi.net/u/reverend-G)\
**Post date:** [August 22, 2020, 6:41pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/5 "2020-08-22T18:41:02Z")

</div>

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"`

---

<div class="post-metadata">

**Author:** ![emlyn](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/emlyn/32/1460_2.png) [@emlyn](https://in-thread.sonic-pi.net/u/emlyn)\
**Post date:** [August 22, 2020, 7:26pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/6 "2020-08-22T19:26:16Z")

</div>

I’m not sure what the issue is, but when I’ve run into similar problems I’ve found [Midi Monitor](https://www.snoize.com/MIDIMonitor/) to be useful to look at exactly what midi message are being sent.

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [August 22, 2020, 11:53pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/7 "2020-08-22T23:53:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![reverend-G](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/reverend-g/32/1539_2.png) [@reverend-G](https://in-thread.sonic-pi.net/u/reverend-G)\
**Post date:** [August 23, 2020, 3:27pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/8 "2020-08-23T15:27:01Z")

</div>

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'
```

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [August 23, 2020, 4:02pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/9 "2020-08-23T16:02:40Z")

</div>

Try 0.5 instead of .5 🙂

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [August 23, 2020, 4:10pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/10 "2020-08-23T16:10:09Z")

</div>

> [@reverend-G](#):
>
> ```ruby
> workspace_zero:34: no .<digit> floating literal anymore; put 0 before dot
> sleep .5
> 
> ```

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.

---

<div class="post-metadata">

**Author:** ![reverend-G](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/reverend-g/32/1539_2.png) [@reverend-G](https://in-thread.sonic-pi.net/u/reverend-G)\
**Post date:** [August 23, 2020, 5:11pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/11 "2020-08-23T17:11:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![reverend-G](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/reverend-g/32/1539_2.png) [@reverend-G](https://in-thread.sonic-pi.net/u/reverend-G)\
**Post date:** [August 23, 2020, 5:21pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/12 "2020-08-23T17:21:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![emlyn](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/emlyn/32/1460_2.png) [@emlyn](https://in-thread.sonic-pi.net/u/emlyn)\
**Post date:** [August 23, 2020, 6:02pm UTC](https://in-thread.sonic-pi.net/t/midi-and-fl-studio-help/4312/13 "2020-08-23T18:02:56Z")

</div>

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.
