fm.tidal 1.53 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
:{
  -- sets the amount of operator 'op' in the superfm output mix
  -- (1 <= op <= 6)
  fmamp :: Int -> Pattern Double -> ControlPattern
  fmamp op = pF ("amp" ++ show op)

  -- sets the ratio for operator 'op'.
  -- the frequency is note * ratio + detune Hz
  -- (1 <= op <= 6)
  fmratio :: Int -> Pattern Double -> ControlPattern
  fmratio op = pF ("ratio" ++ show op)

  -- set the detune for operator 'op'
  fmdetune :: Int -> Pattern Double -> ControlPattern
  fmdetune op = pF ("detune" ++ show op)

17
  -- set the modulation of operator opa by operator opb
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
  -- if opa == opb, then the modulation amount is multiplied by the
  -- 'feedback' parameter
  fmmod :: Int -> Int -> Pattern Double -> ControlPattern
  fmmod opa opb = pF ("mod" ++ show opa ++ show opb)

  -- feedback
  fmfeedback :: Pattern Double -> ControlPattern
  fmfeedback = pF "feedback"

  -- Envelope definition: each operator has an envelop with 4 steps
  fmeglevel :: Int -> Int -> Pattern Double -> ControlPattern
  fmeglevel op step = pF ("eglevel" ++ show op ++ show step)

  -- Envelope definition: sets the rate at which the envelope moves
  -- between steps.  Low numbers are slow, high numbers are fast.
  fmegrate :: Int -> Int -> Pattern Double -> ControlPattern
  fmegrate op step = pF ("egrate" ++ show op ++ show step)

-- Array functions
  fmparam function (x:xs) = foldr (#) (function 1 x) (zipWith function [2..] xs)
    lfma = fmparam fmamp
    lfmr = fmparam fmratio
    lfmd = fmparam fmdetune
    lfmer op = fmparam (fmegrate op)
    lfmel op = fmparam (fmeglevel op)
}