Orca icon indicating copy to clipboard operation
Orca copied to clipboard

feat(ableton-link): add ableton link support to orca

Open mcartagenah opened this issue 4 years ago • 12 comments

I think Orca should have Ableton Link support, so I used this package https://github.com/Onni97/abletonlink-node-addon to achieve this, I think it's working ok, but needs more testing.

So far you can play/pause and change the tempo, I haven't noticed any drifts in tempo, maybe a little when you change it very quickly.

I'm open to suggestions on how to implement this, or if there's another functionality of ableton link needed.

Hope everyone likes it :D

mcartagenah avatar Oct 07 '20 00:10 mcartagenah

I forgot, to enable/disable Link you can send the command link 😅

mcartagenah avatar Oct 07 '20 00:10 mcartagenah

I will not merge this in master, but I think it's a good feature, would you be game to maintain a fork up to date for this instead?

neauoire avatar Oct 07 '20 01:10 neauoire

I have no problem in maintaining a fork with this feature. What you think it needs to be in master?

mcartagenah avatar Oct 07 '20 02:10 mcartagenah

I'd love to add the link to the fork in the readme for others to try if they use ableton.

I keep the master branch free of libraries, and specific code to keep the codebase simple, generic and hackable even for people who are not too familiar with javascript. It's a bit of a playground, between choosing to have fast code and readable code, I'll always go for readable code for master, as to keep the bar pretty low for anyone who need to customize it.

The only PRs that can go in master is small changes to help with readability and stability and bug fixes to the spec.

neauoire avatar Oct 07 '20 03:10 neauoire

I understand :)

I'll keep the fork up to date and would love if you add a link to it in your readme.

mcartagenah avatar Oct 07 '20 03:10 mcartagenah

One unfortunate problem with disparate forks is not having a single place to discuss PRs.

@mcartagenah very nice! If this existed earlier I probably would not have bothered with MIDI clock :)

unthingable avatar Oct 07 '20 07:10 unthingable

One unfortunate problem with disparate forks is not having a single place to discuss PRs.

@mcartagenah very nice! If this existed earlier I probably would not have bothered with MIDI clock :)

I think your work was needed too, for example, syncing Orca to external analog gear :)

mcartagenah avatar Oct 07 '20 14:10 mcartagenah

I fixed some bugs and took in consideration all your feedback.

Hope it's working ok!

mcartagenah avatar Oct 08 '20 06:10 mcartagenah

@mcartagenah thanks for taking a swing at it!

Finally took it for a test drive, good news is Link links and reacts to start/stop/tempo, bad news is it's not very usable yet, at least on my end:

  • getting massive beat drift while playing
  • random offsets when starting and stopping link
  • changing tempo throws Orca out of sync (as predicted, via setFrame(0))

The trick, I think, is getting Orca to sync to a beat initially and then keeping it in sync (Orca's own clock is pretty much guaranteed to drift over time). Seeing that the library you picked does not offer callbacks, you will likely have to repeatedly calculate where Orca's beats should land and adjust internal scheduling.

~It's~ It would have been much easier to make it Link's job to advance frames on its own schedule and not use the internal clock, that's how MIDI clock works already. Maybe have a look at https://github.com/2bbb/node-abletonlink, this one seems to have callbacks.

unthingable avatar Oct 08 '20 09:10 unthingable

Sad to hear it doesn't work for you, I'll keep tweaking it to find how to maintain a good sync. I tried the package you mentioned, but some callbacks weren't working as said in the documentation.

mcartagenah avatar Oct 08 '20 21:10 mcartagenah

some callbacks weren't working as said in the documentation

Right, upon a closer look that package provides less functionality than abletonlink-addon. What's more, neither the underlying library nor the Napi wrapper node-abletonlink is using seem to support beat-synced scheduling, so avoiding Orca's internal clock is not possible.

Then the right thing to do is to periodically (on every frame?) get beat/phase/quantum information from Link and adjust Orca's clock scheduler accordingly.

unthingable avatar Oct 10 '20 07:10 unthingable

I made an implementation of the clock scheduler and think it's working, also added quantized launch (it's kinda working). @unthingable hope you can test it if you have the time, the branch is called ableton_link_v2 on my fork 😄

mcartagenah avatar Oct 26 '20 03:10 mcartagenah