yaxu
August 20, 2021, 10:28am
#1
Hi all, it'd be great to have link sync for Tidal.. I'm working on haskell bindings for the library via something called hylia. I've got the basics working but I don't really know what I'm doing so help would be much appreciated!
opened 10:09AM - 20 Aug 21 UTC
Ref tidal ticket https://github.com/tidalcycles/Tidal/issues/660
and short di… scussion here https://github.com/Ableton/link/issues/71#issuecomment-902476653
Lets make Haskell bindings to the lovely https://github.com/falkTX/Hylia
I don't really know what I'm doing, but the current WIP in this repo seems to be basically functional.
```shell
alex@teff:~/src/hylia-haskell$ cat examples/test.hs
import Network.Hylia
import Foreign
import Foreign.Ptr
import Foreign.C.Types
main = alloca $
\timeinfoPtr -> do hylia <- hylia_create
hylia_enable hylia (CBool 1)
hylia_process hylia 1 timeinfoPtr
timeinfo <- peek timeinfoPtr
putStrLn $ show timeinfo
hylia_set_beats_per_bar hylia (CDouble 3)
hylia_process hylia 1 timeinfoPtr
timeinfo <- peek timeinfoPtr
putStrLn $ show timeinfo
return ()
alex@teff:~/src/hylia-haskell$ cabal v1-install
Warning: The package list for 'hackage.haskell.org' is 64 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
In order, the following will be installed:
hylia-0.1.0.0 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Starting hylia-0.1.0.0
Building hylia-0.1.0.0
Completed hylia-0.1.0.0
alex@teff:~/src/hylia-haskell$ runhaskell examples/test.hs
TimeInfo {beatsPerBar = 4.0, beatsPerMinute = 120.0, beat = 2.48e-4, phase = 2.48e-4, playing = 0}
TimeInfo {beatsPerBar = 3.0, beatsPerMinute = 120.0, beat = 3.368e-3, phase = 3.368e-3, playing = 0}
```
7 Likes
julian
August 20, 2021, 2:29pm
#2
This is the initial code/discussion for the sclang implementation: https://github.com/supercollider/supercollider/pull/3351/
And this is the rebased branch a bit later, which was merged: https://github.com/supercollider/supercollider/pull/4331
maybe this helps?
2 Likes
yaxu
August 20, 2021, 9:45pm
#3
Thanks Julian, this does help a lot. It works differently to what the hylia wrapper library does, which is designed to run in the audio thread based on sample time rather than system clock time. I'll look into adding the calls that supercollider uses to hylia.
Hi! love this effort! What would the difference between this and carabiner be besides a haskell implementation??
specht
August 23, 2021, 8:37pm
#5
Wow, this is great! Can't help much though, my coding skills are limited unfortunately.
yaxu
August 26, 2021, 10:31am
#6
The carabiner approach relies on the local system clock not drifting. Using the local clock as the reference undermines a lot of the work that the link library does. It's also a bit more effort starting python processes etc.
5 Likes