Function mix

Mixes in modulation. This is used when you want to fold in a controllable amount of modulation.

For example, we have a base value of 0.5 (50%) that we want to modulate by 0.9 (90%). That is, reduce its value by 10%. mix allows us to slowly ramp up to the fully modulated value.

import { mix } from 'https://unpkg.com/ixfx/dist/modulation.js'
// When 'amt' is 0, modulation doesn't affect value at all,
// original is returned
mix(0, 0.5, 0.9); // 0.5
// Mixing in 50% of modulation
mix(0.5, 0.5, 0.9); // 0.475
// All modulation applied, so now we get 90% of 0.5
mix(1, 0.5, 0.9); // 0.45 (ie. 90% of 0.5)
  • Parameters

    • amount: number

      Amount of modulation (0..1). 0 means modulation value has no effect

    • original: number

      Original value to modulate

    • modulation: number

      Modulation amount (0..1)

    Returns number