-- | Waveguide Physical Modeling
module CsoundExpr.Opcodes.Siggen.Wavguide
    (pluck,
     repluck,
     wgbow,
     wgbowedbar,
     wgbrass,
     wgclar,
     wgflute,
     wgpluck,
     wgpluck2,
     wguide1,
     wguide2)
where



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



-- | * opcode : pluck
--  
--  
-- * syntax : 
--  
--  >   ares pluck kamp, kcps, icps, ifn, imeth [, iparm1] [, iparm2]
--  
--  
-- * description : 
--  
--  Audio output is a naturally decaying plucked string or drum
-- sound based on the Karplus-Strong algorithms.
--  
--  
-- * url : <http://www.csounds.com/manual/html/pluck.html>
 
pluck ::
        (K k0, K k1) =>
        [Irate] -> k0 -> k1 -> Irate -> Irate -> Irate -> Arate
pluck i0init k1amp k2cps i3cps i4fn i5meth = opcode "pluck" args
  where args
          = [to k1amp, to k2cps, to i3cps, to i4fn, to i5meth] ++
              map to i0init


-- | * opcode : repluck
--  
--  
-- * syntax : 
--  
--  >   ares repluck iplk, kamp, icps, kpick, krefl, axcite
--  
--  
-- * description : 
--  
--  repluck is an implementation of the physical model of the
-- plucked string. A user can control the pluck point, the pickup
-- point, the filter, and an additional audio signal, axcite. axcite
-- is used to excite the 'string'. Based on the Karplus-Strong
-- algorithm.
--  
--  
-- * url : <http://www.csounds.com/manual/html/repluck.html>
 
repluck ::
          (K k0, K k1, K k2) =>
          Irate -> k0 -> Irate -> k1 -> k2 -> Arate -> Arate
repluck i0plk k1amp i2cps k3pick k4refl a5xcite
  = opcode "repluck" args
  where args
          = [to i0plk, to k1amp, to i2cps, to k3pick, to k4refl, to a5xcite]


-- | * opcode : wgbow
--  
--  
-- * syntax : 
--  
--  >   ares wgbow kamp, kfreq, kpres, krat, kvibf, kvamp, ifn [, iminfreq]
--  
--  
-- * description : 
--  
--  Audio output is a tone similar to a bowed string, using a
-- physical model developed from Perry Cook, but re-coded for
-- Csound.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wgbow.html>
 
wgbow ::
        (K k0, K k1, K k2, K k3, K k4, K k5) =>
        [Irate] -> k0 -> k1 -> k2 -> k3 -> k4 -> k5 -> Irate -> Arate
wgbow i0init k1amp k2freq k3pres k4rat k5vibf k6vamp i7fn
  = opcode "wgbow" args
  where args
          = [to k1amp, to k2freq, to k3pres, to k4rat, to k5vibf, to k6vamp,
             to i7fn]
              ++ map to i0init


-- | * opcode : wgbowedbar
--  
--  
-- * syntax : 
--  
--  >   ares wgbowedbar kamp, kfreq, kpos, kbowpres, kgain [, iconst] [, itvel] 
--  >       [, ibowpos] [, ilow]
--  
--  
-- * description : 
--  
--  A physical model of a bowed bar, belonging to the Perry Cook
-- family of waveguide instruments.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wgbowedbar.html>
 
wgbowedbar ::
             (K k0, K k1, K k2, K k3, K k4) =>
             [Irate] -> k0 -> k1 -> k2 -> k3 -> k4 -> Arate
wgbowedbar i0init k1amp k2freq k3pos k4bowpres k5gain
  = opcode "wgbowedbar" args
  where args
          = [to k1amp, to k2freq, to k3pos, to k4bowpres, to k5gain] ++
              map to i0init


-- | * opcode : wgbrass
--  
--  
-- * syntax : 
--  
--  >   ares wgbrass kamp, kfreq, ktens, iatt, kvibf, kvamp, ifn [, iminfreq]
--  
--  
-- * description : 
--  
--  Audio output is a tone related to a brass instrument, using a
-- physical model developed from Perry Cook, but re-coded for
-- Csound.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wgbrass.html>
 
wgbrass ::
          (K k0, K k1, K k2, K k3, K k4) =>
          [Irate] -> k0 -> k1 -> k2 -> Irate -> k3 -> k4 -> Irate -> Arate
wgbrass i0init k1amp k2freq k3tens i4att k5vibf k6vamp i7fn
  = opcode "wgbrass" args
  where args
          = [to k1amp, to k2freq, to k3tens, to i4att, to k5vibf, to k6vamp,
             to i7fn]
              ++ map to i0init


-- | * opcode : wgclar
--  
--  
-- * syntax : 
--  
--  >   ares wgclar kamp, kfreq, kstiff, iatt, idetk, kngain, kvibf, kvamp, ifn 
--  >       [, iminfreq]
--  
--  
-- * description : 
--  
--  Audio output is a tone similar to a clarinet, using a physical
-- model developed from Perry Cook, but re-coded for Csound.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wgclar.html>
 
wgclar ::
         (K k0, K k1, K k2, K k3, K k4, K k5) =>
         [Irate] ->
           k0 ->
             k1 -> k2 -> Irate -> Irate -> k3 -> k4 -> k5 -> Irate -> Arate
wgclar i0init k1amp k2freq k3stiff i4att i5detk k6ngain k7vibf
  k8vamp i9fn = opcode "wgclar" args
  where args
          = [to k1amp, to k2freq, to k3stiff, to i4att, to i5detk,
             to k6ngain, to k7vibf, to k8vamp, to i9fn]
              ++ map to i0init


-- | * opcode : wgflute
--  
--  
-- * syntax : 
--  
--  >   ares wgflute kamp, kfreq, kjet, iatt, idetk, kngain, kvibf, kvamp, ifn 
--  >       [, iminfreq] [, ijetrf] [, iendrf]
--  
--  
-- * description : 
--  
--  Audio output is a tone similar to a flute, using a physical
-- model developed from Perry Cook, but re-coded for Csound.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wgflute.html>
 
wgflute ::
          (K k0, K k1, K k2, K k3, K k4, K k5) =>
          [Irate] ->
            k0 ->
              k1 -> k2 -> Irate -> Irate -> k3 -> k4 -> k5 -> Irate -> Arate
wgflute i0init k1amp k2freq k3jet i4att i5detk k6ngain k7vibf
  k8vamp i9fn = opcode "wgflute" args
  where args
          = [to k1amp, to k2freq, to k3jet, to i4att, to i5detk, to k6ngain,
             to k7vibf, to k8vamp, to i9fn]
              ++ map to i0init


-- | * opcode : wgpluck
--  
--  
-- * syntax : 
--  
--  >   ares wgpluck icps, iamp, kpick, iplk, idamp, ifilt, axcite
--  
--  
-- * description : 
--  
--  A high fidelity simulation of a plucked string, using
-- interpolating delay-lines.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wgpluck.html>
 
wgpluck ::
          (K k0) =>
          Irate -> Irate -> k0 -> Irate -> Irate -> Irate -> Arate -> Arate
wgpluck i0cps i1amp k2pick i3plk i4damp i5filt a6xcite
  = opcode "wgpluck" args
  where args
          = [to i0cps, to i1amp, to k2pick, to i3plk, to i4damp, to i5filt,
             to a6xcite]


-- | * opcode : wgpluck2
--  
--  
-- * syntax : 
--  
--  >   ares wgpluck2 iplk, kamp, icps, kpick, krefl
--  
--  
-- * description : 
--  
--  wgpluck2 is an implementation of the physical model of the
-- plucked string, with control over the pluck point, the pickup
-- point and the filter. Based on the Karplus-Strong algorithm.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wgpluck2.html>
 
wgpluck2 ::
           (K k0, K k1, K k2) => Irate -> k0 -> Irate -> k1 -> k2 -> Arate
wgpluck2 i0plk k1amp i2cps k3pick k4refl = opcode "wgpluck2" args
  where args = [to i0plk, to k1amp, to i2cps, to k3pick, to k4refl]


-- | * opcode : wguide1
--  
--  
-- * syntax : 
--  
--  >   ares wguide1 asig, xfreq, kcutoff, kfeedback
--  
--  
-- * description : 
--  
--  A simple waveguide model consisting of one delay-line and one
-- first-order lowpass filter.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wguide1.html>
 
wguide1 :: (X x0, K k0, K k1) => Arate -> x0 -> k0 -> k1 -> Arate
wguide1 a0sig x1freq k2cutoff k3feedback = opcode "wguide1" args
  where args = [to a0sig, to x1freq, to k2cutoff, to k3feedback]


-- | * opcode : wguide2
--  
--  
-- * syntax : 
--  
--  >   ares wguide2 asig, xfreq1, xfreq2, kcutoff1, kcutoff2, 
--  >       kfeedback1, kfeedback2
--  
--  
-- * description : 
--  
--  A model of beaten plate consisting of two parallel delay-lines
-- and two first-order lowpass filters.
--  
--  
-- * url : <http://www.csounds.com/manual/html/wguide2.html>
 
wguide2 ::
          (X x0, X x1, K k0, K k1, K k2, K k3) =>
          Arate -> x0 -> x1 -> k0 -> k1 -> k2 -> k3 -> Arate
wguide2 a0sig x1freq1 x2freq2 k3cutoff1 k4cutoff2 k5feedback1
  k6feedback2 = opcode "wguide2" args
  where args
          = [to a0sig, to x1freq1, to x2freq2, to k3cutoff1, to k4cutoff2,
             to k5feedback1, to k6feedback2]