# Midi input timing issues

**URL:** <https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370>\
**Category:** Support, Help & Resources\
**Created:** [January 6, 2022, 8:03pm UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370 "2022-01-06T20:03:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgcorman](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@rgcorman](https://in-thread.sonic-pi.net/u/rgcorman)\
**Post date:** [January 6, 2022, 8:03pm UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/1 "2022-01-06T20:03:32Z")

</div>

I’ve recently discovered sonic pi and very interested in it. I’m both a software engineer and pro keyboard player. I would like to integrate midi input with live coding, as my keyboard chops are strong (compared to my live coding chops).

I did not have a problem running the midi input “live piano loop” in the tutorial. I alleviated the obvious latency issue with use\_real\_time. Latency for single notes is acceptable.

However, when I play a chord, the notes don’t sound at the same time. There is a smearing, as they play more like an arpeggio (very close, but it sounds obviously smeared to me). I’ve coded midi streams in the (distant) past and I understand it is a serial protocol, and all those notes come in a sequence, and timing is implicit as each comes in (therefore the notes of a chord don’t all have the same exact timestamp). However in typical music software the timing is close enough so it sounds like a chord (sounds clean). I think here (with sonic pi) there is too much time lag between the notes, maybe due to how incoming midi is processed?

I’m using windows 10, and understand I can experiment with midi drivers. I also have a macbook air m1 which I use for performance, and I’ll give that a try (although realize sonic pi is not native yet).

Does anyone else run into these issues with midi input?

---

<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:** [January 7, 2022, 10:15am UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/2 "2022-01-07T10:15:59Z")

</div>

hi,

“no code no help” sing again “no no code, no help” on the air “no woman no cry” 'no no code no help"  
🙂

and more details about your set up. Yes everybody has its own set up and it’s terrible but that is life.  
Cheers

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [January 7, 2022, 10:25am UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/3 "2022-01-07T10:25:17Z")

</div>

Hey @rgcorman, thanks for the info so far! 🙂  
What nlb is _trying_ to say 😅 is that it might be useful to help diagnose the issue if you have an example of the code you were trying to run that we could test on our own machines, just in case - plus any extra information about your setup. (Perhaps something like `.sonic-pi/log/scsynth.log` might give us clues about the devices setup and whether some synths are being triggered late for example 🙂)

---

<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:** [January 7, 2022, 10:48am UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/4 "2022-01-07T10:48:51Z")

</div>

> [@ethancrawford](#):
>
> What nlb is _trying_ to say

to sing not to say 🙂 but why “trying” ? It isn’t clear ? too much “direct” that’s your point ? sorry if so 🙂

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [January 7, 2022, 10:55am UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/5 "2022-01-07T10:55:47Z")

</div>

A little, but no big deal! Sometimes I guess it’s harder to convey (or interpret) the intended message with just text! 🤷‍♂️🙂

@rgcorman - hopefully we’ll be able to get to the bottom of your issue for you with just those few extra details 🙂🤞

---

<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:** [January 7, 2022, 11:10am UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/6 "2022-01-07T11:10:39Z")

</div>

> [@ethancrawford](#):
>
> I guess it’s harder to convey (or interpret) the intended message with just text!

it’s a question of generation :-).

---

<div class="post-metadata">

**Author:** ![rgcorman](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@rgcorman](https://in-thread.sonic-pi.net/u/rgcorman)\
**Post date:** [January 11, 2022, 10:40pm UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/7 "2022-01-11T22:40:16Z")

</div>

Thanks you all for responding, I apologize for the delay following up.

I’m just running the midi input live loop from the Tutorial, with my keyboard name substituted.

live\_loop :midi\_piano do  
use\_real\_time  
note, velocity = sync “/midi:arturia\_keylab\_essential\_61\_0:1/note\_on”  
synth :piano, note: note, amp: velocity / 127.0  
end

My setup is a Windows 10 AMD Ryzen 2700 PC, just using sound out through Sennheiser usb headset. The Arturia Keylab Essential 61 keyboard uses USB midi.  
The scsynth.log file:

# Starting SuperCollider 2022-01-06 08:25:39

Device options:

- MME : Microsoft Sound Mapper - Input (device #0 with 2 ins 0 outs)
- MME : Microphone (罗技高清网络摄像机 C930c) (device #1 with 2 ins 0 outs)
- MME : Headset Microphone (Sennheiser (device #2 with 2 ins 0 outs)
- MME : Microsoft Sound Mapper - Output (device #3 with 0 ins 2 outs)
- MME : Headset Earphone (Sennheiser PC (device #4 with 0 ins 2 outs)
- MME : Digital Audio (S/PDIF) (High De (device #5 with 0 ins 2 outs)
- MME : Speakers (PlayOn Virtual Audio (device #6 with 0 ins 2 outs)
- MME : Audials Sound Capturing (Audial (device #7 with 0 ins 6 outs)
- MME : 1 - LG HDR 4K (AMD High Definit (device #8 with 0 ins 2 outs)
- Windows DirectSound : Primary Sound Capture Driver (device #9 with 2 ins 0 outs)
- Windows DirectSound : Microphone (罗技高清网络摄像机 C930c) (device #10 with 2 ins 0 outs)
- Windows DirectSound : Headset Microphone (Sennheiser PC 8.2 USB) (device #11 with 2 ins 0 outs)
- Windows DirectSound : Primary Sound Driver (device #12 with 0 ins 2 outs)
- Windows DirectSound : Headset Earphone (Sennheiser PC 8.2 USB) (device #13 with 0 ins 2 outs)
- Windows DirectSound : Digital Audio (S/PDIF) (High Definition Audio Device) (device #14 with 0 ins 2 outs)
- Windows DirectSound : Speakers (PlayOn Virtual Audio Device) (device #15 with 0 ins 2 outs)
- Windows DirectSound : Audials Sound Capturing (Audials Sound Capturing) (device #16 with 0 ins 6 outs)
- Windows DirectSound : 1 - LG HDR 4K (AMD High Definition Audio Device) (device #17 with 0 ins 2 outs)
- Windows WASAPI : Digital Audio (S/PDIF) (High Definition Audio Device) (device #18 with 0 ins 2 outs)
- Windows WASAPI : Speakers (PlayOn Virtual Audio Device) (device #19 with 0 ins 2 outs)
- Windows WASAPI : Audials Sound Capturing (Audials Sound Capturing) (device #20 with 0 ins 2 outs)
- Windows WASAPI : Headset Earphone (Sennheiser PC 8.2 USB) (device #21 with 0 ins 2 outs)
- Windows WASAPI : 1 - LG HDR 4K (AMD High Definition Audio Device) (device #22 with 0 ins 2 outs)
- Windows WASAPI : Microphone (罗技高清网络摄像机 C930c) (device #23 with 2 ins 0 outs)
- Windows WASAPI : Headset Microphone (Sennheiser PC 8.2 USB) (device #24 with 2 ins 0 outs)
- Windows WDM-KS : Microphone (罗技高清网络摄像机 C930c) (device #25 with 2 ins 0 outs)
- Windows WDM-KS : SPDIF Out (HD Audio SPDIF out) (device #26 with 0 ins 2 outs)
- Windows WDM-KS : Input (MSVAD Wave) (device #27 with 2 ins 0 outs)
- Windows WDM-KS : Speakers (MSVAD Wave) (device #28 with 0 ins 2 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (10)) (device #29 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (11)) (device #30 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (12)) (device #31 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (13)) (device #32 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (14)) (device #33 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (15)) (device #34 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (16)) (device #35 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (17)) (device #36 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (18)) (device #37 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (19)) (device #38 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (20)) (device #39 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (21)) (device #40 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (22)) (device #41 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (23)) (device #42 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (24)) (device #43 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (25)) (device #44 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (26)) (device #45 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (27)) (device #46 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (28)) (device #47 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (2)) (device #48 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (3)) (device #49 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (4)) (device #50 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (5)) (device #51 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (6)) (device #52 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (7)) (device #53 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (8)) (device #54 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing (9)) (device #55 with 0 ins 6 outs)
- Windows WDM-KS : Line Out (Audials Sound Capturing) (device #56 with 0 ins 6 outs)
- Windows WDM-KS : Output (AMD HD Audio HDMI out #0) (device #57 with 0 ins 2 outs)
- Windows WDM-KS : Headset Microphone (Sennheiser PC 8.2 USB) (device #58 with 2 ins 0 outs)
- Windows WDM-KS : Headset Earphone (Sennheiser PC 8.2 USB) (device #59 with 0 ins 2 outs)

Requested devices:  
In:

- (default)  
Out:
- (default)

Selecting default system input/output devices

Booting with:  
In: MME : Microphone (罗技高清网络摄像机 C930c)  
Out: MME : Headset Earphone (Sennheiser PC  
Sample rate: 44100.000  
Latency (in/out): 0.013 / 0.091 sec  
SC\_AudioDriver: sample rate = 44100.000000, driver’s block size = 64  
SuperCollider 3 server ready.  
late 0.143571377  
late 0.100435734  
late 0.105571747  
late 0.108562469  
late 0.114684105  
late 0.113485336  
late 0.109263897  
late 0.100326061  
late 0.109270573  
late 0.096966743  
late 0.106651306  
late 0.116649151  
late 0.100221634  
late 0.110014915  
late 0.122773647  
late 0.104584694  
late 0.117408276  
late 0.143445492  
late 0.113242149  
late 0.109608173  
late 0.121703148  
late 0.106590271  
late 0.103206158  
late 0.105348587  
late 0.115185261  
late 0.107741356  
late 0.120557308  
late 0.131336689  
late 0.110378742  
late 0.123206139  
late 0.120136261  
late 0.100451469  
late 0.110214233  
late 0.107118130  
late 0.097412109  
late 0.106966019  
late 0.119038582

---

<div class="post-metadata">

**Author:** ![rgcorman](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@rgcorman](https://in-thread.sonic-pi.net/u/rgcorman)\
**Post date:** [January 11, 2022, 10:42pm UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/8 "2022-01-11T22:42:24Z")

</div>

The references to Audials drivers looks like something to check–I still get the issue even if that software is off, but maybe the drivers are an issue.

---

<div class="post-metadata">

**Author:** ![rgcorman](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@rgcorman](https://in-thread.sonic-pi.net/u/rgcorman)\
**Post date:** [January 11, 2022, 10:46pm UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/9 "2022-01-11T22:46:08Z")

</div>

I disabled Audials drivers but it didn’t change the timing issue.

---

<div class="post-metadata">

**Author:** ![rgcorman](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@rgcorman](https://in-thread.sonic-pi.net/u/rgcorman)\
**Post date:** [January 14, 2022, 8:11pm UTC](https://in-thread.sonic-pi.net/t/midi-input-timing-issues/6370/10 "2022-01-14T20:11:07Z")

</div>

To follow up: when I run sonic pi on my macbook air m1, with the same usb midi keyboard, it works much better. The sounds in a chord sound close enough to be usable, which wasn’t true on my Windows PC. It sounded more in sync on the mac when playing out either the internal sound or through a scarlett audio interface. I didn’t try the audio interface with the PC, but I don’t think the sound card was the issue–I know it affects overall latency, but this issue is more of a timing between midi notes issue, which to me would not seem related to output latency.

I’m chalking this up to my general principal of never trying to use Windows for music apps–I just never get as good results as with Macs. I love Windows and use it for all kinds of other things but with music stuff it drives me crazy.
