smoge
December 8, 2023, 9:32am
25
Publish the tests and benchmarks results (just for curiosity)
Probably could, over the weekend.
Highly unlikely I would have time for that. You’re welcome to run some tests.
hjh
smoge
December 8, 2023, 10:16am
27
Sure, when I have time. If this part of the project is already part of some king of unit/property test, I can try to write along those lines.
supercollider:develop
← jamshark70:topic/MultipleRandIDs
opened 01:19AM - 09 Dec 23 UTC
## Purpose and Motivation
See https://scsynth.org/t/different-randseed-for-th… e-same-synthdef/7248/27, where it was desired to use more than one RNG ID in the same SynthDef. Prior to this change, this was impossible because RandID would set the ID only when the ID input changed. This use case requires setting the ID on every control block, once for one part of the graph, and again for the other part.
However, losing the old behavior would also not be desirable.
So this change adds a new input to RandID, `force`.
- If `force <= 0` (false), RandID behaves the old way, looking for changes in the input.
- If `force > 0` (true), RandID will set the ID in every control block, whether it changed or not.
The default is the old way.
As with a couple of other recent PRs, I would prefer not to have to write a unit test until we are reasonably sure this will be merged. So a unit test isn't yet provided. The approach would be to generate two separate, identically-seeded random number streams and make sure they are the same.
## Types of changes
- Documentation
- New feature
- Breaking change -- minimal impact I think(?)
## To-do list
- [x] Code is tested (informally -- unit test to be written later)
- [x] All tests are passing
- [x] Updated documentation
- [x] This PR is ready for review
Informal test based on this thread:
(
{
var a, b;
RandID.kr(0, 1);
RandSeed.ir(1, 88372);
a = LFDNoise0.ar(440);
RandID.kr(1, 1);
RandSeed.ir(1, 88372);
b = LFDNoise0.ar(440);
[a, b, a - b]
}.plot;
)
hjh
2 Likes
I am happy that a question turned into a bug fix! Thank you all!!!
Sciss
December 26, 2023, 5:01pm
30
Remind me what happens when you extend the binary interface of UGens - does this work with SynthDefs produced for the previous version (i.e. where RandID
has one instead of two arguments), or does this potentially crash scsynth? Is there a default value of 0 when force
is not given in the SynthDef?
Edit: I added my comments to the PR, to avoid that the discussion spreads to different places.
I could not reproduce a crash here.
hjh