Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Synth.Shared.Signal

Description

Signal implementation.

Synopsis

Documentation

data Sample y Source #

Constructors

Sample 

Fields

Instances
CRC32 Unboxed # 
Instance details

Defined in Util.TimeVector

Eq y => Eq (Sample y) # 
Instance details

Defined in Util.TimeVectorStorable

Methods

(==) :: Sample y -> Sample y -> Bool #

(/=) :: Sample y -> Sample y -> Bool #

Show y => Show (Sample y) # 
Instance details

Defined in Util.TimeVectorStorable

Methods

showsPrec :: Int -> Sample y -> ShowS #

show :: Sample y -> String #

showList :: [Sample y] -> ShowS #

Storable (Sample Double) # 
Instance details

Defined in Util.TimeVectorStorable

CStorable (Sample Double) # 
Instance details

Defined in Util.TimeVectorStorable

ToJSON (Sample Double) # 
Instance details

Defined in Util.TimeVectorStorable

FromJSON (Sample Double) # 
Instance details

Defined in Util.TimeVectorStorable

Pretty y => Pretty (Sample y) # 
Instance details

Defined in Util.TimeVector

Serialize y => Serialize (Sample y) # 
Instance details

Defined in Util.TimeVectorStorable

Methods

put :: Putter (Sample y) Source #

get :: Get (Sample y) Source #

type NoteNumber = Signal.Signal Signal.NoteNumberSig Source #

This is the type of pitch signals used by the performer, after the scale has been factored out.

type Y = Double Source #

x_to_y :: X -> Y Source #

y_to_x :: Y -> X Source #

y_to_score :: Y -> ScoreTime Source #

Some control signals may be interpreted as score time.

to_pairs :: Signal.Signal kind -> [(X, Y)] Source #

to_pairs_unique :: Signal.Signal kind -> [(X, Y)] Source #

Like to_pairs, but filter out explicit discontinuities. This is because tests were written before they existed, so a lot will break. TODO update the tests

constant_val :: Signal.Signal kind -> Maybe Y Source #

Just if the signal is constant.

unfoldr :: (state -> Maybe ((X, Y), state)) -> state -> Signal.Signal kind Source #

coerce :: Signal.Signal kind1 -> Signal.Signal kind2 Source #

Sometimes signal types need to be converted.

with_ptr :: Signal.Display -> (X -> Ptr (Sample Y) -> Int -> IO a) -> IO a Source #

at :: X -> Signal.Signal kind -> Y Source #

clip_after_keep_last :: X -> Signal.Signal kind -> Signal.Signal kind Source #

Like clip_after, but always put a sample at the end time, even if it's flat. This is not necessary if you keep this as a Signal since (<>) will extend the final sample, but might be if you go to breakpoints via to_pairs.

scale :: Y -> Y -> Y Source #

scalar_max :: Y -> Signal.Signal kind -> Signal.Signal kind Source #

Clip signal to never go below the given value.

This is way more complicated than the piecewise constant version.

map_x :: (X -> X) -> Signal.Signal kind -> Signal.Signal kind Source #

Map Xs. The slopes will definitely change unless the function is adding a constant, but presumably that's what you want.

map_y :: X -> (Y -> Y) -> Signal.Signal kind -> Signal.Signal kind Source #

Map Ys. This resamples the signal, so it's valid for a nonlinear function.

map_y_linear :: (Y -> Y) -> Signal.Signal kind -> Signal.Signal kind Source #

If the function is linear, there's no need to resample.

map_err :: (Sample Y -> Either err (Sample Y)) -> Signal.Signal kind -> (Signal.Signal kind, [err]) Source #

integrate :: Signal.Tempo -> Signal.Warp Source #

Integrate the signal.

Since the output will have more samples than the input, this needs a sampling rate. The sampling rate determines the resolution of the tempo track. So it can probably be fairly low resolution before having a noticeable impact.

TODO this is only called after map_y at srate, so it's already been resampled. Maybe it would be more efficient to remove srate from Segment.integrate.

flat_duration :: Signal.Warp -> ScoreTime Source #

Total duration of horizontal segments in the warp signal. These are the places where compose_hybrid will emit a 1/1 line.