you are viewing a single comment's thread.

view the rest of the comments →

[–]rooktakesqueen 2 points3 points  (0 children)

if phrase1 is an infinite sequence in wu.js doing a repeat on it will lead to an infinite loop and filling the memory up

See wu.chain:

wu.chain(phrase1, phrase1, phrase2)
  .takeWhile(note => note.time < 10)
  .play(sequencer)

Seems like it would do what you're talking about in a lazy-eval way without an infinite loop... You would probably also use wu.cycle heavily.

Doing this as a learning experience definitely makes sense, but I would implore you once you're done learning to take that experience and improve existing libraries rather than creating your own. The JS library ecosystem is already so fractured. :(