-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | HDF: Uniform Rate Audio Signal Processing in Haskell -- @package hdf @version 0.15 -- | Unique identifiers. module Sound.DF.Uniform.LL.UId -- | Identifiers are integers. type Id = Int -- | Class of monads generating identifers class Monad m => UId m generateId :: UId m => m Id -- | Evaluate m DF. evalId :: State Id a -> a instance UId (State Id) instance UId IO -- | Data flow wire values. module Sound.DF.Uniform.LL.K -- | Vector identifier. data V_Id V_Id :: Id -> V_Id -- | Vector type. data Vec a Vec :: V_Id -> Int -> [a] -> Vec a -- | Id of V_Id of Vec. vec_id :: Vec t -> Id -- | Concise pretty printer and Show instance for Vec. -- --
--   vec_concise (Vec (V_Id 0) 1 [0]) == "vec(0,1)"
--   
vec_concise :: Vec a -> String -- | Sum type for wire values. N = nil, B = boolean, I = integer, F = -- floating point, V = vector (array). data K N :: () -> K B :: Bool -> K I :: Int32 -> K F :: Float -> K V :: (Vec Float) -> K -- | Typeable instance for K. -- -- map k_typeOf [B False,I 0,F 0.0] == [bool_t,int32_t,float_t] k_typeOf :: K -> TypeRep -- | Concise pretty printer and Show instance for K. k_concise :: K -> String -- | typeOf (). nil_t :: TypeRep -- | typeOf of Bool. bool_t :: TypeRep -- | typeOf of Int32. int32_t :: TypeRep -- | typeOf of Float. float_t :: TypeRep -- | typeOf of (Vec Float). vec_float_t :: TypeRep -- | Class for values that can be lifted to K. class (Typeable a, Eq a, Ord a, Show a) => K' a to_k :: K' a => a -> K -- | Composite of Ord and K'. class (K' a, Ord a) => K_Ord a -- | Composite of K_Ord and Num. class (K_Ord a, Num a) => K_Num a instance Typeable Vec instance Typeable K instance Eq V_Id instance Ord V_Id instance Show V_Id instance Eq a => Eq (Vec a) instance Ord a => Ord (Vec a) instance Show a => Show (Vec a) instance Eq K instance K_Num Float instance K_Num Int32 instance K_Ord Float instance K_Ord Int32 instance K_Ord Bool instance K' (Vec Float) instance K' Float instance K' Int32 instance K' Bool instance K' () instance Show K -- | Elementary dot. module Sound.DF.Uniform.LL.Dot -- | Map from TypeRep to colour name. -- --
--   map (ty_colour . Just) [int32_t,float_t] == ["orange","blue"]
--   
ty_colour :: Maybe TypeRep -> String -- | Left & right bracket. -- --
--   w_bracket '(' ')' "parentheses" == "(parentheses)"
--   
w_bracket :: a -> a -> [a] -> [a] -- | Dot notation for key,value attributes. dot_attr :: [(String, String)] -> String -- | Dot node as record. Constant values are drawn directly into -- input ports. The nm String has the df_ prefix -- removed for printing. -- --
--   dot_rec 0 "nm" [] (Just float_t)
--   
dot_rec :: Id -> String -> [Either Int K] -> Maybe TypeRep -> String -- | Make arguments input for dot_rec from arity. dot_rec_ar :: Int -> [Either Int K] -- | Variant where nil_t indicates no output. dot_rec' :: Id -> String -> [Either Int K] -> TypeRep -> String -- | OSC graph commands. module Sound.DF.Uniform.LL.Command -- | Load graph. g_load :: String -> Message -- | Unload graph. g_unload :: Message -- | C code generator module Sound.DF.Uniform.LL.CGen -- | C comment. type C_Comment = String -- | Add comment markers. -- --
--   c_comment "c" == "/* c */"
--   
c_comment :: String -> C_Comment -- | C type. type C_Type = String -- | Translate TypeRep to C_Type. -- --
--   c_typerep_ctype bool_t == "bool"
--   c_typerep_ctype (typeOf (0.0::Float)) == "float"
--   
c_typerep_ctype :: TypeRep -> C_Type -- | Qualified name, (structure,access,member). type C_QName = (String, String, String) var_fld_initialiser :: Var_Fld -> String -- | Initialise C_QName to value. -- --
--   c_init_atom ("s",".","r") 5 == "s.m = 5;"
--   
c_init_atom :: C_QName -> Var_Fld -> String -- | Initialise C_QName to array. Generates loop code for sequences -- of equal initial values. -- --
--   c_init_vec ("s",".","r") [0,1] == ["s.r[0] = 0;"
--                                     ,"s.r[1] = 1;"]
--   
-- --
--   let r = ["for(int i=0;i < 2;i++) {s.r[i] = 0;}"]
--   in c_init_vec ("s",".","r") [0,0] == r
--   
c_init_vec :: (Eq a, Show a) => C_QName -> [a] -> [String] -- | Initialise C_QName to value or array. -- --
--   let {qn = ("s","->","r")
--       ;r = ["for(int i=0;i < 2;i++) {s->r[i] = 0;}","s->r[2] = 1;"]}
--   in c_init_var qn (Right [0,0,1]) == r
--   
c_init_var :: C_QName -> Var_Fld -> [String] -- | Qualify name if required. The rf flag indicates if array is a -- reference or an allocation. -- --
--   c_array_qual (Vec_Port float_t 3) "a" True == "*a"
--   c_array_qual (Vec_Port float_t 3) "a" False == "a[3]"
--   
c_array_qual :: Maybe Int -> String -> Bool -> String -- | C function call. (comment?,function,arguments) type C_Call = (Maybe String, String, [(Var_Ty, Id)]) -- | Construct a function/macro call. -- --
--   c_call (Nothing,"f",["0","1"]) == "f(0,1);"
--   c_call ("c","f",["0","1"]) == "f(0,1); /* c */"
--   
c_call :: C_Call -> String -- | Enumeration of variable types. data Var_Ty Rec_Var :: Var_Ty Std_Var :: Var_Ty Buf_Var :: Int -> Var_Ty -- | The character prefix for a Var name is given by the -- Var_Ty. var_ty_char :: Var_Ty -> Char data Var_Fld Var_F :: Float -> Var_Fld Var_V :: [Float] -> Var_Fld Var_B :: Bool -> Var_Fld Var_I :: Int32 -> Var_Fld -- | (Type,Array,Label,Initialised) type Var = (Var_Ty, TypeRep, Id, Maybe Var_Fld) -- | Var name. var_nm :: Var -> String -- | Non-Std_Var are stateful, ie. Rec_Var and -- Buf_Var. is_stateful :: Var -> Bool -- | Rec_Var are stateful and atoms. is_stateful_atom :: Var -> Bool -- | Generate Var from K. k_var :: Id -> Var_Ty -> K -> Var -- | Generate Buf_Var from Vec. buffer_var :: Id -> Vec Float -> Var -- | c_init_var of Var. var_init :: String -> String -> Var -> [String] -- | Var C declaration, rf determines c_array_qual -- form. var_decl :: Bool -> Var -> String -- | Generate a C struct for Var, predicate determines if -- array variables are refernces or allocations. gen_var_struct :: String -> (Var -> Bool) -> [Var] -> [String] -- | Construct an identifier. -- --
--   clabel (Std_Var,0) == "n_0"
--   
clabel :: (Var_Ty, Id) -> String -- | clabel of Std_Var. -- --
--   std_clabel 0 == "n_0"
--   
std_clabel :: Id -> String -- | Variant with m. prefix. m_clabel :: (Var_Ty, Id) -> String -- | c_init_var for constant. -- --
--   c_const (0,I 1) == ["m.n_0 = 1;"]
--   
c_const :: (Id, K) -> [String] -- | C declarations for DSP functions (memreq,init and step). dsp_fun_decl :: [String] -- | The structure for all memory stores. In the uniform model this is a -- notational convenience only. In a partioned model it is functional. cmem :: [Var] -> [String] -- | The structure for stateful Var. cstate :: [Var] -> [String] -- | Generate dsp_memreq function. dsp_memreq :: [String] -- | Generate dsp_init function. dsp_init :: [Var] -> [String] -- | List of constants, list of variables, list of c-calls. type Instructions = ([(Id, K)], [Var], [C_Call]) -- | Generate dsp_step function. dsp_step :: Instructions -> [String] -- | Generate C code for graph. code_gen :: Host -> Instructions -> String -- | Enumeration of code hosts. data Host JACK :: Host SC3 :: Host Text :: Host -- | Host specific #include file. host_include :: Host -> String -- | Host specific form of dsp_fun_decl (extern C where -- required). host_dsp_fun_decl :: Host -> [String] -- | Generate compiler command for Host given include -- directory prefix. host_compiler_cmd :: (Host, FilePath) -> (String, [String]) -- | Format host_compiler_cmd as String. -- --
--   host_compiler_cmd_str (JACK,"/home/rohan/opt")
--   host_compiler_cmd_str (SC3,"/home/rohan/opt")
--   host_compiler_cmd_str (Text,"/home/rohan/opt")
--   
host_compiler_cmd_str :: (Host, FilePath) -> String -- | Generate C code, write file to disk and call the GNU C compiler to -- build shared library. dl_gen :: FilePath -> (Host, FilePath) -> Instructions -> IO () -- | Bracket list with elements. -- --
--   bracket ('<','>') "float" == "<float>"
--   
bracket :: (a, a) -> [a] -> [a] -- | Integrate, with implicit 0. -- --
--   dx_d [5,6] == [0,5,11]
--   
dx_d :: Num n => [n] -> [n] instance Eq Var_Ty instance Show Var_Ty -- | Interaction with jack-dl, scsynth and -- text-dl. See http://rd.slavepianos.org/?t=rju. module Sound.DF.Uniform.LL.Audition -- | Local definition of RDL UGen, to avoid dependency on sc3-rdu. rdl :: Int -> UGen -> UGen -- | Run action with UDP link to jack-dl. with_jack_dl :: Connection UDP a -> IO a -- | Audition graph after sending initialisation messages. audition_rju :: [Message] -> Instructions -> IO () -- | Load graph. u_cmd_g_load :: Int -> Int -> String -> Message -- | Audition graph after sending initialisation messages. audition_sc3 :: [Message] -> Instructions -> IO () -- | Audition at text-dl. audition_text :: Int -> Instructions -> IO () -- | Untyped DF. module Sound.DF.Uniform.UDF -- | Recursion identifier. data R_Id R_Id :: Id -> R_Id from_r_id :: R_Id -> Id -- | Un-typed data-flow node. K = constant, A = array, R = recursion, P = -- primitive, MRG = multiple root graph. data UDF UDF_K :: K -> UDF udf_k :: UDF -> K UDF_A :: Vec Float -> UDF udf_a :: UDF -> Vec Float UDF_R :: R_Id -> (Either K (UDF, UDF)) -> UDF UDF_P :: String -> TypeRep -> [UDF] -> UDF UDF_MRG :: UDF -> UDF -> UDF -- | Concise pretty printer for UDF. udf_concise :: UDF -> String -- | Maybe variant of udf_k. udf_k' :: UDF -> Maybe K -- | List elements in left biased order. udf_elem :: UDF -> [UDF] -- | Output type of UDF. udf_typeOf :: UDF -> TypeRep -- | Traversal with state, signature as mapAccumL. udf_traverse :: (st -> UDF -> (st, UDF)) -> st -> UDF -> (st, UDF) -- | Index for input port. type Port_Index = Int -- | A node is a UDF with associated Id. type Node = (Id, UDF) -- | Enumeration of Edge types. data Edge_Ty Normal_Edge :: Edge_Ty -- | Edge to recWr node Rec_Wr_Edge :: Id -> Edge_Ty -- | Edge from recRd node Rec_Rd_Edge :: Id -> Edge_Ty -- | Edge to recRd node (from recWr) Implicit_Edge :: Int -> Edge_Ty -- | Pretty printer for Edge_Ty, and Show instance. edge_ty_concise :: Edge_Ty -> String -- | Edge from left hand side node to right hand side port. type Edge = (Id, Id, (Port_Index, Edge_Ty)) -- | A graph is a list of Nodes and Edges. type Graph = ([Node], [Edge]) -- | A variant graph form associating the list of in edges with each -- Node. type Analysis = [(Node, [Edge])] -- | Id of Node. node_id :: Node -> Id -- | UDF of Node. node_udf :: Node -> UDF -- | Read label of node. label :: [Node] -> UDF -> Id -- | Transform node to source, see through UDF_R (rec) and -- UDF_MRG (mrg). source :: [Node] -> UDF -> Id -- | Type of out edge of UDF. udf_edge_ty :: UDF -> Edge_Ty -- | List incoming node edges. edges :: [Node] -> UDF -> [Edge] -- | True if Node is Right form of UDF_R with -- indicated R_Id. match_rec :: R_Id -> Node -> Bool -- | Implicit edge from wR to rW. implicit_edge :: [Node] -> Node -> Maybe Edge -- | Is Node UDF_K. is_k_node :: Node -> Bool -- | An Edge is orphaned if it refers to a Node that is not -- in the node list. is_orphan_edge :: [Node] -> Edge -> Bool -- | Transform the actual graph into a viewing graph by adding implicit -- edges from recWr to recRd nodes. vgraph_impl :: Graph -> Graph -- | Find edge with indicated right hand side port. find_in_edge_m :: [Edge] -> (Id, Port_Index) -> Maybe Edge -- | Variant of find_in_edge_m that errors. find_in_edge :: [Edge] -> (Id, Port_Index) -> Edge -- | Trace in edges until arrival at a Rec_Wr_Edge that is not -- proceeded by an Implicit_Edge. This traces the depth of -- the chain, however that is not currently drawn. solve_rec_edge :: Int -> [Edge] -> (Id, Port_Index) -> (Int, Id) -- | Transform Rec_Rd_Edge to resolved Implicit_Edge. implicit_edge' :: [Edge] -> Edge -> Maybe Edge -- | Is Node UDF_R. is_rec_node :: Node -> Bool -- | Transform the actual graph into a viewing graph by deleting -- recWr and recRd nodes and drawing a direct backward -- edge. vgraph_direct :: Graph -> Graph -- | Label nodes and list incoming edges. Multiple-root and -- multiple-channel nodes are erased. -- --
--   analyse (udf_elem c)
--   
analyse :: [UDF] -> Analysis -- | Generate graph (node list and edge list). -- --
--   import Sound.DF.Uniform.GADT
--   import qualified Sound.DF.Uniform.UDF as U
--   
-- --
--   let g = iir1 (0.0::Float) (+) 1
--   let c = df_erase g
--   
-- --
--   map U.udf_concise (U.udf_elem c)
--   > [recWr,df_add:Float,1.0,recRd:0.0,df_add:Float,1.0,recRd:0.0]
--   
-- --
--   U.vgraph_direct (U.graph c)
--   > ([(1,wR_1),(2,df_add:Float),(3,1.0),(4,rR_1:0.0)]
--   > ,[(2,1,0),(3,2,0),(4,2,1)])
--   
-- --
--   U.draw c
--   
graph :: UDF -> Graph -- | FGL graph with UDF label. type Gr = Gr UDF (Port_Index, Edge_Ty) -- | FGL graph with pretty-printed UDF label. type Gr' = Gr String (Port_Index, Edge_Ty) -- | Generate Gr. udf_gr :: Graph -> Gr -- | Generate Gr'. udf_gr' :: Graph -> Gr' -- | Topological sort of nodes (via udf_gr). tsort :: UDF -> [UDF] -- | List of required variable declarations. node_vars :: Node -> [Var] -- | Possible c-call code statement. node_c_call :: (Node, [Edge]) -> Maybe C_Call -- | Constant nodes. k_nodes :: [Node] -> [(Id, K)] -- | Generate Instructions from UDF. udf_instructions :: UDF -> Instructions -- | dl_gen of udf_instructions. udf_dl_gen :: FilePath -> (Host, FilePath) -> UDF -> IO () -- | Make dot_rec arguments input. dot_ar :: [UDF] -> [Either Int K] -- | Dot notation of Node. dot_node :: Node -> String -- | Edges are coloured according to their type. edge_ty_colour :: Edge_Ty -> String -- | Dot notation of Edge. dot_edge :: Edge -> String -- | Dot notation of Graph. dot_graph :: Graph -> [String] -- | View dot graph. dot_draw :: String -> IO () -- | Draw graph, transformed by vgraph_direct. draw :: UDF -> IO () -- | Draw graph, transformed by vgraph_impl. draw' :: UDF -> IO () -- | Make dot rendering of graph at Node, via -- vgraph_direct. gr_dot :: UDF -> String -- | Make dot rendering of graph at Node, via -- vgraph_impl. gr_dot' :: UDF -> String -- | Draw graph, via gr_dot. gr_draw :: UDF -> IO () -- | Draw graph, via gr_dot'. gr_draw' :: UDF -> IO () -- | Audition graph after sending initialisation messages. audition :: [Message] -> UDF -> IO () -- | Audition graph after sending initialisation messages. audition_sc3 :: [Message] -> UDF -> IO () -- | Audition at text-dl. audition_text :: Int -> UDF -> IO () instance Eq R_Id instance Show R_Id instance Eq UDF instance Show UDF instance Show Edge_Ty -- | Faust signal processing block diagram model. module Sound.DF.Uniform.Faust -- | The write and read Ids, and the wire type. type Rec_Id = (Id, Id, TypeRep) -- | Block diagram. data BD Constant :: (Maybe Id) -> K -> BD Prim :: (Maybe Id) -> String -> [TypeRep] -> (Maybe TypeRep) -> BD Par :: BD -> BD -> BD Seq :: BD -> BD -> BD Split :: BD -> BD -> BD Rec :: (Maybe [Rec_Id]) -> BD -> BD -> BD -- | Read identifier. bd_id :: BD -> Maybe Id -- | Erroring bd_id. bd_req_id :: BD -> Id -- | Pretty printer for BD. bd_pp :: BD -> String -- | Diagram type signature, ie. port_ty at ports. bd_signature :: BD -> ([TypeRep], [TypeRep]) -- | Type of output ports of BD. bd_ty :: BD -> [TypeRep] -- | Type of uniform output ports of BD. bd_ty_uniform :: BD -> Maybe TypeRep -- | Type of singular output port of BD. bd_ty1 :: BD -> Maybe TypeRep -- | Faust uses single tilde, which is reserved by GHC.Exts. (~~) :: BD -> BD -> BD -- | Faust uses comma, which is reserved by Data.Tuple, and indeed -- ~, is not legal either. (~.) :: BD -> BD -> BD -- | Faust uses :, which is reserved by Data.List. (~:) :: BD -> BD -> BD -- | Faust uses <:, which is legal, however see ~:>. (~<:) :: BD -> BD -> BD -- | Faust uses :>, however : is not allowed as a -- prefix. -- --
--   draw (graph (par_l [1,2,3,4] ~:> i_mul))
--   draw (graph (par_l [1,2,3] ~:> i_negate))
--   
(~:>) :: BD -> BD -> BD -- | Fold over BD, signature as foldl. bd_foldl :: (t -> BD -> t) -> t -> BD -> t -- | Traversal with state, signature as mapAccumL. bd_traverse :: (st -> BD -> (st, BD)) -> st -> BD -> (st, BD) -- | Rec nodes introduce identifiers for each backward arc. k -- is the initial Id, n the number of arcs, and ty -- the arc types. -- --
--   rec_ids 5 2 [int32_t,float_t] == [(5,6,int32_t),(7,8,float_t)]
--   
rec_ids :: Id -> Int -> [TypeRep] -> [Rec_Id] -- | Set identifiers at Constant, Prim, and Rec nodes. bd_set_id :: BD -> (Id, BD) -- | Node degree as (input,output) pair. type Degree = (Int, Int) -- | Degree of block diagram BD. degree :: BD -> Degree -- | fst of degree. in_degree :: BD -> Int -- | snd of degree. out_degree :: BD -> Int -- | The index of an Input_Port, all outputs are unary. type Port_Index = Int -- | Port (input or output) at block diagram. data Port Input_Port :: BD -> Port_Index -> Port port_bd :: Port -> BD port_index :: Port -> Port_Index Output_Port :: BD -> Port port_bd :: Port -> BD -- | The left and right outer ports of a block diagram. ports :: BD -> ([Port], [Port]) -- | Type of Port. port_ty :: Port -> TypeRep -- | Enumeration of wire types. data Wire_Ty -- | Normal forward edge. Normal :: Wire_Ty -- | Backward edge. Backward :: Rec_Id -> Wire_Ty -- | Implicit wire from recRd to node. Implicit_Normal :: Wire_Ty -- | Implicit wire from node to recWr. Implicit_Rec :: Wire_Ty -- | Implicit wire from recWr to recRd. Implicit_Backward :: Wire_Ty -- | A Wire runs between two Ports. type Wire = (Port, Port, Wire_Ty) -- | Set of Normal wires between Ports. normal_wires :: [Port] -> [Port] -> [Wire] -- | Set of Backward wires between Ports. rec_back_wires :: [Rec_Id] -> [Port] -> [Port] -> [Wire] -- | Immediate internal wires of a block diagram. wires_immed :: BD -> [Wire] -- | Internal wires of a block diagram. wires :: BD -> [Wire] -- | A wire coheres if the port_ty of the left and right hand sides -- are equal. wire_coheres :: Wire -> Bool -- | The set of non-coherent wires at diagram. bd_non_coherent :: BD -> [Wire] -- | Coherence predicate, ie. is bd_non_coherent empty. bd_is_coherent :: BD -> Bool -- | Primitive block diagram elements. data Node N_Constant :: Id -> K -> Node n_constant_id :: Node -> Id n_constant_k :: Node -> K N_Prim :: Either Id (Id, Id) -> String -> Int -> Maybe TypeRep -> Node n_prim_id :: Node -> Either Id (Id, Id) n_prim_name :: Node -> String n_prim_in_degree :: Node -> Int n_prim_ty :: Node -> Maybe TypeRep -- | Extract the current actual node id from -- n_prim_id. actual_id :: Either Id (Id, Id) -> Id -- | Output type of Node, if out degree non-zero. node_ty :: Node -> Maybe TypeRep -- | Either n_constant_id or actual_id of n_prim_id. node_id :: Node -> Id -- | Pair Node Id with node. node_lift_id :: Node -> (Id, Node) -- | Pretty printer, and Show instance. node_pp :: Node -> String -- | Primitive edge, left hand Id, right hand side Id, right -- hand Port_Index and edge type. type Edge = (Id, Id, (Port_Index, Wire_Ty)) -- | A graph is a list of Node and a list of Edges. type Graph = ([Node], [Edge]) -- | Is Wire_Ty of Edge Implicit_Backward. edge_is_implicit_backward :: Edge -> Bool -- | Implicit rec nodes. rec_nodes :: [Rec_Id] -> [Node] -- | Collect all primitive nodes at a block diagram. nodes :: Bool -> BD -> [Node] -- | A backward Wire will introduce three implicit edges, a -- Normal wire introduces one Normal edge. wire_to_edges :: Bool -> Wire -> [Edge] -- | concatMap of wire_to_edges. wires_to_edges :: Bool -> [Wire] -> [Edge] -- | wires_to_edges of wires. edges :: Bool -> BD -> [Edge] -- | Construct Graph of block diagram, either with or without -- implicit edges. graph' :: Bool -> BD -> Graph -- | Construct Graph of block diagram without implicit edges. -- This graph will include backward arcs if the graph contains -- recs. graph :: BD -> Graph -- | FGL graph of BD. type Gr = Gr Node (Port_Index, Wire_Ty) -- | Transform BD to Gr. gr :: BD -> Gr -- | Topological sort of nodes (via gr). tsort :: BD -> Graph -- | Make dot rendering of graph at Node. gr_dot :: BD -> String -- | draw_dot of gr_dot. gr_draw :: BD -> IO () -- | Dot description of Node. dot_node :: Node -> String -- | Wires are coloured according to type. wire_colour :: Wire_Ty -> String -- | Dot description of Edge. dot_edge :: Edge -> String -- | Dot description of Graph. dot_graph :: Graph -> [String] -- | Draw dot graph. draw_dot :: String -> IO () -- | draw_dot of dot_graph. draw :: Graph -> IO () -- | Fold of Par. -- --
--   degree (par_l [1,2,3,4]) == (0,4)
--   draw (graph (par_l [1,2,3,4] ~:> i_mul))
--   
par_l :: [BD] -> BD -- | Type-directed sum. -- --
--   draw (graph (bd_sum [1,2,3,4]))
--   
bd_sum :: [BD] -> BD -- | Predicate to determine if p can be split onto q. split_r :: BD -> BD -> Bool -- | split if diagrams cohere. split_m :: BD -> BD -> Maybe BD -- | split if diagrams cohere, else error. Synonym of -- ~<:. split :: BD -> BD -> BD -- | If merge is legal, the number of in-edges per port at q. -- --
--   merge_degree (par_l [1,2,3]) i_negate == Just 3
--   merge_degree (par_l [1,2,3,4]) i_mul == Just 2
--   
merge_degree :: BD -> BD -> Maybe Int -- | merge if diagrams cohere. -- --
--   merge_m (par_l [1,2,3]) i_negate
--   merge_m (par_l [1,2,3,4]) i_mul
--   
merge_m :: BD -> BD -> Maybe BD -- | merge if diagrams cohere, else error. Synonym of -- ~:>. merge :: BD -> BD -> BD -- | Predicate to determine if p can be rec onto q. rec_r :: BD -> BD -> Bool -- | rec if diagrams cohere. rec_m :: BD -> BD -> Maybe BD -- | rec if diagrams cohere, else error. Synonym of -- ~~. rec :: BD -> BD -> BD -- | Integer constant. i_constant :: Int -> BD -- | Real constant. r_constant :: Float -> BD -- | Construct uniform type primitive diagram. u_prim :: TypeRep -> String -> Int -> BD -- | u_prim of int32_t. i_prim :: String -> Int -> BD -- | u_prim of float_t. r_prim :: String -> Int -> BD -- | Adddition, ie. + of Num. -- --
--   (1 ~. 2) ~: i_add
--   (1 :: BD) + 2
--   
i_add :: BD -- | Adddition, ie. + of Num. -- --
--   (1 ~. 2) ~: i_add
--   (1 :: BD) + 2
--   
r_add :: BD -- | Subtraction, ie. - of Num. i_sub :: BD -- | Subtraction, ie. - of Num. r_sub :: BD -- | Multiplication, ie. * of Num. i_mul :: BD -- | Multiplication, ie. * of Num. r_mul :: BD -- | Division, ie. div of Integral. i_div :: BD -- | Division, ie. / of Fractional. r_div :: BD -- | Absolute value, ie. abs of Num. i_abs :: BD -- | Absolute value, ie. abs of Num. r_abs :: BD -- | Negation, ie. negate of Num. i_negate :: BD -- | Negation, ie. negate of Num. r_negate :: BD -- | Identity diagram. i_identity :: BD -- | Identity diagram. r_identity :: BD -- | Coerce float_t to int32_t. float_to_int32 :: BD -- | Coerce int32_t to float_t. int32_to_float :: BD -- | int32_to_float and then scale to be in (-1,1). i32_to_normal_f32 :: BD -- | Single channel output. -- --
--   degree out1 == (1,0)
--   bd_signature out1 == ([float_t],[])
--   
out1 :: BD -- | Type following unary operator. ty_uop :: (BD -> Maybe TypeRep) -> t -> t -> BD -> t -- | Type following binary operator. ty_binop :: (BD -> Maybe TypeRep) -> t -> t -> BD -> BD -> t -- | Type following math operator, uniform types. -- --
--   1.0 `ty_add` 2.0 == r_add
--   (1 ~. 2) `ty_add` (3 ~. 4) == i_add
--   1.0 `ty_add` 2 == _|_
--   draw (graph ((1 ~. 2) - (3 ~. 4)))
--   
ty_add :: BD -> BD -> BD -- | Type following math operator, uniform types. -- --
--   1.0 `ty_add` 2.0 == r_add
--   (1 ~. 2) `ty_add` (3 ~. 4) == i_add
--   1.0 `ty_add` 2 == _|_
--   draw (graph ((1 ~. 2) - (3 ~. 4)))
--   
ty_div :: BD -> BD -> BD -- | Type following math operator, uniform types. -- --
--   1.0 `ty_add` 2.0 == r_add
--   (1 ~. 2) `ty_add` (3 ~. 4) == i_add
--   1.0 `ty_add` 2 == _|_
--   draw (graph ((1 ~. 2) - (3 ~. 4)))
--   
ty_mul :: BD -> BD -> BD -- | Type following math operator, uniform types. -- --
--   1.0 `ty_add` 2.0 == r_add
--   (1 ~. 2) `ty_add` (3 ~. 4) == i_add
--   1.0 `ty_add` 2 == _|_
--   draw (graph ((1 ~. 2) - (3 ~. 4)))
--   
ty_sub :: BD -> BD -> BD -- | Type following math operator, singular types. -- --
--   1.0 `ty_add1` 2.0 == r_add
--   1.0 `ty_add1` 2 == _|_
--   
ty_add1 :: BD -> BD -> BD -- | Type following math operator, singular types. -- --
--   1.0 `ty_add1` 2.0 == r_add
--   1.0 `ty_add1` 2 == _|_
--   
ty_div1 :: BD -> BD -> BD -- | Type following math operator, singular types. -- --
--   1.0 `ty_add1` 2.0 == r_add
--   1.0 `ty_add1` 2 == _|_
--   
ty_mul1 :: BD -> BD -> BD -- | List of constants for CGen. cg_k :: [Node] -> [(Id, K)] -- | Var of Node. cg_node_var :: Node -> Maybe Var -- | Output reference for Node. node_output :: Node -> Maybe (Var_Ty, Id) -- | Input references for Node. node_inputs :: [Edge] -> Node -> [(Var_Ty, Id)] -- | C_Call of Node. cg_node_c_call :: [Edge] -> Node -> Maybe C_Call -- | Generate CGen Instructions for BD. bd_instructions :: BD -> Instructions -- | Audition graph after sending initialisation messages. audition_rju :: [Message] -> BD -> IO () -- | Figure illustrating ~.. -- --
--   degree fig_3_2 == (2,2)
--   draw (graph fig_3_2)
--   
fig_3_2 :: BD -- | Figure illustrating ~:. -- --
--   degree fig_3_3 == (4,1)
--   bd_signature fig_3_3
--   draw (graph fig_3_3)
--   
fig_3_3 :: BD -- | Figure illustrating ~<:. -- --
--   degree fig_3_4 == (0,3)
--   draw (graph fig_3_4)
--   
fig_3_4 :: BD -- | Figure illustrating ~:>. -- --
--   degree fig_3_5 == (0,1)
--   draw (graph fig_3_5)
--   
fig_3_5 :: BD -- | Figure illustrating ~~. -- --
--   degree fig_3_6 == (0,1)
--   draw (graph fig_3_6)
--   
fig_3_6 :: BD -- | Variant generating audible graph. -- --
--   draw (graph fig_3_6')
--   gr_draw fig_3_6'
--   audition [] fig_3_6'
--   
fig_3_6' :: BD -- | A counter, illustrating identity diagram. -- --
--   draw (graph (i_counter ~: i_negate))
--   gr_draw (i_counter ~: i_negate)
--   
i_counter :: BD -- | Adjacent elements of list. -- --
--   adjacent [1..4] == [(1,2),(3,4)]
--   
adjacent :: [t] -> [(t, t)] -- | Bimap at tuple. -- --
--   bimap abs negate (-1,1) == (1,-1)
--   
bimap :: (a -> b) -> (c -> d) -> (a, c) -> (b, d) instance Eq BD instance Show BD instance Eq Port instance Show Port instance Eq Wire_Ty instance Show Wire_Ty instance Eq Node instance Show Node instance Fractional BD instance Num BD -- | Composite of all low-level modules. module Sound.DF.Uniform.LL -- | Data flow nodes. module Sound.DF.Uniform.PhT.Node -- | Constant with phantom type. data KT ty KT :: K -> KT ty kt_k :: KT ty -> K -- | Data flow node with phantom type. data DF ty DF :: UDF -> DF ty df_udf :: DF ty -> UDF -- | Lift Int32 to constant, ie. KT of I. k_Int32 :: Int32 -> KT Int32 -- | Lift Float to constant, ie. KT of F. k_Float :: Float -> KT Float -- | A zero with unresolved type, ie. KT of F of 0. k_zero :: KT ty -- | Lift Int32 to DF. df_Int32 :: Int32 -> DF Int32 -- | Lift Float to DF. df_Float :: Float -> DF Float -- | Tables have a guard point. df_tbl_size :: DF a -> Maybe Int -- | Multiple root graph. mrg :: DF a -> DF () -> DF a -- | typeOf DF. df_type :: DF a -> TypeRep -- | DF of UDF_P. mk_a :: String -> [DF a] -> TypeRep -> DF ty -- | Primitive unary operator. unary_operator :: String -> DF a -> DF a -- | Primitive binary operator. binary_operator :: String -> DF a -> DF a -> DF a -- | Primitive comparator. comparison_operator :: String -> DF a -> DF a -> DF Bool -- | Primitive sink. sink_node :: String -> [DF a] -> DF () -- | Primitive unary operator with separate primitives for integral and -- floating types. alt_unary_operator :: (String, String) -> DF a -> DF a -- | Lift list of float to DF Vec. df_vec_m :: UId m => [Float] -> m (DF (Vec Float)) -- | ==, equal to. df_eq :: DF a -> DF a -> DF Bool -- | <, less than. df_lt :: Num a => DF a -> DF a -> DF Bool -- | >=, greater than or equal to. df_gte :: Num a => DF a -> DF a -> DF Bool -- | >, greater than. df_gt :: Num a => DF a -> DF a -> DF Bool -- | <=, less than or equal to. n_lte :: Num a => DF a -> DF a -> DF Bool -- | ceilf(3) df_ceilingf :: DF Float -> DF Float -- | floorf(3) df_floorf :: DF Float -> DF Float -- | lrintf(3) df_lrintf :: DF Float -> DF Int32 -- | roundf(3) df_roundf :: DF Float -> DF Float -- | Single channel output. out1 :: DF Float -> DF () -- | Two channel output. out2 :: DF Float -> DF Float -> DF () -- | Three channel output. out3 :: DF Float -> DF Float -> DF Float -> DF () -- | Single control input. ctl1 :: DF Int32 -> DF Float -- | If p then q else r. p must have type bool, -- and q and r must have equal types. select2 :: DF Bool -> DF a -> DF a -> DF a -- | Operating sample rate. w_sample_rate :: DF Float -- | Buffer read, read from buffer p at index q. b_read :: DF Int32 -> DF Int32 -> DF Float -- | Buffer write, write to buffer p at index q value -- r. b_write :: DF Int32 -> DF Int32 -> DF Float -> DF () -- | Array read. a_read :: DF (Vec Float) -> DF Int32 -> DF Float -- | Array write. a_write :: DF (Vec Float) -> DF Int32 -> DF Float -> DF () -- | Introduce backward arc with implicit unit delay. rec_r :: R_Id -> KT a -> (DF a -> (DF a, DF a)) -> DF a -- | Monadic variant of rec_r. rec :: UId m => KT a -> (DF a -> (DF a, DF a)) -> m (DF a) -- | Variant or rec with monadic action in backward arc. recm :: UId m => KT a -> (DF a -> m (DF a, DF a)) -> m (DF a) instance Eq (KT ty) instance Eq (DF ty) instance Eq a => Ord (DF a) instance Eq a => Bits (DF a) instance Floating (DF Float) instance Fractional (DF Float) instance Num n => Num (DF n) -- | Interaction with jack-dl, scsynth and -- text-dl. module Sound.DF.Uniform.PhT.Audition -- | Audition graph after sending initialisation messages. audition :: [Message] -> DF () -> IO () -- | Audition graph after sending initialisation messages. audition_sc3 :: [Message] -> DF () -> IO () -- | Audition at text-dl. audition_text :: Int -> DF () -> IO () -- | Graph drawing module Sound.DF.Uniform.PhT.Draw -- | View graph using graphviz. draw :: DF a -> IO () drawM :: State Id (DF a) -> IO () -- | Top level module for PhT uniform rate model hdf. module Sound.DF.Uniform.PhT -- | Data flow nodes. module Sound.DF.Uniform.GADT.DF -- | Data flow node. K = constant, A = array, R = recursion, P = primitive, -- MRG = mrg. data DF a K :: a -> DF a A :: Vec Float -> DF (Vec Float) R :: R_Id -> TypeRep -> Either a (DF b, DF a) -> DF b P0 :: String -> TypeRep -> DF a P1 :: String -> TypeRep -> DF a -> DF b P2 :: String -> TypeRep -> DF a -> DF b -> DF c P3 :: String -> TypeRep -> DF a -> DF b -> DF c -> DF d MCE :: [DF a] -> DF a MRG :: DF a -> DF () -> DF a -- | Typeable instance for DF. -- --
--   df_typeOf (K (undefined::Int32)) == int32_t
--   df_typeOf (K (undefined::Float)) == float_t
--   df_typeOf (A undefined) == vec_float_t
--   df_typeOf (0::DF Int32) == int32_t
--   df_typeOf (0.0::DF Float) == float_t
--   
df_typeOf :: K' a => DF a -> TypeRep -- | Name of primitive if DF is P0 or P1 etc. df_primitive :: DF a -> Maybe String -- | Multiple root graph (alias for M). mrg :: K' a => DF a -> DF () -> DF a -- | DF Vec constructor. df_vec :: V_Id -> [Float] -> DF (Vec Float) -- | Monadic DF Vec constructor. df_vec_m :: UId m => [Float] -> m (DF (Vec Float)) -- | DF Vec size. df_vec_size :: DF a -> Maybe Int -- | df_vec_size variant, tables have a guard point. df_tbl_size :: DF a -> Maybe Int -- | Unary operator. type Unary_Op a = a -> a -- | Binary operator. type Binary_Op a = a -> a -> a -- | Ternary operator. type Ternary_Op a = a -> a -> a -> a -- | Quaternary operator. type Quaternary_Op a = a -> a -> a -> a -> a -- | Quinary operator. type Quinary_Op a = a -> a -> a -> a -> a -> a -- | Senary operator. type Senary_Op a = a -> a -> a -> a -> a -> a -> a -- | Binary function. type Binary_Fn i o = i -> i -> o -- | MCE predicate, sees into MRG. is_mce :: DF t -> Bool -- | MCE degree, sees into MRG. mce_degree :: DF t -> Int -- | MCE extension, sees into MRG, will not reduce. mce_extend :: Int -> DF t -> [DF t] mce2 :: DF a -> DF a -> DF a unmce :: DF t -> [DF t] unmce2 :: Show t => DF t -> (DF t, DF t) lift_mce :: (DF a -> DF b) -> DF a -> DF b lift_mce2 :: (DF a -> DF b -> DF c) -> DF a -> DF b -> DF c mce_extend3 :: DF a -> DF b -> DF c -> ([DF a], [DF b], [DF c]) lift_mce3 :: (DF a -> DF b -> DF c -> DF d) -> DF a -> DF b -> DF c -> DF d -- | lift_mce of P1. mk_p1 :: (K' a, K' b) => String -> TypeRep -> DF a -> DF b -- | Unary operator. mk_uop :: K' a => String -> Unary_Op (DF a) -- | lift_mce2 of P2. mk_p2 :: (K' a, K' b, K' c) => String -> TypeRep -> DF a -> DF b -> DF c -- | Binary operator. mk_binop :: K' a => String -> Binary_Op (DF a) -- | lift_mce3 of P3. mk_p3 :: (K' a, K' b, K' c, K' d) => String -> TypeRep -> DF a -> DF b -> DF c -> DF d -- | Binary operator. mk_ternaryop :: K' a => String -> Ternary_Op (DF a) -- | DF multiply and add. df_mul_add :: K_Num a => DF a -> DF a -> DF a -> DF a -- | Optimising addition primitive. If either input is a multiplier node, -- unfold to a multiplier-add node. -- --
--   df_add_optimise (2 * 3) (4::DF Int32)
--   df_add_optimise (2::DF Int32) (3 * 4)
--   
df_add_optimise :: K_Num a => DF a -> DF a -> DF a -- | Data.Bits .&.. df_bw_and :: DF Int32 -> DF Int32 -> DF Int32 -- | Data.Bits .|.. df_bw_or :: DF Int32 -> DF Int32 -> DF Int32 -- | Data.Bits complement. df_bw_not :: DF Int32 -> DF Int32 -- | ==, equal to. df_eq :: K_Ord a => DF a -> DF a -> DF Bool -- | <, less than. df_lt :: K_Ord a => DF a -> DF a -> DF Bool -- | >=, greater than or equal to. df_gte :: K_Ord a => DF a -> DF a -> DF Bool -- | >, greater than. df_gt :: K_Ord a => DF a -> DF a -> DF Bool -- | <=, less than or equal to. df_lte :: K_Ord a => DF a -> DF a -> DF Bool -- | max, select maximum. df_max :: K_Ord a => DF a -> DF a -> DF a -- | min, select minimum. df_min :: K_Ord a => DF a -> DF a -> DF a -- | Cast floating point to integer. df_float_to_int32 :: DF Float -> DF Int32 -- | Cast integer to floating point. df_int32_to_float :: DF Int32 -> DF Float -- | Scale Int32 to (-1,1) normalised Float. -- --
--   maxBound == (2147483647::Int32)
--   
i32_to_normal_f32 :: DF Int32 -> DF Float -- | Integral modulo, ie. mod. df_mod :: Binary_Op (DF Int32) -- | Floating point modulo, ie. Foreign.C.Math fmodf. df_fmodf :: Binary_Op (DF Float) -- | ceilf(3) df_ceilf :: DF Float -> DF Float -- | floorf(3) df_floorf :: DF Float -> DF Float -- | lrintf(3), ie. round to nearest integer. df_lrintf :: DF Float -> DF Int32 -- | roundf(3) df_roundf :: DF Float -> DF Float -- | Introduce backward arc with implicit unit delay. -- -- The function receives the previous output as input, initially -- y0, and returns a (feed-forward,feed-backward) pair. -- --
--   rec_r (R_Id 0) (0::Int32) ((\i->(i,i)) . (+) 1)
--   rec_r (R_Id 0) (0.0::Float) ((\i->(i,i)) . (+) 1.0)
--   
rec_r :: K' a => R_Id -> a -> (DF a -> (DF b, DF a)) -> DF b -- | Monadic variant of rec_r. rec_m :: (K' a, UId m) => a -> (DF a -> (DF b, DF a)) -> m (DF b) -- | Hash-eq variant of rec_r. rec_h :: (K' a, Show b) => a -> (DF a -> (DF b, DF a)) -> DF b -- | Variant of rec_m with monadic action in backward arc. rec_mM :: (K' a, UId m) => a -> (DF a -> m (DF b, DF a)) -> m (DF b) -- | Single channel input (channel 0). in1 :: DF Float -- | Single channel output (channel 0). out1 :: DF Float -> DF () -- | Two channel output (channels 1 & 2). out2 :: DF Float -> DF Float -> DF () -- | Three channel output. out3 :: DF Float -> DF Float -> DF Float -> DF () -- | MCE collapsing output. out :: DF Float -> DF () -- | Single control input. ctl1 :: DF Int32 -> DF Float -- | Logical &&. df_and :: DF Bool -> DF Bool -> DF Bool -- | Logical ||. df_or :: DF Bool -> DF Bool -> DF Bool -- | Logical not. df_not :: DF Bool -> DF Bool -- | If p then q else r. p must have type bool, -- and q and r must have equal types. select2 :: K' a => DF Bool -> DF a -> DF a -> DF a -- | Operating sample rate. w_sample_rate :: DF Float -- | Number of frames in current control period. w_kr_nframes :: DF Int32 -- | True at first frame of each control period. w_kr_edge :: DF Bool -- | Buffer read, read from buffer p at index q. b_read :: DF Int32 -> DF Int32 -> DF Float -- | Buffer write, write to buffer p at index q value -- r. b_write :: DF Int32 -> DF Int32 -> DF Float -> DF () -- | Array read. a_read :: DF (Vec Float) -> DF Int32 -> DF Float -- | Array write. a_write :: DF (Vec Float) -> DF Int32 -> DF Float -> DF () -- | Transform typed DF to un-typed UDF. df_erase :: K' a => DF a -> UDF instance Typeable DF instance Show a => Show (DF a) instance Floating (DF Float) instance Fractional (DF Float) instance K_Num a => Num (DF a) -- | Interaction with jack-dl, scsynth and -- text-dl. module Sound.DF.Uniform.GADT.Audition -- | Transform DF to Instructions. df_instructions :: DF () -> Instructions -- | Audition graph at jack-dl after sending initialisation -- messages. audition_rju :: [Message] -> DF () -> IO () -- | Audition graph at SC3 after sending initialisation messages. audition_sc3 :: [Message] -> DF () -> IO () -- | Audition graph at text-dl. audition_text :: Int -> DF () -> IO () -- | Data flow node functions, or unit generators. module Sound.DF.Uniform.GADT.UGen -- | Duplicate a value into a tuple. -- --
--   split 1 == (1,1)
--   
split :: a -> (a, a) -- | Reversed tuple constructor, (ie. flip (,)) -- --
--   swap 2 1 == (1,2)
--   
swap :: a -> b -> (b, a) -- | Two pi. -- --
--   two_pi == 6.283185307179586
--   
two_pi :: Floating a => a -- | Midi note number to cycles per second. -- --
--   midi_cps 69 == 440
--   
midi_cps :: Floating a => a -> a -- | Multiply and add. -- --
--   map (mul_add 2 3) [1,2] == [5,7] && map (mul_add 3 4) [1,2] == [7,10]
--   
mul_add :: Num a => a -> a -> a -> a -- | Calculate feedback multipler in comb filter circuit given delay -- and decay times. -- --
--   calc_fb 0.2 3.0 == 0.6309573444801932
--   
calc_fb :: Floating a => a -> a -> a -- | Linear range conversion. -- --
--   map (\i -> lin_lin i (-1) 1 0 1) [-1,-0.9 .. 1.0]
--   
-- --
--   import Sound.DF.Uniform.GADT {- hdf -}
--   
-- --
--   let {s = lf_saw 1.0 0.0
--       ;o = sin_osc (lin_lin s (-1.0) 1.0 220.0 440.0) 0.0}
--   in audition_rju [] (out1 (o * 0.1))
--   
lin_lin :: Fractional a => a -> a -> a -> a -> a -> a -- | Exponential range conversion. -- --
--   map (\i -> lin_exp i 1 2 1 3) [1,1.1 .. 2]
--   
-- --
--   let {s = lf_saw 0.25 0.0
--       ;o = sin_osc (lin_exp (s + 1.0) 0.0 2.0 220.0 440.0) 0.0}
--   in audition_rju [] (out1 (o * 0.1))
--   
lin_exp :: Floating a => a -> a -> a -> a -> a -> a -- | Constrain p in (-q,q). -- --
--   let r = -10 : -10 : [-10,-9 .. 10]
--   in map (flip clip2 10) [-12,-11 .. 12] == r
--   
clip2 :: (Num a, Ord a) => a -> a -> a -- | sr = sample rate, r = cycle (two-pi), hz = -- frequency -- --
--   hz_to_incr 48000 128 375 == 1
--   hz_to_incr 48000 two_pi 458.3662361046586 == 6e-2
--   
hz_to_incr :: Fractional a => a -> a -> a -> a -- | Inverse of hz_to_incr. -- --
--   incr_to_hz 48000 128 1 == 375
--   
incr_to_hz :: Fractional a => a -> a -> a -> a -- | Linear pan. -- --
--   map (lin_pan2 1) [-1,0,1] == [(1,0),(0.5,0.5),(0,1)]
--   
-- --
--   let {o = sin_osc 440.0 0.0
--       ;l = sin_osc 0.5 0.0
--       ;(p,q) = lin_pan2 (o * 0.1) l}
--   in audition_rju [] (out2 p q)
--   
lin_pan2 :: Fractional t => t -> t -> (t, t) -- | Compile time sample rate constant. k_sample_rate :: Fractional n => n -- | Compile time sample duration (in seconds) constant. k_sample_dur :: Fractional n => n -- | Environment value, recip of w_sample_rate. w_sample_dur :: DF Float -- | Environment value, equal to two_pi / -- w_sample_rate. w_radians_per_sample :: DF Float -- | Add guard point. -- --
--   tbl_guard [1,2,3] == [1,2,3,1]
--   
tbl_guard :: [a] -> [a] -- | Generate guarded sin table. -- --
--   map (round . (* 100)) (tbl_sin 12) == [0,50,87,100,87,50,0,-50,-87,-100,-87,-50,0]
--   
tbl_sin :: Floating n => Int -> [n] -- | If 'q >= p' then 'q - p' else q. clipr :: K_Num a => DF a -> DF a -> DF a -- | clip2 variant. -- --
--   let o = sin_osc 440 0
--   in audition_rju [] (out1 (df_clip2 (o * 2) 0.1))
--   
df_clip2 :: K_Num a => DF a -> DF a -> DF a -- | Single place infinite impulse response filter with indicated initial -- value. -- --
--   import Data.Int
--   import Sound.DF.Uniform.GADT
--   import Sound.DF.Uniform.LL.K
--   
-- --
--   draw (iir1 (0::Int32) (+) 1)
--   draw (iir1 (0::Float) (+) 1)
--   
iir1 :: K' a => a -> (Binary_Op (DF a)) -> DF a -> DF a -- | r = right hand edge, ip = initial phase, x = -- increment -- --
--   draw (phasor 9.0 (4.5::Float) 0.5)
--   draw (phasor 9 (0::Int32) 1)
--   audition_text 10 (out1 (phasor' 5.0 0.0 1.0))
--   
phasor' :: K_Num a => DF a -> a -> DF a -> DF a -- | lift_mce2 of phasor'. phasor :: K_Num a => DF a -> a -> DF a -> DF a -- | Allocate n second array, variant of df_vec. a_alloc_sec :: V_Id -> Float -> DF (Vec Float) -- | Array delay with phasor argument for write index. a_delay_ph :: DF (Vec Float) -> DF Float -> DF Int32 -> DF Int32 -> DF Float -- | Array delay. a = array, s = signal, n = number of frames. -- --
--   do {a <- df_vec_m [0,1,2]
--      ;draw (a_delay a 0.0 0)}
--   
-- --
--   let {f = sin_osc 0.1 0.0
--       ;o = sin_osc (f * 200.0 + 600.0) 0.0
--       ;a = df_vec (V_Id 0) (replicate 48000 0)
--       ;d = a_delay a o 24000}
--   in audition_rju [] (out2 (o * 0.1) (d * 0.05))
--   
a_delay :: DF (Vec Float) -> DF Float -> DF Int32 -> DF Float -- | SC3 UGen. delay_n :: Int -> DF Float -> Float -> DF Float -> DF Float -- | Array fill function (sin). -- --
--   let {i = phasor 64 0 1
--       ;a = a_tbl_sin (V_Id 0) 64
--       ;s = a_read a i}
--   in audition_rju [] (out1 (s * 0.2))
--   
a_tbl_sin :: V_Id -> Int -> DF (Vec Float) -- | Linear interpolating variant of a_read. -- --
--   let {i = phasor 64.0 0 (hz_to_incr k_sample_rate 64.0 330.0)
--       ;a = a_tbl_sin (V_Id 0) 64
--       ;s = a_lerp a i}
--   in audition_rju [] (out1 (s * 0.2))
--   
a_lerp :: DF (Vec Float) -> DF Float -> DF Float a_tbl :: Int -> [Float] -> DF (Vec Float) -- | phasor for table of z places. ip is in (0,1). -- --
--   draw (phasor 64.0 (0.0::Float) (hz_to_incr k_sample_rate 64.0 330.0))
--   draw (tbl_phasor 64 0.0 330.0)
--   
tbl_phasor :: Int -> Float -> DF Float -> DF Float -- | Table lookup oscillator. ip is in (0,1). -- --
--   let {a = a_tbl_sin (V_Id 0) 256
--       ;f = a_osc a 4.0 0.0
--       ;o = a_osc a (f * 200.0 + 400.0) 0.0}
--   in audition_rju [] (out1 (o * 0.1))
--   
-- -- Cancellation: -- --
--   let {a = a_tbl_sin (V_Id 0) 256
--       ;o1 = a_osc a 440.0 0.0
--       ;o2 = a_osc a 440.0 0.5}
--   in audition_rju [] (out1 (o1 + o2))
--   
a_osc :: DF (Vec Float) -> DF Float -> Float -> DF Float -- | Single sample delay with indicated initial value. -- --
--   draw (unit_delay (0::Int32) 1)
--   draw (unit_delay (0.0::Float) 1.0)
--   
-- --
--   let {c = counter 0.0 1.0
--       ;d = unit_delay 0.0 c}
--   in audition_text 12 (out2 c d)
--   
unit_delay :: K' a => a -> DF a -> DF a -- | Signal that is initially True then always False. -- --
--   audition_text 5 (out1 (latch (white_noise 812875317) unit_trigger))
--   
unit_trigger :: DF Bool -- | Two place infinite impulse response filter. Inputs are: f= -- function (x0 y1 y2 -> y0), i = input signal. -- --
--   let {c1 = iir2 (\x y1 _ -> x + y1) 0.001
--       ;o1 = sin_osc (c1 + 220.0) 0
--       ;c2 = iir2 (\x _ y2 -> x + y2) 0.001
--       ;o2 = sin_osc (c2 + 220.0) 0}
--   in audition_rju [] (out2 (o1 * 0.1) (o2 * 0.1))
--   
iir2 :: K_Num a => (Ternary_Op (DF a)) -> DF a -> DF a -- | Single place finite impulse response filter. fir1 :: K' a => a -> (DF a -> DF a -> DF b) -> DF a -> DF b -- | Two place finite impulse response filter. fir2 :: (Ternary_Op (DF Float)) -> DF Float -> DF Float -- | Ordinary biquad filter section. biquad :: (Quinary_Op (DF Float)) -> DF Float -> DF Float -- | Counter from indicated initial value by indicated step. -- --
--   draw (counter (0::Int32) 1)
--   draw (counter (0.0::Float) 1.0)
--   
-- --
--   audition_text 10 (out1 (counter 0.0 1.0))
--   audition_text 10 (out1 (counter 0.0 (white_noise 165876521 * 0.25)))
--   
counter :: K_Num a => a -> DF a -> DF a -- | counter that resets to the initial phase at trigger. -- --
--   let tr = trigger (impulse (k_sample_rate / 3) 0.0)
--   in audition_text 10 (out1 (counter_reset 0.0 1.0 tr))
--   
counter_reset :: K_Num a => a -> DF a -> DF Bool -> DF a -- | Counter from 0 to 1 over duration (in seconds). Holds end value. unit_line :: DF Float -> DF Float -- | lin_lin of unit_line. -- --
--   audition_rju [] (out1 (sin_osc (line 110 440 100) 0 * 0.1))
--   
line :: DF Float -> DF Float -> DF Float -> DF Float -- | SC3 UGen. -- --
--   audition_text 20 (out1 (counter 30 10))
--   audition_text 20 (out1 (ramp (counter 30 10) (3 / k_sample_rate)))
--   
ramp :: DF Float -> DF Float -> DF Float -- | Buffer delay. -- --
--   draw (buf_delay 0 0.0 0)
--   
buf_delay :: DF Int32 -> DF Float -> DF Int32 -> DF Float -- | Non-interpolating comb filter. Inputs are: b = buffer index, -- i = input signal, dl = delay time, dc = decay -- time. -- -- All times are in seconds. The decay time is the time for the echoes to -- decay by 60 decibels. If this time is negative then the -- feedback coefficient will be negative, thus emphasizing only odd -- harmonics at an octave lower. -- --
--   draw (out1 (buf_comb_n 0 0.0 0.0 0.0))
--   
-- -- Comb used as a resonator. The resonant fundamental is equal to -- reciprocal of the delay time. -- --
--   import qualified Sound.SC3 as S
--   
-- --
--   let {n = white_noise 0
--       ;dt = let f x = lin_exp (x + 2.0) 1.0 2.0 0.0001 0.01
--             in f (lf_saw 0.1 0.0)
--       ;c = buf_comb_n 0 (n * 0.1) dt 0.2}
--   in audition_rju [S.b_alloc 0 48000 1] (out1 c)
--   
-- -- Comb used as an echo. -- --
--   let {i = impulse 0.5 0.0
--       ;n = white_noise 0
--       ;e = decay (i * 0.5) 0.2
--       ;c = buf_comb_n 0 (e * n) 0.2 3.0}
--   in audition_rju [S.b_alloc 0 48000 1] (out1 c)
--   
buf_comb_n :: DF Int32 -> DF Float -> DF Float -> DF Float -> DF Float -- | Array variant of buf_comb_n. Max delay time is in seconds. -- --
--   let {n = white_noise 0
--       ;dt = let f x = lin_exp (x + 2.0) 1.0 2.0 0.0001 0.01
--             in f (lf_saw 0.1 0.0)
--       ;c = comb_n [0] 0.1 (n * 0.1) dt 0.2}
--   in audition_rju [] (out c)
--   
-- --
--   let {i = impulse 0.5 0.0
--       ;n = white_noise 0
--       ;e = decay (i * 0.5) 0.2
--       ;c = comb_n [0] 0.2 (e * n) 0.2 3.0}
--   in audition_rju [] (out c)
--   
comb_n' :: V_Id -> Float -> DF Float -> DF Float -> DF Float -> DF Float -- | Allow MCE. comb_n :: [Int] -> Float -> DF Float -> DF Float -> DF Float -> DF Float allpass_n' :: V_Id -> Float -> DF Float -> DF Float -> DF Float -> DF Float silent :: DF Float -- | Int32 linear congruential generator, hence signed modulo of -- 2^32. Note that the state and all internal math is 32bit. -- -- See http://en.wikipedia.org/wiki/Linear_congruential_generator -- for possible parameters. lcg_i32 :: Int32 -> Int32 -> Int32 -> DF Int32 -- | lcg_i32 1103515245 12345, so in (minBound,maxBound). lcg_glibc :: Int32 -> DF Int32 -- | abs of 'lcg_glibc, so in (0,maxBound). randi :: Int32 -> DF Int32 -- | i32_to_normal_f32 of randi, so in (0,1). -- --
--   audition_text 24 (out1 (randf 0))
--   
randf :: Int32 -> DF Float -- | White noise (-1,1). Generates noise whose spectrum has equal power at -- all frequencies. -- --
--   audition_text 24 (out1 (white_noise 0))
--   
-- --
--   let n = white_noise 0 * 0.1
--   in draw (out1 (n - n))
--   
-- --
--   let {n = white_noise 0 * 0.1
--       ;m = white_noise 5 * 0.1}
--   in audition_rju [] (out1 (n - m))
--   
white_noise :: Int32 -> DF Float -- | SC3 UGen. -- --
--   let freq = lin_lin (lf_noise1 0 1) (-1) 1 220 440
--   in audition_rju [] (out1 (sin_osc freq 0 * 0.1))
--   
lf_noise1 :: Int32 -> DF Float -> DF Float -- | iir1 brown noise function. brown_noise_f :: Binary_Op (DF Float) -- | Brown noise (-1,1). Generates noise whose spectrum falls off in power -- by 6 dB per octave. -- --
--   let n = brown_noise 0
--   in audition_rju [] (out1 (n * 0.1))
--   
-- --
--   let {n = brown_noise 0
--       ;f = lin_exp n (-1.0) 1.0 64.0 9600.0
--       ;o = sin_osc f 0}
--   in audition_rju [] (out1 (o * 0.1))
--   
brown_noise :: Int32 -> DF Float -- | SC3 UGen. -- --
--   audition_rju [] (out1 (dust 0 200 * 0.25))
--   audition_rju [] (out1 (dust 0 (sin_osc 0.1 0 * 500 + 550) * 0.25))
--   
dust :: Int32 -> DF Float -> DF Float -- | SC3 UGen. -- --
--   audition_rju [] (out1 (sin_osc (rand 6987612487 220.0 600.0) 0.0 * 0.1))
--   
rand :: Int32 -> DF Float -> DF Float -> DF Float -- | Sine oscillator. Inputs are: f = frequency (in hz), ip = -- initial phase. -- --
--   let o = sin_osc 440.0 0.0
--   in audition_rju [] (out1 (o * 0.1))
--   
-- -- Used as both Oscillator and LFO. -- --
--   let {f = sin_osc 4.0 0.0
--       ;o = sin_osc (f * 200.0 + 400.0) 0.0}
--   in audition_rju [] (out1 (o * 0.1))
--   
-- -- Cancellation. -- --
--   let {o1 = sin_osc 440.0 0.0
--       ;o2 = sin_osc 440.0 pi}
--   in audition_rju [] (out1 (o1 + o2))
--   
sin_osc :: DF Float -> Float -> DF Float -- | Impulse oscillator (non band limited). Outputs non band limited single -- sample impulses. Inputs are: f = frequency (in hertz), -- ip = phase offset (0..1) -- --
--   let o = impulse 800.0 0.0
--   in audition_rju [] (out1 (o * 0.1))
--   
-- --
--   let {f = sin_osc 0.25 0.0 * 2500.0 + 2505.0
--       ;o = impulse f 0.0}
--   in audition_rju [] (out1 (o * 0.1))
--   
-- --
--   audition_text 10 (out1 (impulse (w_sample_rate / 5.0) 0.0))
--   audition_text 10 (out1 (impulse (k_sample_rate / 5.0) 0.0))
--   
impulse :: DF Float -> Float -> DF Float -- | Non-band limited sawtooth oscillator. Output ranges from -1 to +1. -- Inputs are: f = frequency (in hertz), ip = initial phase -- (0,2). -- --
--   let o = lf_saw 500.0 1.0
--   in audition_rju [] (out1 (o * 0.1))
--   
-- -- Used as both Oscillator and LFO. -- --
--   let {f = lf_saw 4.0 0.0
--       ;o = lf_saw (f * 400.0 + 400.0) 0.0}
--   in audition_rju [] (out1 (o * 0.1))
--   
lf_saw :: DF Float -> Float -> DF Float -- | Non-band-limited pulse oscillator. Outputs a high value of one and a -- low value of zero. Inputs are: f = frequency (in hertz), -- ip = initial phase (0,1), w = pulse width duty cycle -- (0,1). -- --
--   let {o1 = lf_pulse 3.0 0.0 0.3 * 200.0 + 200.0
--       ;o2 = lf_pulse o1 0.0 0.2 * 0.1}
--   in audition_rju [] (out1 o2)
--   
lf_pulse :: DF Float -> Float -> DF Float -> DF Float -- | Two zero fixed midpass filter. bpz2 :: DF Float -> DF Float -- | Two zero fixed midcut filter. brz2 :: DF Float -> DF Float -- | Two point difference filter hpz1 :: DF Float -> DF Float -- | Two zero fixed highpass filter hpz2 :: DF Float -> DF Float -- | Two point average filter lpz1 :: DF Float -> DF Float -- | Two zero fixed lowpass filter lpz2 :: DF Float -> DF Float -- | Given cf construct iir1 one-pole function. one_pole_f :: Fractional a => a -> Binary_Op a -- | One pole filter. -- --
--   let {n = white_noise 0
--       ;f = one_pole (n * 0.5) 0.95}
--   in audition_rju [] (out1 f)
--   
one_pole :: DF Float -> DF Float -> DF Float -- | Given cf construct fir1 one-zero function. one_zero_f :: Fractional a => a -> Binary_Op a -- | One zero filter. -- --
--   let {n = white_noise 0
--       ;f = one_zero (n * 0.5) 0.5}
--   in audition_rju [] (out1 f)
--   
one_zero :: DF Float -> DF Float -> DF Float -- | Given coefficients construct biquad sos function. sos_f :: Num a => a -> a -> a -> a -> a -> Quinary_Op a -- | Second order filter section. sos :: DF Float -> DF Float -> DF Float -> DF Float -> DF Float -> DF Float -> DF Float -- | Given f and rq construct iir2 resonz -- function. resonz_f :: DF Float -> DF Float -> Ternary_Op (DF Float) resonz' :: DF Float -> DF Float -> DF Float -> DF Float -- | A two pole resonant filter with zeroes at z = +/- 1. Based on K. -- Steiglitz, "A Note on Constant-Gain Digital Resonators", Computer -- Music Journal, vol 18, no. 4, pp. 8-10, Winter 1994. The -- reciprocal of Q is used rather than Q because it saves a divide -- operation inside the unit generator. -- -- Inputs are: i = input signal, f = resonant frequency (in -- hertz), rq = bandwidth ratio (reciprocal of Q);where rq -- = bandwidth / centerFreq. -- --
--   let {n = white_noise 0
--       ;r = resonz (n * 0.5) 440.0 0.1}
--   in audition_rju [] (out1 r)
--   
-- -- Modulate frequency -- --
--   let {n = white_noise 0
--       ;f = lf_saw 0.1 0.0 * 3500.0 + 4500.0
--       ;r = resonz (n * 0.5) f 0.05}
--   in audition_rju [] (out1 r)
--   
resonz :: DF Float -> DF Float -> DF Float -> DF Float -- | Given f and r construct iir2 rlpf -- function. rlpf_f :: DF Float -> DF Float -> Ternary_Op (DF Float) -- | Resonant low pass filter. Inputs are: i = input signal, -- f = frequency (hertz), rq = reciprocal of Q (resonance). -- --
--   let {n = white_noise 0
--       ;f = sin_osc 0.5 0.0  * 40.0 + 220.0
--       ;r = rlpf n f 0.1}
--   in audition_rju [] (out1 r)
--   
rlpf' :: DF Float -> DF Float -> DF Float -> DF Float -- | Allow MCE. rlpf :: DF Float -> DF Float -> DF Float -> DF Float -- | 5-tuple type T5 t = (t, t, t, t, t) -- | 2nd order Butterworth high-pass filter coefficients. -- --
--   hpf_c 48000.0 (440.0 :: DF Float)
--   
lpf_or_hpf_c :: Floating t => Bool -> t -> t -> T5 t -- | High pass filter. hpf :: DF Float -> DF Float -> DF Float -- | Low pass filter. lpf :: DF Float -> DF Float -> DF Float -- | df_gt 0. positive :: K_Num a => DF a -> DF Bool -- | df_not of positive. non_positive :: K_Num a => DF a -> DF Bool -- | fir1 trigger function. trigger_f :: K_Num a => DF a -> DF a -> DF Bool -- | True on non-positive to positive transition. trigger :: K_Num a => DF a -> DF Bool -- | Count True values at input. -- --
--   let n = white_noise 0
--   in audition_text 12 (out2 n (count_true (trigger n)))
--   
count_true :: K_Num a => DF Bool -> DF a -- | Pulse divider at Bool. pulse_divider :: DF Bool -> DF Int32 -> DF Int32 -> DF Bool -- | SC3 PulseDivider. -- --
--   let n = white_noise 0
--   in audition_text 12 (out2 n (pulse_divider' n 2 1))
--   
pulse_divider' :: K_Num a => DF a -> DF Int32 -> DF Int32 -> DF a -- | Sample and hold. Holds input signal value when triggered. Inputs are: -- i = input signal, t = trigger. -- --
--   let {n = white_noise 0
--       ;i = impulse 9.0 0.0
--       ;l = latch n (trigger i)
--       ;o = sin_osc (l * 400.0 + 500.0) 0.0}
--   in audition_rju [] (out1 (o * 0.2))
--   
latch :: K_Num a => DF a -> DF Bool -> DF a -- | Given dt construct iir1 decay function. decay_f :: DF Float -> Binary_Op (DF Float) -- | Exponential decay. Inputs are: i = input signal, t = -- decay time. This is essentially the same as Integrator except that -- instead of supplying the coefficient directly, it is caculated from a -- 60 dB decay time. This is the time required for the integrator to lose -- 99.9 % of its value or -60dB. This is useful for exponential decaying -- envelopes triggered by impulses. -- -- Used as an envelope. -- --
--   let {n = brown_noise 0
--       ;f = lf_saw 0.1 0.0
--       ;i = impulse (lin_lin f (-1.0) 1.0 2.0 5.0) 0.25
--       ;e = decay i 0.2}
--   in audition_rju [] (out1 (e * n))
--   
decay :: DF Float -> DF Float -> DF Float -- | Exponential decay (equivalent to decay dcy - decay atk). decay2 :: DF Float -> DF Float -> DF Float -> DF Float -- | Single sample delay. delay1 :: DF Float -> DF Float -- | Two sample delay. -- --
--   audition_text 10 (out1 (delay2 (counter 0 1)))
--   
delay2 :: DF Float -> DF Float -- | Given t construct iir1 lag function. lag_f :: DF Float -> Binary_Op (DF Float) -- | Simple averaging filter. Inputs are: i = input signal, t -- = lag time. -- --
--   let {s = sin_osc 0.05 0.0
--       ;f = lin_lin s (-1.0) 1.0 220.0 440.0
--       ;o = sin_osc f 0.0
--       ;f' = lag f 1.0
--       ;o' = sin_osc f' 0.0}
--   in audition_rju [] (out2 (o * 0.2) (o' * 0.2))
--   
lag :: DF Float -> DF Float -> DF Float -- | Nested lag filter. lag2 :: DF Float -> DF Float -> DF Float -- | Twice nested lag filter. lag3 :: DF Float -> DF Float -> DF Float -- | Data flow node functions, or unit generators. module Sound.DF.Uniform.GADT.UGen.Monadic -- | Single place infinite impulse response filter with indicated initial -- value. -- --
--   import Data.Int
--   import Sound.DF.Uniform.GADT
--   draw =<< iir1_m (0::Int32) (+) 1
--   draw =<< iir1_m (0::Float) (+) 1
--   
iir1_m :: (K' a, UId m) => a -> (Binary_Op (DF a)) -> DF a -> m (DF a) -- | r = right hand edge, ip = initial phase, x = -- increment -- --
--   draw =<< phasor_m 9.0 (4.5::Float) 0.5
--   drawM (phasor_m 9 (0::Int32) 1)
--   
phasor_m :: (K_Num a, UId m) => DF a -> a -> DF a -> m (DF a) -- | Allocate n second array, variant of df_vec. a_alloc_sec_m :: UId m => Float -> m (DF (Vec Float)) -- | Array delay. -- --
--   do {a <- df_vec_m [0,1,2]
--      ;d <- a_delay a 0.0 0
--      ;draw (a_delay a 0.0 0)}
--   
-- --
--   do {f <- sin_osc 0.1 0.0
--      ;o <- sin_osc (f * 200.0 + 600.0) 0.0
--      ;a <- df_vec_m (replicate 48000 0)
--      ;d <- a_delay a o 24000
--      ;audition [] (out2 (o * 0.1) (d * 0.05))}
--   
a_delay_m :: UId m => DF (Vec Float) -> DF Float -> DF Int32 -> m (DF Float) -- | Array fill function (sin). a_tbl_sin_m :: UId m => Int -> m (DF (Vec Float)) -- | phasor for table of z places. ip is in (0,1). -- --
--   drawM (phasor 64.0 (0.0::Float) (hz_to_incr k_sample_rate 64.0 330.0))
--   drawM (tbl_phasor 64 0.0 330.0)
--   
tbl_phasor_m :: UId m => Int -> Float -> DF Float -> m (DF Float) -- | Table lookup oscillator. ip is in (0,1). -- --
--   do {a <- a_tbl_sin 256
--      ;f <- a_osc a 4.0 0.0
--      ;o <- a_osc a (f * 200.0 + 400.0) 0.0
--      ;audition [] (out1 (o * 0.1))}
--   
-- -- Cancellation: -- --
--   do {a <- a_tbl_sin 256
--      ;o1 <- a_osc a 440.0 0.0
--      ;o2 <- a_osc a 440.0 0.5
--      ;audition [] (out1 (o1 + o2))}
--   
a_osc_m :: UId m => DF (Vec Float) -> DF Float -> Float -> m (DF Float) -- | Single sample delay with indicated initial value. -- --
--   drawM (unit_delay_m (0::Int32) 1)
--   drawM (unit_delay_m (0.0::Float) 1.0)
--   
-- --
--   do {c <- counter_m 0 1.0
--      ;d <- unit_delay_m 0 c
--      ;audition_text 12 (out2 c d)}
--   
unit_delay_m :: (K' a, UId m) => a -> DF a -> m (DF a) -- | Two place infinite impulse response filter. Inputs are: f= -- function (x0 y1 y2 -> y0), i = input signal. -- --
--   do {c1 <- iir2 (\x y1 _ -> x + y1) 0.001
--      ;o1 <- sin_osc (c1 + 220.0) 0
--      ;c2 <- iir2 (\x _ y2 -> x + y2) 0.001
--      ;o2 <- sin_osc (c2 + 220.0) 0
--      ;audition [] (out2 (o1 * 0.1) (o2 * 0.1))}
--   
iir2_m :: (K_Num a, UId m) => (Ternary_Op (DF a)) -> DF a -> m (DF a) -- | Single place finite impulse response filter. fir1_m :: UId m => (Binary_Op (DF Float)) -> DF Float -> m (DF Float) -- | Two place finite impulse response filter. fir2_m :: UId m => (Ternary_Op (DF Float)) -> DF Float -> m (DF Float) -- | Ordinary biquad filter section. biquad_m :: UId m => (Quinary_Op (DF Float)) -> DF Float -> m (DF Float) -- | Counter from indicated initial value. -- --
--   draw =<< counter (0::Int32) 1
--   drawM (counter (0.0::Float) 1.0)
--   
-- --
--   audition_text 10 . out1 =<< counter_m 0.0 1.0
--   
counter_m :: (K_Num a, UId m) => a -> DF a -> m (DF a) -- | Buffer delay. -- --
--   drawM (buf_delay 0 0.0 0)
--   
buf_delay_m :: UId m => DF Int32 -> DF Float -> DF Int32 -> m (DF Float) -- | Non-interpolating comb filter. Inputs are: b = buffer index, -- i = input signal, dl = delay time, dc = decay -- time. -- -- All times are in seconds. The decay time is the time for the echoes to -- decay by 60 decibels. If this time is negative then the -- feedback coefficient will be negative, thus emphasizing only odd -- harmonics at an octave lower. -- --
--   drawM (fmap out1 (buf_comb_n 0 0.0 0.0 0.0))
--   
-- -- Comb used as a resonator. The resonant fundamental is equal to -- reciprocal of the delay time. -- --
--   import qualified Sound.SC3 as S
--   
-- --
--   do {n <- white_noise_m
--      ;dt <- let f x = lin_exp (x + 2.0) 1.0 2.0 0.0001 0.01
--             in fmap f (lf_saw 0.1 0.0)
--      ;c <- buf_comb_n 0 (n * 0.1) dt 0.2
--      ;audition [S.b_alloc 0 48000 1] (out1 c)}
--   
-- -- Comb used as an echo. -- --
--   do {i <- impulse 0.5 0.0
--      ;n <- white_noise_m
--      ;e <- decay (i * 0.5) 0.2
--      ;c <- buf_comb_n 0 (e * n) 0.2 3.0
--      ;audition [S.b_alloc 0 48000 1] (out1 c)}
--   
buf_comb_n_m :: UId m => DF Int32 -> DF Float -> DF Float -> DF Float -> m (DF Float) -- | Array variant of buf_comb_n. Max delay time is in seconds. -- --
--   do {n <- white_noise_m
--      ;dt <- let f x = lin_exp (x + 2.0) 1.0 2.0 0.0001 0.01
--             in fmap f (lf_saw 0.1 0.0)
--      ;c <- comb_n 0.1 (n * 0.1) dt 0.2
--      ;audition [] (out1 c)}
--   
-- --
--   do {i <- impulse 0.5 0.0
--      ;n <- white_noise_m
--      ;e <- decay (i * 0.5) 0.2
--      ;c <- comb_n 0.2 (e * n) 0.2 3.0
--      ;audition [] (out1 c)}
--   
comb_n_m :: UId m => Float -> DF Float -> DF Float -> DF Float -> m (DF Float) -- | White noise (-1,1). Generates noise whose spectrum has equal power at -- all frequencies. -- --
--   do {n <- white_noise_m
--      ;audition [] (out1 (n * 0.1))}
--   
white_noise_m :: UId m => m (DF Float) -- | Brown noise (-1,1). Generates noise whose spectrum falls off in power -- by 6 dB per octave. -- --
--   do {n <- brown_noise_m
--      ;audition [] (out1 (n * 0.1))}
--   
-- --
--   do {n <- brown_noise_m
--      ;let f = lin_exp n (-1.0) 1.0 64.0 9600.0
--       in do {o <- sin_osc f 0
--             ;audition [] (out1 (o * 0.1))}}
--   
brown_noise_m :: UId m => m (DF Float) -- | Sine oscillator. Inputs are: f = frequency (in hz), ip = -- initial phase. -- --
--   do {o <- sin_osc 440.0 0.0
--      ;audition [] (out1 (o * 0.1))}
--   
-- -- Used as both Oscillator and LFO. -- --
--   do {f <- sin_osc 4.0 0.0
--      ;o <- sin_osc (f * 200.0 + 400.0) 0.0
--      ;audition [] (out1 (o * 0.1))}
--   
-- -- Cancellation. -- --
--   do {o1 <- sin_osc 440.0 0.0
--      ;o2 <- sin_osc 440.0 pi
--      ;audition [] (out1 (o1 + o2))}
--   
sin_osc_m :: UId m => DF Float -> Float -> m (DF Float) -- | Impulse oscillator (non band limited). Outputs non band limited single -- sample impulses. Inputs are: f = frequency (in hertz), -- ip = phase offset (0..1) -- --
--   do {o <- impulse 800.0 0.0
--      ;audition [] (out1 (o * 0.1))}
--   
-- --
--   do {f <- fmap (\x -> x * 2500.0 + 2505.0) (sin_osc 0.25 0.0)
--      ;o <- impulse f 0.0
--      ;audition [] (out1 (o * 0.1))}
--   
impulse_m :: UId m => DF Float -> Float -> m (DF Float) -- | Non-band limited sawtooth oscillator. Output ranges from -1 to +1. -- Inputs are: f = frequency (in hertz), ip = initial phase -- (0,2). -- --
--   do {o <- lf_saw 500.0 1.0
--      ;audition [] (out1 (o * 0.1))}
--   
-- -- Used as both Oscillator and LFO. -- --
--   do {f <- lf_saw 4.0 0.0
--      ;o <- lf_saw (f * 400.0 + 400.0) 0.0
--      ;audition [] (out1 (o * 0.1))}
--   
lf_saw_m :: UId m => DF Float -> Float -> m (DF Float) -- | Non-band-limited pulse oscillator. Outputs a high value of one and a -- low value of zero. Inputs are: f = frequency (in hertz), -- ip = initial phase (0,1), w = pulse width duty cycle -- (0,1). -- --
--   do {o1 <- fmap (\x -> x * 200.0 + 200.0) (lf_pulse 3.0 0.0 0.3)
--      ;o2 <- fmap (\x -> x * 0.1) (lf_pulse o1 0.0 0.2)
--      ;audition [] (out1 o2)}
--   
lf_pulse_m :: UId m => DF Float -> Float -> DF Float -> m (DF Float) -- | Two zero fixed midpass filter. bpz2_m :: UId m => DF Float -> m (DF Float) -- | Two zero fixed midcut filter. brz2_m :: UId m => DF Float -> m (DF Float) -- | Two point average filter lpz1_m :: UId m => DF Float -> m (DF Float) -- | Two zero fixed lowpass filter lpz2_m :: UId m => DF Float -> m (DF Float) -- | One pole filter. -- --
--   do {n <- white_noise_m
--      ;f <- one_pole (n * 0.5) 0.95
--      ;audition [] (out1 f)}
--   
one_pole_m :: UId m => DF Float -> DF Float -> m (DF Float) -- | One zero filter. -- --
--   do {n <- white_noise_m
--      ;f <- one_zero (n * 0.5) 0.5
--      ;audition [] (out1 f)}
--   
one_zero_m :: UId m => DF Float -> DF Float -> m (DF Float) -- | Second order filter section. sos_m :: UId m => DF Float -> DF Float -> DF Float -> DF Float -> DF Float -> DF Float -> m (DF Float) -- | A two pole resonant filter with zeroes at z = +/- 1. Based on K. -- Steiglitz, "A Note on Constant-Gain Digital Resonators", Computer -- Music Journal, vol 18, no. 4, pp. 8-10, Winter 1994. The -- reciprocal of Q is used rather than Q because it saves a divide -- operation inside the unit generator. -- -- Inputs are: i = input signal, f = resonant frequency (in -- hertz), rq = bandwidth ratio (reciprocal of Q);where rq -- = bandwidth / centerFreq. -- --
--   do {n <- white_noise_m
--      ;r <- resonz (n * 0.5) 440.0 0.1
--      ;audition [] (out1 r)}
--   
-- -- Modulate frequency -- --
--   do {n <- white_noise_m
--      ;f <- fmap (\x -> x * 3500.0 + 4500.0) (lf_saw 0.1 0.0)
--      ;r <- resonz (n * 0.5) f 0.05
--      ;audition [] (out1 r)}
--   
resonz_m :: UId m => DF Float -> DF Float -> DF Float -> m (DF Float) -- | Resonant low pass filter. Inputs are: i = input signal, -- f = frequency (hertz), rq = reciprocal of Q (resonance). -- --
--   do {n <- white_noise_m
--      ;f <- fmap (\x -> x * 40.0 + 220.0) (sin_osc 0.5 0.0)
--      ;r <- rlpf n f 0.1
--      ;audition [] (out1 r)}
--   
rlpf_m :: UId m => DF Float -> DF Float -> DF Float -> m (DF Float) -- | Sample and hold. Holds input signal value when triggered. Inputs are: -- i = input signal, t = trigger. -- --
--   do {n <- white_noise_m
--      ;i <- impulse_m 9.0 0.0
--      ;l <- latch_m n (trigger i)
--      ;o <- sin_osc (l * 400.0 + 500.0) 0.0
--      ;audition [] (out1 (o * 0.2))}
--   
latch_m :: (K_Num a, UId m) => DF a -> DF Bool -> m (DF a) -- | Exponential decay. Inputs are: i = input signal, t = -- decay time. This is essentially the same as Integrator except that -- instead of supplying the coefficient directly, it is caculated from a -- 60 dB decay time. This is the time required for the integrator to lose -- 99.9 % of its value or -60dB. This is useful for exponential decaying -- envelopes triggered by impulses. -- -- Used as an envelope. -- --
--   do {n <- brown_noise_m
--      ;f <- lf_saw 0.1 0.0
--      ;i <- impulse (lin_lin f (-1.0) 1.0 2.0 5.0) 0.25
--      ;e <- decay i 0.2
--      ;audition [] (out1 (e * n))}
--   
decay_m :: UId m => DF Float -> DF Float -> m (DF Float) -- | Exponential decay (equivalent to decay dcy - decay atk). decay2_m :: UId m => DF Float -> DF Float -> DF Float -> m (DF Float) -- | Single sample delay. delay1_m :: (K_Num a, UId m) => DF a -> m (DF a) -- | Two sample delay. delay2_m :: (K_Num a, UId m) => DF a -> m (DF a) -- | Simple averaging filter. Inputs are: i = input signal, t -- = lag time. -- --
--   do {s <- sin_osc 0.05 0.0
--      ;let f = lin_lin s (-1.0) 1.0 220.0 440.0
--       in do {o <- sin_osc f 0.0
--             ;f' <- lag f 1.0
--             ;o' <- sin_osc f' 0.0
--             ;audition [] (out2 (o * 0.2) (o' * 0.2))}}
--   
lag_m :: UId m => DF Float -> DF Float -> m (DF Float) -- | Nested lag filter. lag2_m :: UId m => DF Float -> DF Float -> m (DF Float) -- | Twice nested lag filter. lag3_m :: UId m => DF Float -> DF Float -> m (DF Float) -- | Graph drawing module Sound.DF.Uniform.GADT.Draw -- | draw of df_erase. draw :: K' a => DF a -> IO () -- | draw' of df_erase. draw' :: K' a => DF a -> IO () -- | draw of df_erase of evalId. drawM :: K' a => State Id (DF a) -> IO () -- | gr_draw of df_erase. gr_draw :: K' a => DF a -> IO () -- | gr_draw' of df_erase. gr_draw' :: K' a => DF a -> IO () -- | gr_draw of df_erase of evalId. gr_drawM :: K' a => State Id (DF a) -> IO () -- | Top level module for uniform rate model hdf. -- --
--   import Sound.DF.Uniform.GADT
--   draw (lf_pulse 0.09 0.0 0.16)
--   
module Sound.DF.Uniform.GADT