Safe Haskell | None |
---|---|
Language | Haskell2010 |
LiveCoding.Pulse
Synopsis
- type PulseT m = WriterT (Sum Float) m
- type PulseCell m a b = Cell (PulseT m) a b
- addSample :: Monad m => PulseCell m Float ()
- sampleRate :: Num a => a
- pulseHandle :: Handle IO Simple
- pulseWrapC :: Int -> PulseCell IO a b -> Cell (HandlingStateT IO) a [b]
- wrapSum :: (Monad m, Data a, RealFloat a) => Cell m a a
- wrapIntegral :: (Monad m, Data a, RealFloat a) => Cell m a a
- sawtooth :: (Monad m, Data a, RealFloat a) => Cell m a a
- modSum :: (Monad m, Data a, Integral a) => a -> Cell m a a
- clamp :: (Ord a, Num a) => a -> a -> a -> a
- osc :: (Data a, RealFloat a, Monad m) => Cell (ReaderT a m) () a
- oscAt :: (Data a, RealFloat a, Monad m) => a -> Cell m () a
- osc' :: (Data a, RealFloat a, Monad m) => Cell m a a
- data Note
- f :: Note -> Float
- o :: Float -> Float
- oB :: Float -> Float
Documentation
sampleRate :: Num a => a Source #
Globally fix the sample rate to 48000 samples per second.
pulseHandle :: Handle IO Simple Source #
Create a pulse server backend handle.
Currently, this is always mono,
but with a future release of pulse-simple
,
this might be configurable.
Arguments
:: Int | Specifies how many steps of your |
-> PulseCell IO a b | Your cell that produces samples. |
-> Cell (HandlingStateT IO) a [b] |
Run a PulseCell
with a started pulse backend.
Currently, this is synchronous and blocking, i.e. the resulting cell will block until the backend buffer is nearly empty.
This performs several steps of your cell at a time, replicating the input so many times.
wrapSum :: (Monad m, Data a, RealFloat a) => Cell m a a Source #
Returns the sum of all incoming values, and wraps it between -1 and 1.
This is to prevent floating number imprecision when the sum gets too large.
wrapIntegral :: (Monad m, Data a, RealFloat a) => Cell m a a Source #
Like wrapSum
, but as an integral, assuming the PulseAudio sampleRate
.
sawtooth :: (Monad m, Data a, RealFloat a) => Cell m a a Source #
A sawtooth, or triangle wave, generator, outputting a sawtooth wave with the given input as frequency.
oscAt :: (Data a, RealFloat a, Monad m) => a -> Cell m () a Source #
A sine oscillator, at a fixed frequency.
osc' :: (Data a, RealFloat a, Monad m) => Cell m a a Source #
A sine oscillator, at a frequency that can be specified live.