Skip to content
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

Signals #56

Merged
merged 9 commits into from
Nov 1, 2024
Merged

Signals #56

merged 9 commits into from
Nov 1, 2024

Conversation

felixroos
Copy link
Owner

@felixroos felixroos commented Nov 1, 2024

add signal node:

impulse(4)
.signal(() => Math.random()*880+440)
.lag(.1)
.sine()
.out()

here, the callback passed to signal will be executed each time the input gets positive.
In this case, the callback will be called 4 times per second.
The value returned from the callback will be sent to the audio thread to be used as the new value for the signal node.
You can also schedule updates manually, and return nothing / undefined.
The callback gets time (this.playPos) and id (of signal) as arguments.
Like the CC ugen, the Signal ugen can be updated via setControl.
The Signal ugen will send a SIGNAL_TRIGGER whenever its input goes from 0 to positive.

I've already implemented a simple strudel scheduler using signals, which will follow in another PR.
Signals seem useful for general sequencing operations that should not run at audio rate.

It's also comparable to hydra, where you can pass a function to a node to feed values from the main thread (hydra is fixed to 60fps, whereas kabelsalat signals are triggered based on the input)

Limitation 1: on evaluation, the signals of the old graph stop to work atm.
With longer fadeTimes, this gets audible. There should be a way to improve this in the future.
Limitation 2: on evaluation, all signal values reset. It would be smoother if the current value could somehow be passed aloong. This probably only works if the id stays the same.

@felixroos felixroos merged commit 7b7df99 into main Nov 1, 2024
2 checks passed
@felixroos felixroos mentioned this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant