zya / beet.js

Polyrhythmic Sequencer library for Web Audio API.
http://zya.github.io/beet.js
MIT License
114 stars 17 forks source link

Unexpected behavior #8

Closed guilhermecomum closed 5 years ago

guilhermecomum commented 5 years ago

Hi, I don't know if this is a bug, but I found a unexpected behavior in comparison with other implementations of euclidean rhythm like https://dbkaplun.github.io/euclidean-rhythm/

When I add two layers A (5,13) and B(3,8), they start and stop in the same moment. Given the amount of step, they should start together but while they playing they should "desync", like two cogs with different sizes, that start together but not aways finish in same time?

Once more thank you for this amazing library.

PS: sorry for my english is not my first language

zya commented 5 years ago

If I understand correctly, your issue is as follows:

const pattern1 = beet.pattern(5, 13);
const layer1 = beet.layer(pattern1);
const pattern2 = beet.pattern(3,8);
const layer2 = beet.layer(pattern2);

Your expectation is that layer1 and layer2 would not sync. In that, they would not repeat at the same time. This is not the case in beet. As each layer will follow the global bpm. Meaning regardless of the pattern, all the pattern lengths are the same. If you want your layers to have different lengths (in terms of time) you can set different bpms for each layer. Hope that clarifies it.

guilhermecomum commented 5 years ago

Thanks for the reply :D Your answer helped me find how to reproduce this behavior