# Issues with missing the timing

**URL:** <https://in-thread.sonic-pi.net/t/issues-with-missing-the-timing/2370>\
**Category:** Support, Help & Resources\
**Created:** [May 8, 2019, 12:21pm UTC](https://in-thread.sonic-pi.net/t/issues-with-missing-the-timing/2370 "2019-05-08T12:21:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 8, 2019, 12:56pm UTC](https://in-thread.sonic-pi.net/t/issues-with-missing-the-timing/2370/2 "2019-05-08T12:56:18Z")

</div>

Hello @hyphz!

You’re in luck, there are some detailed discussions about this issue 😉 -

> [@Using :sync with live\_loops](http://in-thread.sonic-pi.net/t/using-sync-with-live-loops/172):
>
> I’m curious to see what people’s thoughts are on the best way to use :sync with multiple threads. I have seen it used outside the block of code, following the name of a live\_loop, inside the block of code as well as using cue :tick inside a block of code and then syncing with :tick. The differences seem to be in when you start the program, certain threads have to run before others sync up with it and also the length of time it takes for a change to happen in a thread that has been synced with a…

> [@Live loops Sync questions slight\_smile](http://in-thread.sonic-pi.net/t/live-loops-sync-questions/1172):
>
> Hi everybody, I always have troubles with sync in sonic pi… if somebody can explain why this following code do run as it runs, it would be kind ! use\_bpm 120 beats\_per\_bar = 4 ############################### TOOLS ############################### live\_loop :metronome do use\_synth :beep play :a4, release: 0.5 sleep 1 end live\_loop :\_1\_bar do use\_synth :beep play :as5, release: 0.5 sleep beats\_per\_bar # the cue is sent ONLY NOW /frowning so sad no ? end live\_loop :\_4\_bars do sleep b…

One of the best ways I think of avoiding the undesired delay is to use the `sync:` opt of `live_loop`. Ie:

```ruby
live_loop :bar, sync: :a do
...

```

That way, your loop will sync before it’s about to start, and from then on, just plays without syncing further. There is a small gotcha though: it will only sync on cues _after_ they have happened - so while the two loops would be in time, it would effectively wait for one iteration of loop :a before starting loop :bar.  
(There are various comments in the second thread mentioned above about minimising this ‘side-effect’ - and also a very helpful diagram about halfway down that I think explains the two approaches to syncing threads well).  
Feel free to have a read through those threads and ask us any further questions you might still have.

---

_[View the full topic](https://in-thread.sonic-pi.net/t/issues-with-missing-the-timing/2370)._
