Safe Haskell | Safe-Inferred |
---|
Signal
implementation.
Synopsis
- type Signal = Signal.Control
- type X = RealTime
- data Sample y = Sample {}
- type NoteNumber = Signal.Signal Signal.NoteNumberSig
- type Y = Double
- x_to_y :: X -> Y
- y_to_x :: Y -> X
- y_to_score :: Y -> ScoreTime
- y_to_nn :: Y -> NoteNumber
- nn_to_y :: NoteNumber -> Y
- from_sample :: X -> Y -> Signal.Signal kind
- from_pairs :: [(X, Y)] -> Signal.Signal kind
- from_segments :: [Segment Y] -> Signal.Signal kind
- to_samples :: Signal.Signal kind -> [Sample Y]
- to_pairs :: Signal.Signal kind -> [(X, Y)]
- to_pairs_desc :: Signal.Signal kind -> [(X, Y)]
- to_segments :: Signal.Signal kind -> [Segment Y]
- to_vector :: Signal.Signal kind -> Vector (Sample Y)
- constant :: Y -> Signal.Signal kind
- constant_val :: Signal.Signal kind -> Maybe Y
- constant_val_from :: X -> Signal.Signal kind -> Maybe Y
- zero_or_below :: Signal.Signal kind -> Bool
- beginning :: RealTime
- prepend :: Signal.Signal kind -> Signal.Signal kind -> Signal.Signal kind
- unfoldr :: (state -> Maybe ((X, Y), state)) -> state -> Signal.Signal kind
- coerce :: Signal.Signal kind1 -> Signal.Signal kind2
- to_piecewise_constant :: X -> Signal.Signal kind -> Unboxed
- with_ptr :: Signal.Display -> (X -> Ptr (Sample Y) -> Int -> IO a) -> IO a
- null :: Signal.Signal kind -> Bool
- at :: Signal.Signal kind -> X -> Y
- at_maybe :: Signal.Signal kind -> X -> Maybe Y
- segment_at :: Signal.Signal kind -> X -> Maybe (Segment Y)
- head :: Signal.Signal kind -> Maybe (X, Y)
- last :: Signal.Signal kind -> Maybe (X, Y)
- drop_after :: X -> Signal.Signal kind -> Signal.Signal kind
- drop_before :: X -> Signal.Signal kind -> Signal.Signal kind
- clip_after :: X -> Signal.Signal kind -> Signal.Signal kind
- clip_before :: X -> Signal.Signal kind -> Signal.Signal kind
- clip_before_segments :: X -> Signal.Signal kind -> [Segment Y]
- clip_before_pairs :: X -> Signal.Signal kind -> [(X, Y)]
- clip_after_keep_last :: X -> Signal.Signal kind -> Signal.Signal kind
- shift :: X -> Signal.Signal kind -> Signal.Signal kind
- invert :: Signal.Signal kind -> Signal.Signal kind
- sig_add :: Signal.Control -> Signal.Control -> Signal.Control
- sig_multiply :: Signal.Control -> Signal.Control -> Signal.Control
- sig_subtract :: Signal.Control -> Signal.Control -> Signal.Control
- sig_scale :: Signal.Control -> Signal.Control -> Signal.Control
- scale :: Y -> Y -> Y
- scale_invert :: Y -> Y -> Y
- drop_discontinuity_at :: X -> Signal.Control -> Signal.Control
- scalar_add :: Y -> Signal.Signal kind -> Signal.Signal kind
- scalar_subtract :: Y -> Signal.Signal kind -> Signal.Signal kind
- scalar_multiply :: Y -> Signal.Signal kind -> Signal.Signal kind
- scalar_divide :: Y -> Signal.Signal kind -> Signal.Signal kind
- scalar_scale :: Y -> Signal.Signal kind -> Signal.Signal kind
- scalar_max :: Y -> Signal.Signal kind -> Signal.Signal kind
- minimum :: Signal.Signal kind -> Y
- maximum :: Signal.Signal kind -> Y
- find :: (X -> Y -> Bool) -> Signal.Signal kind -> Maybe (X, Y)
- map_x :: (X -> X) -> Signal.Signal kind -> Signal.Signal kind
- map_y :: X -> (Y -> Y) -> Signal.Signal kind -> Signal.Signal kind
- map_y_linear :: (Y -> Y) -> Signal.Signal kind -> Signal.Signal kind
- map_err :: (Sample Y -> Either err (Sample Y)) -> Signal.Signal kind -> (Signal.Signal kind, [err])
- integrate_inverse :: Signal.Tempo -> Signal.Warp
- integrate :: Signal.Tempo -> Signal.Warp
- tempo_srate :: X
Documentation
type Signal = Signal.Control Source #
Instances
Storable (Sample Double) Source # | |
Defined in Util.TimeVectorStorable sizeOf :: Sample Double -> Int # alignment :: Sample Double -> Int # peekElemOff :: Ptr (Sample Double) -> Int -> IO (Sample Double) # pokeElemOff :: Ptr (Sample Double) -> Int -> Sample Double -> IO () # peekByteOff :: Ptr b -> Int -> IO (Sample Double) # pokeByteOff :: Ptr b -> Int -> Sample Double -> IO () # | |
Show y => Show (Sample y) Source # | |
CStorable (Sample Double) Source # | |
Defined in Util.TimeVectorStorable sizeOf :: Sample Double -> Int # alignment :: Sample Double -> Int # peekElemOff :: Ptr (Sample Double) -> Int -> IO (Sample Double) # pokeElemOff :: Ptr (Sample Double) -> Int -> Sample Double -> IO () # peekByteOff :: Ptr b -> Int -> IO (Sample Double) # pokeByteOff :: Ptr b -> Int -> Sample Double -> IO () # | |
Eq y => Eq (Sample y) Source # | |
Pretty y => Pretty (Sample y) Source # | |
Serialize y => Serialize (Sample y) Source # | |
FromJSON (Sample Double) Source # | |
ToJSON (Sample Double) 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.
y_to_score :: Y -> ScoreTime Source #
Some control signals may be interpreted as score time.
y_to_nn :: Y -> NoteNumber Source #
nn_to_y :: NoteNumber -> Y Source #
from_sample :: X -> Y -> Signal.Signal kind Source #
from_pairs :: [(X, Y)] -> Signal.Signal kind Source #
from_segments :: [Segment Y] -> Signal.Signal kind Source #
to_samples :: Signal.Signal kind -> [Sample Y] Source #
to_pairs_desc :: Signal.Signal kind -> [(X, Y)] Source #
to_segments :: Signal.Signal kind -> [Segment Y] Source #
constant :: Y -> Signal.Signal kind Source #
constant_val :: Signal.Signal kind -> Maybe Y Source #
Just if the signal is constant.
constant_val_from :: X -> Signal.Signal kind -> Maybe Y Source #
zero_or_below :: Signal.Signal kind -> Bool Source #
True if the signal becomes <=0 at any point. This assumes the signal starts at X==0, which is true of signals from control tracks only.
prepend :: Signal.Signal kind -> Signal.Signal kind -> Signal.Signal kind Source #
coerce :: Signal.Signal kind1 -> Signal.Signal kind2 Source #
Sometimes signal types need to be converted.
to_piecewise_constant :: X -> Signal.Signal kind -> Unboxed Source #
null :: Signal.Signal kind -> Bool Source #
segment_at :: Signal.Signal kind -> X -> Maybe (Segment Y) Source #
drop_after :: X -> Signal.Signal kind -> Signal.Signal kind Source #
drop_before :: X -> Signal.Signal kind -> Signal.Signal kind Source #
clip_after :: X -> Signal.Signal kind -> Signal.Signal kind Source #
clip_before :: X -> Signal.Signal kind -> Signal.Signal kind Source #
clip_before_segments :: X -> Signal.Signal kind -> [Segment Y] Source #
clip_before_pairs :: X -> Signal.Signal kind -> [(X, 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
.
shift :: X -> Signal.Signal kind -> Signal.Signal kind Source #
invert :: Signal.Signal kind -> Signal.Signal kind Source #
sig_add :: Signal.Control -> Signal.Control -> Signal.Control Source #
scalar_add :: Y -> Signal.Signal kind -> Signal.Signal kind Source #
scalar_subtract :: Y -> Signal.Signal kind -> Signal.Signal kind Source #
scalar_multiply :: Y -> Signal.Signal kind -> Signal.Signal kind Source #
scalar_divide :: Y -> Signal.Signal kind -> Signal.Signal kind Source #
scalar_scale :: Y -> Signal.Signal kind -> Signal.Signal kind 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.
minimum :: Signal.Signal kind -> Y Source #
maximum :: Signal.Signal kind -> Y Source #
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.
tempo_srate :: X Source #