-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add strudel fft to hydra #310
Conversation
It will hook into strudels analyze engine and expose that data to the hydra scope. Caveats from this is, that only patterns with a '.scope()' (or similar) call will be included into the resulting fft data
strudel's superdough could theoretically add an analyzer to the destinationGain node, which is the last node before the output, so no .scope / .analyze would be needed. but that would only work after the next strudel release as a workaround it might be easier to automatically add a .analyze('flok-master') to the strudel stack of all panes |
fft Thanks @felixroos for the idea!
Also added the ability to change the analzer of the Edit: I just relized that the autmatic adding of the So that would lock us in, in always having all patterns pass through. (which tbh is not that bad imo, having the option of custom routing would be very nice, but i don't think its a necessity for this feature) |
yes opt in would be good, as fft is not very cheap, so it should be avoided if it's not needed. not sure how tho. maybe we can somehow add an allPanes function that runs on the stack of all panes |
it can be different for different clients right? we could chuck it into the settings I guess. we could probably do a better job if surfacing the settings though |
I guess the I think I would do "opt out" though, just so the default experience is more what the code / coders want. |
@felixroos @TodePond added setting to opt out, and only add the analyze node in strudel, when it is necessery (because fft is used in hydra). Feel free to request text changes, writing texts is not my strong suit xD |
The text copy looks good to me! I'm not sure of quite how intensive it actually is so I can't comment on whether it should be opt-in or opt-out. but i think it's good it only kicks in when fft is called. Either way, I think a future PR could surface some of these emerging "performance" settings more clearly. can you confirm if it still needs the "scope" function to be called, as stated in the PR description? |
@TodePond Can confirm that it is no longer necessary, updated the PR description :D (credit to @felixroos for giving me the hints necessary for the automation here) |
Thank you @reckter, this looks great! About documentation, I've added some of it in the README, inside the Hydra section. Feel free to modify it if you want or think I missed something. I've been putting documentation there for the time being. Offtopic, but I'm thinking we should probably update the docs a bit, Flok's original focus was on REPL-based languages, and I feel this is starting to shift towards web-based targets. |
@munshkr I've added a sentence about the FFT settings, so it at least points there :) Yeah, this is pretty much a web-only feature (and really, a web only "problem" to beginn with). But my understanding of flok isn't deep enough for that yet. |
Thank you all! |
This also wires through the instance of the
StrudelWrapper
, just like #309 .fft(index: number, buckets: number = 8, options?: { min?: number; max?: number, scale?: number }): number
.Currently this hooks into the webaudio module from strudel and takes fft-data from there. In the future, we could add different fft sources, and make the source be switchable (or make it use all per default).
.analyze('flok-master')
to all strudel patterns, if fft is used an a hydra paneDocumentation
fft(index: number, buckets: number = 8, options?: { min?: number; max?: number, scale?: number, analyzerId?: string }): number
index: number
: the index of the bucket to return the value frombuckets: number
: The number of buckets to combine the underlying fft data too. defaults to 8.options?: { min?: number; max?: number, scale?: number }
:min?: number
: minimum clamp value of the underlying data, defaults to -150max?: number
: maximum clamp value of the underlying data, defaults to 0scale?: number
: Scale of the outpur, defaults to 1 (so the output is from 0 to 1analyzerId?: string
: Which strudel analyser to listen to. defaults toflok-master
, which is also automatically added to al strudel patterns. Can be used to route different patterns to different parts of the hydra visualiserExamples
Caveats
Open questions: