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

Copyright(c) Hans Hoglund 2012-2014
LicenseBSD-style
Maintainerhans@hanshoglund.se
Stabilityexperimental
Portabilitynon-portable (TF,GNTD)
Safe HaskellNone
LanguageHaskell2010

Music.Time.Behavior

Contents

Description

 

Synopsis

Behavior type

data Behavior a Source

A Behavior is a value varying over time.

Instances

Monad Behavior 
Functor 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) 
IsString a => IsString (Behavior a) 
Monoid a => Monoid (Behavior a) 
Semigroup a => Semigroup (Behavior a) 
VectorSpace a => VectorSpace (Behavior a) 
AdditiveGroup a => AdditiveGroup (Behavior a) 
AffineSpace a => AffineSpace (Behavior a) 
IsPitch a => IsPitch (Behavior a) 
IsInterval a => IsInterval (Behavior a) 
IsDynamics a => IsDynamics (Behavior a) 
Transformable (Behavior a) 
Reversible (Behavior a) 
Alterable a => Alterable (Behavior a) 
Augmentable a => Augmentable (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) 
Typeable (* -> *) Behavior 
type Rep Behavior = Time 
type SetPitch b (Behavior a) = b 
type SetDynamic b (Behavior a) = b 
type Scalar (Behavior a) = Behavior (Scalar a) 
type Diff (Behavior a) = Behavior (Diff a) 
type Part (Behavior a) = Behavior (Part a) 
type Pitch (Behavior a) = Behavior a 
type Dynamic (Behavior a) = Behavior a 
type SetPart (Behavior g) (Behavior a) = Behavior (SetPart g a) 

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 a Source

Instantly switch from one behavior to another.

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

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

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

Replace everthing before the given time by mempty.

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

Replace everthing after the given time by mempty.

Common behaviors

Oscillators

line :: Fractional a => Behavior a Source

A behavior that gives the current time.

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

sawtooth :: RealFrac a => Behavior a Source

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

sine :: Floating a => Behavior a Source

A behavior that

cosine :: Floating a => Behavior a Source

A behavior that

Impulse functions

unit :: Fractional a => Behavior a Source

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 a Source

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

turnOn :: Behavior Integer Source

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

turnOff :: Behavior Integer Source

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