Module

WAGS.Validation

Package
purescript-wags
Repository
mikesol/purescript-wags

Validation algorithms for audio graphs.

Validation includes making sure the graph is renderable by the web audio API and retrieving information about valid graphs, like their terminal node (ie a loudspeaker).

#GraphIsRenderable Source

class GraphIsRenderable (graph :: Graph) 

Asserts that an audio graph is renderable.

Every time that makeScene is called, we assert that the graph is renderable. This means that it can be played by the WebAudio API without any runtime errors. Note that this assertion is a compile time assertion and not a runtime assertion. This means that, when your program is compiled, it is guaranteed to be renderable by the WebAudio API assuming that it is within the memory constraints of a given browser and computer. Usually, these memory limits are not hit unless one has hundreds of active nodes.

Instances

#TerminalNodeC Source

class TerminalNodeC (g :: Graph) (ptr :: Symbol) | g -> ptr

Retrieves the terminal node from an audio grpah. This is almost always a speaker or recording, but if the graph is at an intermediary stage of construction, this could be another top-level node, ie a gain node.

Instances

#NoNodesAreDuplicated Source

class NoNodesAreDuplicated (graph :: Graph) 

Instances

#AllEdgesInGraph' Source

class AllEdgesInGraph' (edgeProfile :: EdgeList) (graph :: Graph) 

Assert that all edges are present as nodes in a graph

Instances

#AllEdgesInGraph Source

class AllEdgesInGraph (graphAsList :: NodeList) (graph :: Graph) 

Assert that all edges are present as nodes in a graph

Instances

#AllEdgesPointToNodes Source

class AllEdgesPointToNodes (graph :: Graph) 

Assertion that all edges in the graph point to a node in the graph.

Instances

#NoParallelEdgesNL Source

class NoParallelEdgesNL (nodeList :: NodeList) 

Assertion that nodeList contains no parallel edges. Parallel edges are two or more edges from node1 to node2 in a list of nodes.

Instances

#NoParallelEdges Source

class NoParallelEdges (graph :: Graph) 

Assertion that graph contains no parallel edges. Parallel edges are two or more edges from node1 to node2 in a list of nodes.

Instances

#SourceNodes Source

class SourceNodes (nodeList :: NodeList) (output :: NodeList) | nodeList -> output

Tail-recursive lookup of all nodes in a graph without incoming edges.

  • nodeList is the list of nodes that will be searched over.
  • output contains all nodes without incoming edges.

Instances

#HasSourceNodes Source

class HasSourceNodes (graph :: Graph) 

Assertion that a graph has source nodes. Source nodes are nodes without incoming edges.

Instances

#SymPresentInAtLeastOneEdge Source

class SymPresentInAtLeastOneEdge (tf :: Type) (sym :: Symbol) (graphAsList :: RowList Type) (o :: Type) | tf sym graphAsList -> o

Instances

#GetTerminii Source

class GetTerminii (toVisit :: NodeList) (graphAsNodeList :: NodeList) (output :: NodeList) | toVisit graphAsNodeList -> output

The algorithm that finds the terminal nodes of a graph.

Instances

#UniqueTerminus Source

class UniqueTerminus (graph :: Graph) (sym :: Symbol) (node :: Type) | graph -> sym node

Assertion that graph has the unique terminus node. Note that, due to the fundep, the assertion also finds the unique terminus if it exists.

Instances

#HasUniqueTerminus Source

class HasUniqueTerminus (graph :: Graph) 

Assertion that graph has a unique terminus.

Instances

#AllNodesAreSaturatedNL Source

class AllNodesAreSaturatedNL (graph :: NodeList) 

Asserts that all nodes in graph are saturated. "Saturation" for audio nodes is similar to the concept of saturation in types, namely that they have all the information necessary to render. In doing so, it also fails the assertion on degenerate nodes, ie sine-wave oscillators with input (which wouldn't make sense).

Instances

#AllNodesAreSaturated Source

class AllNodesAreSaturated (graph :: Graph) 

Asserts that all nodes in graph are saturated. This is the same as the node-list algorithm, but for a graph.

Instances

#NodeIsOutputDevice Source

class NodeIsOutputDevice (node :: Type) 

Asserts the node is an output device. Currently, in the web-audio API, this is a loudspeaker or recorder.

Instances