clerk

pfeodrippe 2024-11-07T18:34:42.757219Z

Using clerk with overtone (signal in time and frequency domain with a FFT using the jdsp lib) \o/ One qq, what's the quickest built-in way to send data from the JVM to cljs in Clerk? I guess I could create a websocket, but maybe there is a way for "real-time" data in Clerk

🆒 4
respatialized 2024-11-07T18:43:11.023479Z

https://github.com/leonoel/missionary support for missionary streams and signals in Clerk would make it incredible for DSP-type stuff

mkvlr 2024-11-07T18:47:25.043819Z

Clerk Sync https://book.clerk.vision/#clerk-sync Recently got some performance improvements so be sure to use latest main and let me know how it goes!

🎉 1
pfeodrippe 2024-11-07T18:47:29.435069Z

Nice, yeah, at least for offline processing, seems cool. For real-time, I will see if compiling a C string on-demand from clj (using gcc or whatever) and then using dlopen in the SC plugin works fine. If so, we can create a small clj to C transpiler ahahahah let’s make the world interactive one piece at a time

pfeodrippe 2024-11-07T18:47:52.694169Z

Nice, thanks, Martin!

mkvlr 2024-11-07T18:49:25.257389Z

@afoltzm can you say a bit more how you’d envision that? I haven’t used missionary, only know that electric uses it

mkvlr 2024-11-07T18:49:50.746259Z

Clerk sync is using editscript diffs over websocket

❤️ 1
pfeodrippe 2024-11-07T18:52:28.080169Z

Yeah, I will check later as I don’t have an atom, but a pointer that’s being modified by c++ code ahahaha maybe putting the data into an sync’ed atom using a timer (every, let’s say, 10 ms) will work fine

👍 1
pfeodrippe 2024-11-07T18:54:40.052669Z

I’m using https://github.com/pfeodrippe/vybe/blob/develop/src/vybe/clerk/audio.clj#L48 right now (the future triggering recompute every n milliseconds)

pfeodrippe 2024-11-08T02:22:18.747019Z

@mkvlr The counter increment at https://book.clerk.vision/#clerk-sync doesn't seem to be working

pfeodrippe 2024-11-11T12:23:03.687819Z

I’ve clicked on increment many times, and still not working. I will see soon if I have something in the console. Thanks for checking it o/

mkvlr 2024-11-11T12:57:57.866759Z

@pfeodrippe oh, it doesn’t work in the book, it’s a dead static html there. Should clarify this with a note.

pfeodrippe 2024-11-11T13:02:29.075079Z

Oh lol ok, thanks, yeah, makes sense, I was thinking that it would work with a client only page somehow, but ofc it doesn’t work ahahaha sorry, thanks

mkvlr 2024-11-08T09:04:18.530339Z

huh, I’ll take a look in a bit

👍 1
mkvlr 2024-11-11T07:20:09.145979Z

just getting to this now but it’s working fine here:

mkvlr 2024-11-11T07:20:18.548059Z

(ns sync
  (:require [nextjournal.clerk :as clerk]))

^::clerk/sync
(defonce !counter
  (atom 0))

(clerk/with-viewer {:render-fn '(fn []
                                  [:button.bg-sky-500.hover:bg-sky-700.text-white.rounded-xl.px-2.py-1
                                   {:on-click #(swap! !counter inc)}
                                   "Increment counter"])}
  {})

mkvlr 2024-11-11T07:21:42.941499Z

@pfeodrippe are you getting an error?