# Lag in playing the chord

**URL:** <https://in-thread.sonic-pi.net/t/lag-in-playing-the-chord/5226>\
**Category:** Support, Help & Resources\
**Created:** [March 6, 2021, 2:24pm UTC](https://in-thread.sonic-pi.net/t/lag-in-playing-the-chord/5226 "2021-03-06T14:24:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![goodwintercrop](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/goodwintercrop/32/1476_2.png) [@goodwintercrop](https://in-thread.sonic-pi.net/u/goodwintercrop)\
**Post date:** [March 6, 2021, 2:24pm UTC](https://in-thread.sonic-pi.net/t/lag-in-playing-the-chord/5226/1 "2021-03-06T14:24:04Z")

</div>

We were using Python Sonic Pi, but there is a significant lag when asking Sonic Pi to play a chord, for example. We are connecting that with a home-made dance pad … so that lag is not cool. Any suggestions?

Code: play(Fs5) - which we just followed the sample from Python Sonic Pi install page [python-sonic · PyPI](https://pypi.org/project/python-sonic/)

---

<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:** [March 6, 2021, 2:56pm UTC](https://in-thread.sonic-pi.net/t/lag-in-playing-the-chord/5226/2 "2021-03-06T14:56:14Z")

</div>

Hi @goodwintercrop - welcome!

To start with, it might be helpful to see some code (the smallest amount you could write that demonstrates the problem). This could give us some clues about the approach you might have taken, so that we can think about the right kind of advice to give 🙂

Having said that, if this is using MIDI/OSC, it _could_ be an issue of needing to use something like `use_real_time` or `with_real_time` to remove Sonic Pi’s built-in scheduling delay when running the code.

---

<div class="post-metadata">

**Author:** ![goodwintercrop](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/goodwintercrop/32/1476_2.png) [@goodwintercrop](https://in-thread.sonic-pi.net/u/goodwintercrop)\
**Post date:** [March 6, 2021, 3:18pm UTC](https://in-thread.sonic-pi.net/t/lag-in-playing-the-chord/5226/3 "2021-03-06T15:18:56Z")

</div>

I just put the code into the original message. We will follow your advice and see whehter Python Sonic Pi has the support. Thanks so much for the quick response!

---

<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:** [March 6, 2021, 3:35pm UTC](https://in-thread.sonic-pi.net/t/lag-in-playing-the-chord/5226/4 "2021-03-06T15:35:50Z")

</div>

Sure 👍

Given that it’s just a simple `play` command and nothing else, it’s likely that the use/with real time commands will not be as helpful, (unless there’s more to what you’re doing than I understand here) as they are most often designed to remove the scheduling delay when _also_ using Sonic Pi to send or receive MIDI or OSC commands to/from external devices, with the `midi` or `osc` commands. (Which you aren’t).

There may be more to this than I understand at the moment though. I’m sure someone else may comment too in case they have more helpful advice 🙂
