# Loop doesn't line up

**URL:** https://in-thread.sonic-pi.net/t/loop-doesnt-line-up/6977
**Category:** Support, Help & Resources
**Created:** [July 31, 2022, 12:21am UTC](https://in-thread.sonic-pi.net/t/loop-doesnt-line-up/6977 "2022-07-31T00:21:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yug](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@yug](https://in-thread.sonic-pi.net/u/yug)
#### Post date: [July 31, 2022, 12:21am UTC](https://in-thread.sonic-pi.net/t/loop-doesnt-line-up/6977/1 "2022-07-31T00:21:24Z")

</div>

I don’t understand why timing isn’t exactly correct:

use\_bpm 60  
print sample\_duration(:loop\_mika, rate: 2, release: 1, sustain: 1)  
print sample\_duration(:drum\_tom\_hi\_hard, rate: 2, release: 0.1, sustain: 0.1)  
live\_loop :flibble do  
sample :loop\_mika, rate: 2, release: 1, sustain: 1  
sample :drum\_tom\_hi\_hard, amp: 0.8, sustain: 0.1, release: 0.1  
sleep 2  
end

It seems, since the sample length of the edited loop\_mika is 2, and drum\_tom\_hi\_hard \< 2, that every period of 2 seconds should be identical. But this is not the case, it sounds like a discordant overlap – why?

Edit:  
There’s something really wierd with my Mac download where things that should line up don’t.

use\_bpm 60

live\_loop :drumloop do  
sample :loop\_amen, beat\_stretch: 1  
sleep 1  
end

Also has some overlapping in my Bluetooth headphones, but clearly it shouldn’t. Any ideas?

Edit: Discussion on Github here: [Timing doesn't align · Issue #3187 · sonic-pi-net/sonic-pi · GitHub](https://github.com/sonic-pi-net/sonic-pi/issues/3187)

---

<div class="post-metadata">

### Author: ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)
#### Post date: [July 31, 2022, 7:57am UTC](https://in-thread.sonic-pi.net/t/loop-doesnt-line-up/6977/2 "2022-07-31T07:57:02Z")

</div>

If you don’t use the bluetooth earphones what is it like then? Reset your output to the internal speakers and restart Sonic Pi. The code works as expected on my iMac with version 4.0.3 (the latest).  
I suspect It may be something to do with your audio setup.

EDIT have you looked at the sonic-pi logs at all to see if there is anything untoward there? The are in your `<home folder>/.sonic-pi/log` I see you have posted this on github too. Better to continue this there.
