Module

WAGS.Create

Package
purescript-wags
Repository
mikesol/purescript-wags

#Create Source

class Create (a :: Type) (inIndex :: Ptr) (inGraph :: Graph) (inSkolems :: SkolemList) (outIndex :: Ptr) (outGraph :: Graph) (outSkolems :: SkolemList) (ref :: Type) | a inIndex inGraph inSkolems -> outIndex outGraph outSkolems ref where

Create audio units using template a for input universe i, resulting in output universe o as well as a reference to the top-level created audio unit(s). The example below creates a speaker, a gain unit and two sine-wave oscillators. The gain is connected to the speaker and the sine wave oscillators are connected to the gain.

create (Speaker (Gain 1.0 (SinOsc 440.0 /\ SinOsc 330.0 /\ Unit)))

Feedback loops are possible using proxies. The example below loops a gain unit into itself with a delay of 0.2 seconds, creating an echo effect.

data MyGain
myCreate =
  create (Speaker (Gain 1.0 \(myGain :: Proxy MyGain) ->
    (PlayBuf (Proxy :: _ "hello")
      /\ Highpass 440.0 1.0 (Delay 0.2 (Gain 0.5 myGain))
      /\ Unit)))

Created audio units do not have to have a Speaker at the top-level. It is possible to create an audio unit and then connect it to another one using connect.

Members

Instances

#CreationInstructions Source

class (AudioInterpret audio engine) <= CreationInstructions (audio :: Type) (engine :: Type) (g :: Type)  where

Internal class used to make term-level instructions for audio unit creation.

Members

Instances

#InitialVal Source

class InitialVal a  where

A value that can be coerced to an initial control-rate audio parameter.

Members

Instances

#ProxyCC Source

type ProxyCC skolem ptr innerTerm i0 g0 s0 i1 g1 s1 = Proxy (skolem /\ (Proxy ptr) /\ innerTerm /\ (Proxy i0) /\ (Proxy g0) /\ (Proxy s0) /\ (Proxy i1) /\ (Proxy g1) /\ (Proxy s1))