Need help with MIDI in w/controller

OK, I’m trying to get my Arturia Minilab MkII working with Sonic Pi, using Analog Lab 3.

I’m running Windows 10, SP 3.0.1.

So SP does detect the midi controller automatically, but no cue messages are showing up in the log when I play notes on the controller. I am using one of the synth models in Analog Lab.

Should I set SP to listen on a particular port for MIDI? If so, which one?The I/O panel looks like this:

Hi @birv2,

try with checking the “Receive remote OSC messages” checkbox as well. I remember there is/was a bug connecting the OSC settings somehow to Midi. Did the trick in my case a few months ago… (I also have the Minilab, it works flawlessly… but I am under Linux).


Thanks! I can see the cue messages now.

I used this code, modified from the SP tute, and I’m hearing the notes:

live_loop :midicheck do
note, velocity = sync “/midi/arturia_minilab_mkii/0/1/note_on”
synth :piano, note: note, amp: velocity / 127.0

It works, with latency. I added line 2 above (as per the tute), and then the sound stopped completely. So right now I’ve got sound with lag, or no sound.



Hi @birv2,

well, I don’t have an idea about the sound issues. But the latency is probably due to your #use_real_time, which should be commented out. Otherwise you will get the 0.5 seconds latency, which Sonic Pi uses to schedule everything in time. Midi input should be processed in real time. You might check and reduce the latency with set_audio_latency! and/or set_sched_ahead_time!; but this is just some wild guess…

I am quite sure there are other Windows users, who can assist.


Thanks for the reply. I did some googling and found someone here who suggested not using the use_real_time command but instead the set_sched_ahead_time, and then playing with the values. I think I got it down to about .0001 and drastically reduced the latency. Still not bang on, but much better.

But I’m open to other suggestions! I’m a complete n00b with MIDI, so this is all new to me.


The main latency will be produced by the response of your audio card. If you are using the built in Windows sound this will not be great. A good sound card, probably set up for asio driver should give better results. I’m not a Windows user, but possible @samaaron who now uses a windows pc for his live performances may be able to advise.


@robin.newman that is probably the point. I don’t know how Windows behaves. I can get rather decent latency values with my Lenovo x230 with the inbuild card (with Linux).

But: Fact is, if you want to have a low close to unnoticable latency, which is: less or not much more then 10 milliseconds, (and if you are making music with your computer regularly) you’ll probably will want to buy an USB audio interface (such as Focusrite Scarlett MK2 or Steinberg UR22).

Hi @samaaron ,
Is there an update on this. I am on SP 3.3 Beta 5 and I still see a lag when I use this code -
live_loop :a do

note, velocity = sync “/midi:mpkmini2:0:1/note_on”
synth :piano, note: note, amp: 2.0
#play 70, release:0.1

Am I missing something?

@kashyap - what are you specifically looking for an update on? The default Windows audio drivers are usually pretty poor with respect to latency - but a lot can vary depending on your hardware and installed drivers.

Often you can get lower latency if your audio card supports ASIO drivers or if you use ASIO4ALL. If you’re interested in venturing down with playing with this kind of thing, you can now start to experiment with advanced audio tuning by editing the new audio-settings.toml file which is located in the ~/.sonic-pi/config directory (where ~ stands for your home directory).

I am using Windows 10 Surface 3 :frowning: … I did not know that the latency is in the windows audio driver!
Is there an instructions handy to set up ASIO4ALL on windows? I downloaded and installed ASIO4all but am not sure how to make SP use it.

I personally don’t use ASIO4ALL as my sound card has native ASIO drivers. However, it might just be as simple as adding the following to your ~/.sonic-pi/config/audio-settings.toml

sound_card_name = "ASIO4ALL"

Let me know if that helps.

I think SP 3.2.2 does not seem to pick up the audio-settings.toml change. I say this because, when I run 3.3 Beta, I can see the ASIO4ALL show up in the system tray - unfortunately, no sound is produced with ASIO4ALL :(. When I run 3.2.2. however, ASIO4ALL does not show up in the tray.

Apologies for not being clearer. The new config directory only works in v3.3 and above.

Good, that explains it. Any idea on why ASIO4ALL from 3.3 beta does not end up producing any sound at all?

No sorry, I have never used it. Just know that some people have with supercollider.

Perhaps someone else on here might know?