# Question about sync

**URL:** <https://in-thread.sonic-pi.net/t/question-about-sync/6432>\
**Category:** Support, Help & Resources\
**Created:** [January 25, 2022, 3:19pm UTC](https://in-thread.sonic-pi.net/t/question-about-sync/6432 "2022-01-25T15:19:27Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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 27, 2022, 8:13am UTC](https://in-thread.sonic-pi.net/t/question-about-sync/6432/6 "2022-01-27T08:13:00Z")

</div>

Here, you have some code outside a `live_loop`, and some other code inside a `live_loop`.

Code in a Sonic Pi (Ruby) file is interpreted from top to bottom - in this case, this means the code not in the live\_loop is interpreted first (this being the `8.times` loop) and 8 times, a cue is sent, a note is played, and the script waits for a little time.

_Once that has all finished_, the live\_loop is interpreted and immediately created by Sonic Pi. _By this time, all the cues are in the past_.

This means that the `sync` continues waiting for a `cue` that will never come.

Sam explains this fairly well I think in the issue I raised a few years back:

> <https://github.com/sonic-pi-net/sonic-pi/issues/1730#issuecomment-353114957>
>
> (Hopefully I haven't somehow completely missed this being reported already, and …also hopefully I'm not just noticing expected behaviour!) - I have noticed that the following simple code example behaves differently between several versions of Sonic Pi: 
> 
> \`\`\`ruby
> live\_loop :a do
> sleep 4
> end
> 
> live\_loop :b, sync: :a do
> sample :bd\_808
> sleep 1
> end
> \`\`\`
> 
> On v2.10 on my Mac, you can hear the bass drum sample start straight away.
> On v3.0.1, both on my Mac and on Windows, (which are at different commits, but both say 3.0.1) the bass drum is not heard until after the delay of the first live loop's sleep.

The reason it works after you re-run is because by that time, Sonic Pi has already interpreted and created the live\_loop, (which it did in the first run) so it is already listening by the time the `8.times` loop executes, and is able to respond.

Hope that helps! there are a few diagrams in some of the comments on the topics I link to above that might help to show it visually as well 🙂 ([Live loops Sync questions :-) - #18 by Martin](https://in-thread.sonic-pi.net/t/live-loops-sync-questions/1172/18) for example)

---

_[View the full topic](https://in-thread.sonic-pi.net/t/question-about-sync/6432)._
