inference - Quefumas/gensound GitHub Wiki

It could be cool (and sometimes even necessary) to enable inferring parameters for Signals and Transforms.

Some examples, not yet comprehensive:

  • Phase Inference implemented in 0.3, see comment here - consider this: Sine("A", 1e3) | Sine("B", 1e3). Since the 2nd Sine wave starts at phase 0, this creates a jump between the two, which is quite audible. This jump depends on the durations and frequencies, thus the resulting noises can change erratically when transposing or changing BPM, which is not nice at all. Desired behaviour: when concatenating Oscillators, infer the second Oscillator's starting phase from the previous Oscillator's ending phase. This behaviour can be disabled by a static Signal member.
  • Duration Inference: s[10e3:11e3] += Sine("A") figure out that the Sine should be of duration 1e3. Is this necessary? Does implementing this go against the basic ground rules?
  • Consecutive Signals: Sine("A", 1e3) + Sine("B") remember the previous duration was 1e3, so use it again for the second oscillator. This can be performed either by remembering the most recent construction of an Oscillator, or by on-the-spot inference when mixing or concating signals. At least the first implementation is dangerous and may lead to bugs when the user is copying code around.