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

Speed in effects have no unit of measure #3

Open
ewowi opened this issue May 12, 2024 · 3 comments
Open

Speed in effects have no unit of measure #3

ewowi opened this issue May 12, 2024 · 3 comments

Comments

@ewowi
Copy link
Collaborator

ewowi commented May 12, 2024

In some effects in StarMod I replace ‘speed’ with BPM as I hope that speed does the same in different effects. Now it’s completely different in WLED .

I was thinking, should BPM be a general parameter which defines how often an effect frame is called ? So leave it out specific effect code?

And if so should the same bpm apply also to all effects if you have more than one effect or could each effect have a different BPM?

I propose bpm because it has a unit of measurement: beats per minute, but frames per second might also be possible, or whatever / time-unit

@ewowi
Copy link
Collaborator Author

ewowi commented May 12, 2024

SH007:

good point actually - "speed" is really used very inconsistently in wled effects - same about "intensity".

its not just about how often the effect function is called - but indeed some effects use the parameter to "skip" frames.

better use of speed (or BPM) is to control the "progress" of an effect. For example, in DJLight, speed should be used together with elapsed time to decide how many steps of "scrolling" are needed.

this is basicially the difference between "frame rate controlled" (evil) vs. "time based" (smooth) progress

EW:
So you are saying a frame something’s need to be called a few times before one step is done?

SH007:
maybe yes, if too much time has elapsed.

other effects (like animartix) move the content sideways, and for these, it's better to let the effect decide. for example, move 3 pixels left instead of 1.

TH:
There's also places where I would consider "speed" to be backwards - where it's used more like a delay.

Small delay (slider to the left) is faster.

007:
i think the critical parameter for effects is "millis since last call". maybe the value could already be "stretched" or "condensed" based on a global bpm.

so effects would just look at their "elapsed millis" timebase, but they do not need to have their own bpm-to-speed calc

for example:
effect framework does ⁠ elapsedTicks = ( (millis()-last_time) * userBPM) / speedBase; ⁠

effect does ⁠ if elapsedTicks < 10) return; ⁠
or ⁠ newX = oldX + elapsedTicks/5; ⁠

--> frameworks handles base speed
--> effects get simpler, but still flexible on how to handle "smooth motion"

speedBase ⁠ is just a calibration constant, to achieve something like "10 ticks per beat"

... or maybe 50 (100?) ticks per beat

... for my first patter "if elapsedTicks < 10" to really work, there must be a way for effects to tell the framework that progress has happened. like "return SKIPPED" -> don't update last_time. "return DONE" -> update last_time.

@ewowi
Copy link
Collaborator Author

ewowi commented May 19, 2024

the speed parameter should also have an option to run "max speed' (slider at max?) so the effect runs as fast as possible

@Flavourdynamics
Copy link

Generally, I think FPS is better, unless we are talking about sound reactivity, where BPM is more applicable. Speed is a bit vague. If speed is used, it should also describe what is speeding up: colour, movement parameter_x, etc.

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

No branches or pull requests

2 participants