Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Envelope generators.
Synopsis
- data Envelope_Curve a
- type Envelope_Curve_2 a = T2 (Envelope_Curve a)
- type Envelope_Curve_3 a = T3 (Envelope_Curve a)
- type Envelope_Curve_4 a = T4 (Envelope_Curve a)
- env_curve_shape :: Num a => Envelope_Curve a -> a
- env_curve_value :: Num a => Envelope_Curve a -> a
- env_curve_interpolation_f :: (Ord t, Floating t) => Envelope_Curve t -> Interpolation_F t
- env_curve_coerce :: (a -> b) -> Envelope_Curve a -> Envelope_Curve b
- data Envelope a = Envelope {
- env_levels :: [a]
- env_times :: [a]
- env_curves :: [Envelope_Curve a]
- env_release_node :: Maybe Int
- env_loop_node :: Maybe Int
- env_offset :: a
- envelope_coerce :: (a -> b) -> Envelope a -> Envelope b
- envelope :: Num a => [a] -> [a] -> [Envelope_Curve a] -> Envelope a
- envelope_duration :: Num n => Envelope n -> n
- envelope_n_segments :: Integral i => Envelope n -> i
- envelope_segment_ix :: (Ord a, Num a) => Envelope a -> a -> Maybe Int
- type Envelope_Segment t = (t, t, t, t, Envelope_Curve t)
- envelope_segment :: Num t => Envelope t -> Int -> Envelope_Segment t
- envelope_segments :: Num t => Envelope t -> [Envelope_Segment t]
- pack_envelope_segments :: Num t => [Envelope_Segment t] -> ([t], [t], [Envelope_Curve t])
- envelope_is_normal :: (Eq n, Num n) => Envelope n -> Bool
- envelope_normalise :: (Num a, Ord a) => Envelope a -> Envelope a
- envelope_at :: (Ord t, Floating t) => Envelope t -> t -> t
- envelope_render :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [(t, t)]
- envelope_table :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [t]
- envelope_curves :: Envelope a -> [Envelope_Curve a]
- envelope_sc3_array :: Num a => Envelope a -> Maybe [a]
- envelope_sc3_ienvgen_array :: Num a => Envelope a -> Maybe [a]
- env_is_sustained :: Envelope a -> Bool
- env_delay :: Envelope a -> a -> Envelope a
- env_circle_z :: Fractional a => a -> a -> Envelope_Curve a -> Envelope a -> Envelope a
- env_circle_0 :: Fractional a => Envelope a -> Envelope a
- envTrapezoid_f :: Num t => (t -> t -> t, t -> t -> t) -> t -> t -> t -> t -> Envelope t
- envCoord :: Num n => [(n, n)] -> n -> n -> Envelope_Curve n -> Envelope n
- envPairs :: (Num n, Ord n) => [(n, n)] -> Envelope_Curve n -> Envelope n
- envPerc_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a
- envPerc :: Num a => a -> a -> Envelope a
- envTriangle :: Fractional a => a -> a -> Envelope a
- envSine :: Fractional a => a -> a -> Envelope a
- data LINEN a = LINEN {
- linen_attackTime :: a
- linen_sustainTime :: a
- linen_releaseTime :: a
- linen_level :: a
- linen_curve :: Envelope_Curve_3 a
- linen_def :: Fractional t => LINEN t
- envLinen_r :: Num a => LINEN a -> Envelope a
- envLinen_c :: Num a => a -> a -> a -> a -> Envelope_Curve_3 a -> Envelope a
- envLinen :: Num a => a -> a -> a -> a -> Envelope a
- data ADSR a = ADSR {
- adsr_attackTime :: a
- adsr_decayTime :: a
- adsr_sustainLevel :: a
- adsr_releaseTime :: a
- adsr_peakLevel :: a
- adsr_curve :: Envelope_Curve_3 a
- adsr_bias :: a
- adsr_def :: Fractional n => ADSR n
- envADSR :: Num a => a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a
- envADSR_def :: Num a => a -> a -> a -> a -> Envelope a
- envADSR_r :: Num a => ADSR a -> Envelope a
- data ADSSR a = ADSSR {
- adssr_attackTime :: a
- adssr_attackLevel :: a
- adssr_decayTime :: a
- adssr_decayLevel :: a
- adssr_slopeTime :: a
- adssr_sustainLevel :: a
- adssr_releaseTime :: a
- adssr_curve :: Envelope_Curve_4 a
- adssr_bias :: a
- envADSSR :: Num a => a -> a -> a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a
- envADSSR_r :: Num a => ADSSR a -> Envelope a
- data ASR a = ASR {
- asr_attackTime :: a
- asr_sustainLevel :: a
- asr_releaseTime :: a
- asr_curve :: Envelope_Curve_2 a
- asr_def :: Fractional t => ASR t
- envASR_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a
- envASR :: Num a => a -> a -> a -> Envelope_Curve a -> Envelope a
- envASR_r :: Num a => ASR a -> Envelope a
- envStep :: Num a => [a] -> [a] -> Maybe Int -> Maybe Int -> Envelope a
- envXYC :: Num n => [(n, n, Envelope_Curve n)] -> Envelope n
- envXYC_sort :: (Num n, Ord n) => [(n, n, Envelope_Curve n)] -> Envelope n
Curve
data Envelope_Curve a Source #
Envelope curve indicator input.
Instances
Eq a => Eq (Envelope_Curve a) Source # | |
Defined in Sound.SC3.Common.Envelope (==) :: Envelope_Curve a -> Envelope_Curve a -> Bool # (/=) :: Envelope_Curve a -> Envelope_Curve a -> Bool # | |
Show a => Show (Envelope_Curve a) Source # | |
Defined in Sound.SC3.Common.Envelope showsPrec :: Int -> Envelope_Curve a -> ShowS # show :: Envelope_Curve a -> String # showList :: [Envelope_Curve a] -> ShowS # |
type Envelope_Curve_2 a = T2 (Envelope_Curve a) Source #
Envelope curve pair.
type Envelope_Curve_3 a = T3 (Envelope_Curve a) Source #
Envelope curve triple.
type Envelope_Curve_4 a = T4 (Envelope_Curve a) Source #
Envelope curve quadruple.
env_curve_shape :: Num a => Envelope_Curve a -> a Source #
Convert Envelope_Curve
to shape value.
map env_curve_shape [EnvSin,EnvSqr] == [3,6]
env_curve_value :: Num a => Envelope_Curve a -> a Source #
The value of EnvCurve
is non-zero for EnvNum
.
map env_curve_value [EnvWelch,EnvNum 2] == [0,2]
env_curve_interpolation_f :: (Ord t, Floating t) => Envelope_Curve t -> Interpolation_F t Source #
Interpolation_F
of Envelope_Curve
.
env_curve_coerce :: (a -> b) -> Envelope_Curve a -> Envelope_Curve b Source #
Apply f to EnvNum
value.
Envelope
SC3 envelope segment model
Envelope | |
|
envelope :: Num a => [a] -> [a] -> [Envelope_Curve a] -> Envelope a Source #
Variant without release and loop node inputs (defaulting to nil).
Sound.SC3.Plot.plotEnvelope [envelope [0,1,0] [3,2] [EnvSin,EnvSin]]
envelope_n_segments :: Integral i => Envelope n -> i Source #
envelope_segment_ix :: (Ord a, Num a) => Envelope a -> a -> Maybe Int Source #
Determine which envelope segment a given time t falls in.
type Envelope_Segment t = (t, t, t, t, Envelope_Curve t) Source #
A set of start time, start level, end time, end level and curve.
envelope_segment :: Num t => Envelope t -> Int -> Envelope_Segment t Source #
Extract envelope segment given at index i.
envelope_segments :: Num t => Envelope t -> [Envelope_Segment t] Source #
Extract all segments.
pack_envelope_segments :: Num t => [Envelope_Segment t] -> ([t], [t], [Envelope_Curve t]) Source #
Transform list of Envelope_Segment
s into lists (env_levels
,env_times
,env_curves
).
envelope_is_normal :: (Eq n, Num n) => Envelope n -> Bool Source #
An envelope is normal if it has no segments with zero duration.
envelope_normalise :: (Num a, Ord a) => Envelope a -> Envelope a Source #
Normalise envelope by deleting segments of zero duration.
envelope_at :: (Ord t, Floating t) => Envelope t -> t -> t Source #
Get value for Envelope
at time t, or zero if t is out of
range. By convention if the envelope has a segment of zero
duration we give the rightmost value.
envelope_render :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [(t, t)] Source #
Render Envelope
to breakpoint set of n equi-distant places.
envelope_table :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [t] Source #
Contruct a lookup table of n places from Envelope
.
envelope_curves :: Envelope a -> [Envelope_Curve a] Source #
Variant on env_curves
that expands the, possibly empty, user
list by cycling (if not empty) or by filling with EnvLin
.
envelope_sc3_array :: Num a => Envelope a -> Maybe [a] Source #
Linear SC3 form of Envelope
data.
Form is: l0 #t reset loop l1 t0 c0 c0' ...
envelope_sc3_array (envelope [0,1] [0.1] [EnvLin]) == Just [0,1,-99,-99,1,0.1,1,0]
let {l = [0,0.6,0.3,1.0,0] ;t = [0.1,0.02,0.4,1.1] ;c = [EnvLin,EnvExp,EnvNum (-6),EnvSin] ;e = Envelope l t c Nothing Nothing ;r = [0,4,-99,-99,0.6,0.1,1,0,0.3,0.02,2,0,1,0.4,5,-6,0,1.1,3,0]} in envelope_sc3_array e == Just r
envelope_sc3_ienvgen_array :: Num a => Envelope a -> Maybe [a] Source #
IEnvGen
SC3 form of Envelope
data.
l = [0,0.6,0.3,1.0,0] t = [0.1,0.02,0.4,1.1] c = [EnvLin,EnvExp,EnvNum (-6),EnvSin] e = Envelope l t c Nothing Nothing 0 r = [0,0,4,1.62,0.1,1,0,0.6,0.02,2,0,0.3,0.4,5,-6,1,1.1,3,0,0] envelope_sc3_ienvgen_array e == Just r
env_is_sustained :: Envelope a -> Bool Source #
True
if env_release_node
is not Nothing
.
env_delay :: Envelope a -> a -> Envelope a Source #
Delay the onset of the envelope (add initial segment).
env_circle_z :: Fractional a => a -> a -> Envelope_Curve a -> Envelope a -> Envelope a Source #
Connect releaseNode (or end) to first node of envelope. z is a value that is first zero and thereafter one. tc & cc are time and curve from first to last.
env_circle_0 :: Fractional a => Envelope a -> Envelope a Source #
env_circle_z with cycle time of zero.
Construct
envTrapezoid_f :: Num t => (t -> t -> t, t -> t -> t) -> t -> t -> t -> t -> Envelope t Source #
Trapezoidal envelope generator.
Requires (and (=) functions returning 1
for true and 0
for false.
The arguments are: 1. shape
determines the sustain time as a
proportion of dur
, zero is a triangular envelope, one a rectangular
envelope; 2. skew
determines the attack/decay ratio, zero is an
immediate attack and a slow decay, one a slow attack and an immediate
decay; 3. duration
in seconds; 4. amplitude
as linear gain.
envCoord :: Num n => [(n, n)] -> n -> n -> Envelope_Curve n -> Envelope n Source #
Coordinate based static envelope generator. Points are (time,value) pairs.
let e = envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin envelope_sc3_array e == Just [0,2,-99,-99,1,1/4,1,0,0,3/4,1,0]
import Sound.SC3.Plot
plotEnvelope [envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin]
envPairs :: (Num n, Ord n) => [(n, n)] -> Envelope_Curve n -> Envelope n Source #
Segments given as pairs of (time,level). The input is sorted by time before processing.
envPairs [(0, 1), (3, 1.4), (2.1, 0.5)] EnvSin
envPerc_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a Source #
Variant envPerc
with user specified 'Envelope_Curve a'.
envPerc :: Num a => a -> a -> Envelope a Source #
Percussive envelope, with attack, release, level and curve inputs.
envTriangle :: Fractional a => a -> a -> Envelope a Source #
Triangular envelope, with duration and level inputs.
let e = envTriangle 1 0.1 in envelope_sc3_array e = Just [0,2,-99,-99,0.1,0.5,1,0,0,0.5,1,0]
envSine :: Fractional a => a -> a -> Envelope a Source #
Sine envelope, with duration and level inputs.
let e = envSine 0 0.1 in envelope_sc3_array e == Just [0,2,-99,-99,0.1,0,3.0,0,0,0,3,0]
Parameters for LINEN envelopes.
LINEN | |
|
linen_def :: Fractional t => LINEN t Source #
SC3 defaults for LINEN.
envLinen_c :: Num a => a -> a -> a -> a -> Envelope_Curve_3 a -> Envelope a Source #
Variant of envLinen
with user specified 'Envelope_Curve a'.
envLinen :: Num a => a -> a -> a -> a -> Envelope a Source #
Linear envelope parameter constructor.
e = envLinen 0 1 0 1 s = envelope_segments e p = pack_envelope_segments s p == (env_levels e,env_times e,env_curves e)
Parameters for ADSR envelopes. The sustain level is given as a proportion of the peak level.
ADSR | |
|
adsr_def :: Fractional n => ADSR n Source #
SC3 defaults for ADSR.
envADSR :: Num a => a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a Source #
Attack, decay, sustain, release envelope parameter constructor.
envADSR_def :: Num a => a -> a -> a -> a -> Envelope a Source #
Variant with defaults for pL, c and b.
Parameters for Roland type ADSSR envelopes.
ADSSR | |
|
envADSSR :: Num a => a -> a -> a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a Source #
Attack, decay, slope, sustain, release envelope parameter constructor.
Parameters for ASR envelopes.
ASR | |
|
asr_def :: Fractional t => ASR t Source #
SC3 default values for ASR.
envASR_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a Source #
SC3 .asr has singular curve argument, hence _c suffix.
envASR :: Num a => a -> a -> a -> Envelope_Curve a -> Envelope a Source #
Attack, sustain, release envelope parameter constructor.
c = 3 r = Just [0,2,1,-99,0.1,3,c,0,0,2,c,0] envelope_sc3_array (envASR 3 0.1 2 EnvSin) == r
envStep :: Num a => [a] -> [a] -> Maybe Int -> Maybe Int -> Envelope a Source #
All segments are horizontal lines.
envXYC :: Num n => [(n, n, Envelope_Curve n)] -> Envelope n Source #
Segments given as triples of (time,level,curve). The final curve is ignored.
envXYC [(0, 1, EnvSin), (2.1, 0.5, EnvLin), (3, 1.4, EnvLin)]
envXYC_sort :: (Num n, Ord n) => [(n, n, Envelope_Curve n)] -> Envelope n Source #
Variant where the input is sorted by time before processing.
envXYC_sort [(0, 1, EnvSin), (3, 1.4, EnvLin), (2.1, 0.5, EnvLin)]