-- | Tuning Opcodes
module CsoundExpr.Opcodes.Pitch.Tuning
    (cps2pch,
     cpsxpch,
     cpstun,
     cpstuni)
where



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



-- | * opcode : cps2pch
--  
--  
-- * syntax : 
--  
--  >   icps cps2pch ipch, iequal
--  
--  
-- * description : 
--  
--  Converts a pitch-class value into cycles-per-second (Hz) for
-- equal divisions of the octave.
--  
--  
-- * url : <http://www.csounds.com/manual/html/cps2pch.html>
 
cps2pch :: Irate -> Irate -> Irate
cps2pch i0pch i1equal = opcode "cps2pch" args
  where args = [to i0pch, to i1equal]


-- | * opcode : cpsxpch
--  
--  
-- * syntax : 
--  
--  >   icps cpsxpch ipch, iequal, irepeat, ibase
--  
--  
-- * description : 
--  
--  Converts a pitch-class value into cycles-per-second (Hz) for
-- equal divisions of any interval. There is a restriction of no
-- more than 100 equal divisions.
--  
--  
-- * url : <http://www.csounds.com/manual/html/cpsxpch.html>
 
cpsxpch :: Irate -> Irate -> Irate -> Irate -> Irate
cpsxpch i0pch i1equal i2repeat i3base = opcode "cpsxpch" args
  where args = [to i0pch, to i1equal, to i2repeat, to i3base]


-- | * opcode : cpstun
--  
--  
-- * syntax : 
--  
--  >   kcps cpstun ktrig, kindex, kfn
--  
--  
-- * description : 
--  
--  Returns micro-tuning values at k-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/cpstun.html>
 
cpstun :: (K k0, K k1, K k2) => k0 -> k1 -> k2 -> Krate
cpstun k0trig k1index k2fn = opcode "cpstun" args
  where args = [to k0trig, to k1index, to k2fn]


-- | * opcode : cpstuni
--  
--  
-- * syntax : 
--  
--  >   icps cpstuni index, ifn
--  
--  
-- * description : 
--  
--  Returns micro-tuning values at init-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/cpstuni.html>
 
cpstuni :: Irate -> Irate -> Irate
cpstuni i0ndex i1fn = opcode "cpstuni" args
  where args = [to i0ndex, to i1fn]