How to read reactive state from imperative contexts (audio/music)
tl;dr: is there any major DO NOT guideline around (constantly!) reading reactive states from functions (callbacks) that don´t need the reactivity? Will it create "tracking" "dependencies" or any other resources that won´t get actually used or not get properly disposed?
Context: I am trying to build a fun little audio app using Solid and Tone.js
In the visual UI part of the app I am accessing signals and stores containing things like "musical notes". The usual
But on the audio part of the app I am reading parts of this same state on "musical time", via the Tone.js scheduler which is a sort of
But on the audio part of the app I am reading parts of this same state on "musical time", via the Tone.js scheduler which is a sort of
setTimeout
/ requestAnimationFrame
API that works on a pausable musical timeline.
The below simplified snippet
- runs on the scheduled invocations from Tone.js
- consumes AND updates signals, memos, computations
I still don´t understand the 🪄 magic behind Solid´s reactivity (and calling it magic means I will probably never will 😅 ) so things like tracking
, parents
, owners
and "re-run" are scaring me a bit.
❓ Am I running into a wall here by calling isPlaying()
volume()
and the likes on hundreds of different little time sensitive closures () => ....
😱 ?
Please pardon the noobness.
And if you like music/audio things don´t hesitate to reach out 🎵12 Replies
❓ Am I running into a wall here by callingis this in a tracking scope or a raf loop? if the scope isn't tracking, signal access won't do any additional work besides giving you the current value and if the scope is tracking, a signal instance will have to be pushed into the sources array or the current listener, which shouldn't be too expensive eitherisPlaying()
volume()
and the likes on hundreds of different little time sensitive closures() => ....
😱 ?
GitHub
GitHub - bigmistqke/tr8ck: An online tracker/sequencer/daw ⚡ by sol...
An online tracker/sequencer/daw ⚡ by solidjs and faust - GitHub - bigmistqke/tr8ck: An online tracker/sequencer/daw ⚡ by solidjs and faust
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nice! did not know about gridsound looks cool!!
for me it was just a lil experiment w dsp and trackers, probably not gonna continue on it or anything. was a fun month 🙂 found this dsp-language called Faust that you can compile to wasm from the client https://github.com/grame-cncm/faust2webaudio pretty fun stuff if u wanna code ur own fx/synthesizers.
saw some other audio-projects pass by in this discord, p.ex https://tahti.studio/ is build w solid (close-sourced tho, so is a bit of a bummer)
tahti
a groovebox for the browser
if u have some updates on ur project lmk always curious to web-audio and solid
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thank you!
Doubling down on my approach and having a really good time right now 😸
@bigmistqke and @adoublef great resources, great projects!
Tahti is cool as well and their solid knobs - real solid knobs, pun intended - is open source https://github.com/tahti-studio/solid-knobs
The main focus of my project is TIME
My main use case is building the ultimate metronome for musical practice.
So far, I have built an alternative Transport service to Tone so that I can have a timeline as you have on your typical DAW with tempo and signature changes (Tone doesn't allow this as it recalculates your current position once you change signature). It's going amazingly well thanks to the simplicity of Solid
@bigmistqke your squencer is cool af 😎 great UI there
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
tysm!
nice scope!
I still don´t understand the 🪄 magic behind Solid´s reactivity (and calling it magic means I will probably never will 😅 ) so things like tracking, parents, owners and "re-run" are scaring me a bit.
this is a really great article that cleared a lot of things up for me regarding ownership