-- | Sample Level Operators module CsoundExpr.Opcodes.Sigmod.Sample (denorm, diffA, diffK, downsamp, fold, integA, integK, interp, ntrpolA, ntrpolI, ntrpolK, sampholdA, sampholdK, upsamp, vaget, vaset) where import CsoundExpr.Base.Types import CsoundExpr.Base.MultiOut import CsoundExpr.Base.SideEffect import CsoundExpr.Base.UserDefined -- | * opcode : denorm -- -- -- * syntax : -- -- > denorm a1[, a2[, a3[,... ]]] -- -- -- * description : -- -- Mixes low level (~1e-20 for floats, and ~1e-56 for doubles) -- noise to a list of a-rate signals. Can be used before IIR filters -- and reverbs to avoid denormalized numbers which may otherwise -- result in significantly increased CPU usage. -- -- -- * url : denorm :: [Arate] -> SignalOut denorm a0N = outOpcode "denorm" args where args = map to a0N -- | * opcode : diff -- -- -- * syntax : -- -- > ares diff asig [, iskip] -- > kres diff ksig [, iskip] -- -- -- * description : -- -- Modify a signal by differentiation. -- -- -- * url : diffA :: [Irate] -> Arate -> Arate diffA i0init a1sig = opcode "diff" args where args = [to a1sig] ++ map to i0init -- | * opcode : diff -- -- -- * syntax : -- -- > ares diff asig [, iskip] -- > kres diff ksig [, iskip] -- -- -- * description : -- -- Modify a signal by differentiation. -- -- -- * url : diffK :: (K k0) => [Irate] -> k0 -> Krate diffK i0init k1sig = opcode "diff" args where args = [to k1sig] ++ map to i0init -- | * opcode : downsamp -- -- -- * syntax : -- -- > kres downsamp asig [, iwlen] -- -- -- * description : -- -- Modify a signal by down-sampling. -- -- -- * url : downsamp :: [Irate] -> Arate -> Krate downsamp i0init a1sig = opcode "downsamp" args where args = [to a1sig] ++ map to i0init -- | * opcode : fold -- -- -- * syntax : -- -- > ares fold asig, kincr -- -- -- * description : -- -- Adds artificial foldover to an audio signal. -- -- -- * url : fold :: (K k0) => Arate -> k0 -> Arate fold a0sig k1incr = opcode "fold" args where args = [to a0sig, to k1incr] -- | * opcode : integ -- -- -- * syntax : -- -- > ares integ asig [, iskip] -- > kres integ ksig [, iskip] -- -- -- * description : -- -- Modify a signal by integration. -- -- -- * url : integA :: [Irate] -> Arate -> Arate integA i0init a1sig = opcode "integ" args where args = [to a1sig] ++ map to i0init -- | * opcode : integ -- -- -- * syntax : -- -- > ares integ asig [, iskip] -- > kres integ ksig [, iskip] -- -- -- * description : -- -- Modify a signal by integration. -- -- -- * url : integK :: (K k0) => [Irate] -> k0 -> Krate integK i0init k1sig = opcode "integ" args where args = [to k1sig] ++ map to i0init -- | * opcode : interp -- -- -- * syntax : -- -- > ares interp ksig [, iskip] [, imode] -- -- -- * description : -- -- Converts a control signal to an audio signal using linear -- interpolation. -- -- -- * url : interp :: (K k0) => [Irate] -> k0 -> Arate interp i0init k1sig = opcode "interp" args where args = [to k1sig] ++ map to i0init -- | * opcode : ntrpol -- -- -- * syntax : -- -- > ares ntrpol asig1, asig2, kpoint [, imin] [, imax] -- > ires ntrpol isig1, isig2, ipoint [, imin] [, imax] -- > kres ntrpol ksig1, ksig2, kpoint [, imin] [, imax] -- -- -- * description : -- -- Calculates the weighted mean value (i.e. linear interpolation) -- of two input signals -- -- -- * url : ntrpolA :: (K k0) => [Irate] -> Arate -> Arate -> k0 -> Arate ntrpolA i0init a1sig1 a2sig2 k3point = opcode "ntrpol" args where args = [to a1sig1, to a2sig2, to k3point] ++ map to i0init -- | * opcode : ntrpol -- -- -- * syntax : -- -- > ares ntrpol asig1, asig2, kpoint [, imin] [, imax] -- > ires ntrpol isig1, isig2, ipoint [, imin] [, imax] -- > kres ntrpol ksig1, ksig2, kpoint [, imin] [, imax] -- -- -- * description : -- -- Calculates the weighted mean value (i.e. linear interpolation) -- of two input signals -- -- -- * url : ntrpolI :: [Irate] -> Irate -> Irate -> Irate -> Irate ntrpolI i0init i1sig1 i2sig2 i3point = opcode "ntrpol" args where args = [to i1sig1, to i2sig2, to i3point] ++ map to i0init -- | * opcode : ntrpol -- -- -- * syntax : -- -- > ares ntrpol asig1, asig2, kpoint [, imin] [, imax] -- > ires ntrpol isig1, isig2, ipoint [, imin] [, imax] -- > kres ntrpol ksig1, ksig2, kpoint [, imin] [, imax] -- -- -- * description : -- -- Calculates the weighted mean value (i.e. linear interpolation) -- of two input signals -- -- -- * url : ntrpolK :: (K k0, K k1, K k2) => [Irate] -> k0 -> k1 -> k2 -> Krate ntrpolK i0init k1sig1 k2sig2 k3point = opcode "ntrpol" args where args = [to k1sig1, to k2sig2, to k3point] ++ map to i0init -- | * opcode : samphold -- -- -- * syntax : -- -- > ares samphold asig, agate [, ival] [, ivstor] -- > kres samphold ksig, kgate [, ival] [, ivstor] -- -- -- * description : -- -- Performs a sample-and-hold operation on its input. -- -- -- * url : sampholdA :: [Irate] -> Arate -> Arate -> Arate sampholdA i0init a1sig a2gate = opcode "samphold" args where args = [to a1sig, to a2gate] ++ map to i0init -- | * opcode : samphold -- -- -- * syntax : -- -- > ares samphold asig, agate [, ival] [, ivstor] -- > kres samphold ksig, kgate [, ival] [, ivstor] -- -- -- * description : -- -- Performs a sample-and-hold operation on its input. -- -- -- * url : sampholdK :: (K k0, K k1) => [Irate] -> k0 -> k1 -> Krate sampholdK i0init k1sig k2gate = opcode "samphold" args where args = [to k1sig, to k2gate] ++ map to i0init -- | * opcode : upsamp -- -- -- * syntax : -- -- > ares upsamp ksig -- -- -- * description : -- -- Modify a signal by up-sampling. -- -- -- * url : upsamp :: (K k0) => k0 -> Arate upsamp k0sig = opcode "upsamp" args where args = [to k0sig] -- | * opcode : vaget -- -- -- * syntax : -- -- > kval vaget kndx, avar -- -- -- * description : -- -- Access values of the current buffer of an a-rate variable by -- indexing. Useful for doing sample-by-sample manipulation at -- k-rate without using setksmps 1. -- -- -- * url : vaget :: (K k0) => k0 -> Arate -> Krate vaget k0ndx a1var = opcode "vaget" args where args = [to k0ndx, to a1var] -- | * opcode : vaset -- -- -- * syntax : -- -- > vaset kval, kndx, avar -- -- -- * description : -- -- Write values into the current buffer of an a-rate variable at -- the given index. Useful for doing sample-by-sample manipulation -- at k-rate without using setksmps 1. -- -- -- * url : vaset :: (K k0, K k1) => k0 -> k1 -> Arate -> SignalOut vaset k0val k1ndx a2var = outOpcode "vaset" args where args = [to k0val, to k1ndx, to a2var]