-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Mallets - Add random knob function #6466
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using <random>
provided by the C++ standard library instead of rand
. It has far more control in terms of PRNG as you can specify the distribution explicitly as well as the random number engine, and it's just more idiomatic to C++ in general. See https://en.cppreference.com/w/cpp/numeric/random for details.
Thanks! I've been ruminating over random engines quite a lot. Looking at Out of curiosity I stitched the fast_rand() function from lmms into the test in the article below to see how it compares.
This makes fast_rand() some 13 times faster than rand(). In the case of this PR I can't see how we could benefit from a better random engine but I'm definitely keeping that library in the back of my mind. Here are some other random engines that look interesting: splitmix, xorshift and pcg. https://arvid.io/2018/07/02/better-cxx-prng/ |
befe1f1
to
136e4b9
Compare
|
As for the gui, that isn't my cup of tea. You could add some visual indication of how the random knob affects the synth. Like an arrow drawn from the random knob to the affected knobs (updated artwork). And/Or reorganize the knobs so the random knob is situated by the affected knobs. This is a later project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some format updates. The overall code looks okay.
Co-authored-by: saker <[email protected]>
Co-authored-by: saker <[email protected]>
Co-authored-by: saker <[email protected]>
Co-authored-by: saker <[email protected]>
Add a random knob to liven up the sound a bit. Originally introduced as a part of #2671.
The values of Position and Hardness in the first nine instruments and the values of Modulator and Crossfeed in Tubular Bells are randomly nudged by the value of Random.