music-score-1.7.1: Musical score and part representation.

Portabilitynon-portable (TF,GNTD)
Stabilityexperimental
Maintainerhans@hanshoglund.se
Safe HaskellNone

Music.Time.Behavior

Contents

Description

Behaviors, or time-varying values.

Synopsis

Behavior type

data Behavior a Source

A Behavior is a value varying over time.

Use focusing to view a particular Segment.

Instances

Monad Behavior 
Functor Behavior 
Typeable1 Behavior 
Applicative Behavior 
Distributive Behavior 
Representable Behavior 
HasBackendNote Midi a => HasBackendNote Midi (Behavior a) 
HasBackendNote SuperCollider a => HasBackendNote SuperCollider (Behavior a) 
HasBackendNote Lilypond a => HasBackendNote Lilypond (Behavior a) 
HasBackendNote MusicXml a => HasBackendNote MusicXml (Behavior a) 
Enum a => Enum (Behavior a) 
Eq a => Eq (Behavior a) 
Floating a => Floating (Behavior a) 
Fractional a => Fractional (Behavior a) 
Num a => Num (Behavior a) 
Ord a => Ord (Behavior a) 
Real a => Real (Behavior a) 
Show (Behavior a) 
Monoid a => Monoid (Behavior a) 
Semigroup a => Semigroup (Behavior a) 
VectorSpace a => VectorSpace (Behavior a) 
IsDynamics a => IsDynamics (Behavior a) 
IsPitch a => IsPitch (Behavior a) 
IsInterval a => IsInterval (Behavior a) 
Augmentable a => Augmentable (Behavior a) 
Alterable a => Alterable (Behavior a) 
AffineSpace a => AffineSpace (Behavior a) 
AdditiveGroup a => AdditiveGroup (Behavior a) 
Transformable (Behavior a) 
Reversible (Behavior a) 
Tiable a => Tiable (Behavior a) 
(Transformable a, Transformable b, ~ * b (Pitch b)) => HasPitches (Behavior a) b 
(Transformable a, Transformable b, ~ * b (Pitch b)) => HasPitch (Behavior a) b 
(Transformable a, Transformable b, ~ * b (Dynamic b), ~ * (SetDynamic (Behavior a) b) (Behavior a)) => HasDynamics (Behavior a) b 
(Transformable a, Transformable b, ~ * b (Dynamic b), ~ * (SetDynamic (Behavior a) b) (Behavior a)) => HasDynamic (Behavior a) b 
(HasPart a a, HasPart a b) => HasParts (Behavior a) (Behavior b) 
(HasPart a a, HasPart a b) => HasPart (Behavior a) (Behavior b) 

Examples

behavior :: Iso (Time -> a) (Time -> b) (Behavior a) (Behavior b)Source

View a behavior as a time function and vice versa.

Note that this is just an alias defined to make the documentation nicer:

 behavior = tabulated

Combinators

switch :: Time -> Behavior a -> Behavior a -> Behavior aSource

Instantly switch from one behavior to another.

switch' :: Time -> Behavior a -> Behavior a -> Behavior a -> Behavior aSource

Instantly switch from one behavior to another with an optinal intermediate value.

trimBefore :: Monoid a => Time -> Behavior a -> Behavior aSource

Replace everthing before the given time by mempty.

trimAfter :: Monoid a => Time -> Behavior a -> Behavior aSource

Replace everthing after the given time by mempty.

Common behaviors

Oscillators

line :: Fractional a => Behavior aSource

A behavior that gives the current time, i.e. the identity function

Should really have the type Behavior Time, but is provided in a more general form for convenience.

sawtooth :: RealFrac a => Behavior aSource

A behavior that goes from 0 to 1 repeatedly with a period of 1.

sine :: Floating a => Behavior aSource

A behavior that

cosine :: Floating a => Behavior aSource

A behavior that

Impulse functions

unit :: Fractional a => Behavior aSource

A behavior that varies from 0 to 1 during the same time interval and is 0 before and 1 after that interval.

impulse :: Num a => Behavior aSource

A behavior that is 1 at time 0, and 0 at all other times.

turnOn :: Num a => Behavior aSource

A behavior that goes from 0 to 1 at time 0.

turnOff :: Num a => Behavior aSource

A behavior that goes from 1 to 0 at time 0.