-- | Special Effects
module CsoundExpr.Opcodes.Sigmod.Speciale
    (distort,
     distort1,
     flanger,
     harmon,
     phaser1,
     phaser2)
where



import CsoundExpr.Base.Types
import CsoundExpr.Base.MultiOut
import CsoundExpr.Base.SideEffect
import CsoundExpr.Base.UserDefined



-- | * opcode : distort
--  
--  
-- * syntax : 
--  
--  >   ar distort asig, kdist, ifn[, ihp, istor]
--  
--  
-- * description : 
--  
-- 
--  
--  
-- * url : <http://www.csounds.com/manual/html/distort.html>
 
distort :: (K k0) => [Irate] -> Arate -> k0 -> Irate -> Arate
distort i0init a1sig k2dist i3fn = opcode "distort" args
  where args = [to a1sig, to k2dist, to i3fn] ++ map to i0init


-- | * opcode : distort1
--  
--  
-- * syntax : 
--  
--  >   ares distort1 asig, kpregain, kpostgain, kshape1, kshape2[, imode]
--  
--  
-- * description : 
--  
--  Implementation of modified hyperbolic tangent distortion.
-- distort1 can be used to generate wave shaping distortion based on
-- a modification of the tanh function.
--  
--  
-- * url : <http://www.csounds.com/manual/html/distort1.html>
 
distort1 ::
           (K k0, K k1, K k2, K k3) =>
           [Irate] -> Arate -> k0 -> k1 -> k2 -> k3 -> Arate
distort1 i0init a1sig k2pregain k3postgain k4shape1 k5shape2
  = opcode "distort1" args
  where args
          = [to a1sig, to k2pregain, to k3postgain, to k4shape1, to k5shape2]
              ++ map to i0init


-- | * opcode : flanger
--  
--  
-- * syntax : 
--  
--  >   ares flanger asig, adel, kfeedback [, imaxd]
--  
--  
-- * description : 
--  
--  A user controlled flanger.
--  
--  
-- * url : <http://www.csounds.com/manual/html/flanger.html>
 
flanger :: (K k0) => [Irate] -> Arate -> Arate -> k0 -> Arate
flanger i0init a1sig a2del k3feedback = opcode "flanger" args
  where args = [to a1sig, to a2del, to k3feedback] ++ map to i0init


-- | * opcode : harmon
--  
--  
-- * syntax : 
--  
--  >   ares harmon asig, kestfrq, kmaxvar, kgenfreq1, kgenfreq2, imode, 
--  >       iminfrq, iprd
--  
--  
-- * description : 
--  
--  Analyze an audio input and generate harmonizing voices in
-- synchrony.
--  
--  
-- * url : <http://www.csounds.com/manual/html/harmon.html>
 
harmon ::
         (K k0, K k1, K k2, K k3) =>
         Arate -> k0 -> k1 -> k2 -> k3 -> Irate -> Irate -> Irate -> Arate
harmon a0sig k1estfrq k2maxvar k3genfreq1 k4genfreq2 i5mode
  i6minfrq i7prd = opcode "harmon" args
  where args
          = [to a0sig, to k1estfrq, to k2maxvar, to k3genfreq1,
             to k4genfreq2, to i5mode, to i6minfrq, to i7prd]


-- | * opcode : phaser1
--  
--  
-- * syntax : 
--  
--  >   ares phaser1 asig, kfreq, kord, kfeedback [, iskip]
--  
--  
-- * description : 
--  
--  An implementation of iord number of first-order allpass filters
-- in series.
--  
--  
-- * url : <http://www.csounds.com/manual/html/phaser1.html>
 
phaser1 ::
          (K k0, K k1, K k2) => [Irate] -> Arate -> k0 -> k1 -> k2 -> Arate
phaser1 i0init a1sig k2freq k3ord k4feedback
  = opcode "phaser1" args
  where args
          = [to a1sig, to k2freq, to k3ord, to k4feedback] ++ map to i0init


-- | * opcode : phaser2
--  
--  
-- * syntax : 
--  
--  >   ares phaser2 asig, kfreq, kq, kord, kmode, ksep, kfeedback
--  
--  
-- * description : 
--  
--  An implementation of iord number of second-order allpass filters
-- in series.
--  
--  
-- * url : <http://www.csounds.com/manual/html/phaser2.html>
 
phaser2 ::
          (K k0, K k1, K k2, K k3, K k4, K k5) =>
          Arate -> k0 -> k1 -> k2 -> k3 -> k4 -> k5 -> Arate
phaser2 a0sig k1freq k2q k3ord k4mode k5sep k6feedback
  = opcode "phaser2" args
  where args
          = [to a0sig, to k1freq, to k2q, to k3ord, to k4mode, to k5sep,
             to k6feedback]