Skip to content

Commit

Permalink
Adds nub constraint to input of tumultuous graphs and tests in example
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Solomon committed Oct 5, 2021
1 parent e56c217 commit 9fe2d86
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.3] - 2021-10-05

### Fixed

- nubs the input of tumultuous graphs so that one input can be used multiple times.

## [0.5.2] - 2021-10-05

### Fixed
Expand Down
37 changes: 22 additions & 15 deletions examples/tumult/Tumult.purs
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,27 @@ subPiece1 _ = unit # SG.loopUsingScene \(SGWorld time) _ ->
{ control: unit
, scene:
{ gnn: tumult
( let
sweep =
{ freq: globalFF $ pure $ 3000.0 + sin (pi * time * 0.2) * 2990.0
, q: globalFF $ pure $ 1.0
}
tmod = time % 10.0
tumult
| tmod < 2.0 = tumultuously ({ output: input (Proxy :: _ "shruti") } +> V.empty)
| tmod < 6.0 = tumultuously ({ output: bandpass sweep (input (Proxy :: _ "shruti")) } +> V.empty)
| otherwise = tumultuously ({ output: highpass sweep (input (Proxy :: _ "shruti")) } +> V.empty)
in
tumult
) { shruti: input (Proxy :: _ "beep") }

( let
sweep =
{ freq: globalFF $ pure $ 3000.0 + sin (pi * time * 0.2) * 2990.0
, q: globalFF $ pure $ 1.0
}
tmod = time % 10.0
tumult
| tmod < 2.0 = tumultuously ({ output: input (Proxy :: _ "shruti") } +> V.empty)
| tmod < 6.0 = tumultuously ({ output: highpass sweep (input (Proxy :: _ "shruti")) } +> V.empty)
| otherwise = tumultuously
( { output: gain 1.0
{ hpf: bandpass sweep (input (Proxy :: _ "shruti"))
, bpf: bandpass { freq: 200.0 } (input (Proxy :: _ "shruti"))
}
} +> V.empty
)
in
tumult
)
{ shruti: input (Proxy :: _ "beep") }

}
}

Expand All @@ -70,7 +77,7 @@ piece = unit # loopUsingScene \(SceneI env) _ ->
{ control: unit
, scene: speaker
{ gn: gain 1.0
{ sg2: subgraph vec
{ sg2: subgraph vec
(\i _ -> subPiece1 i)
(const $ const $ SGWorld env.time)
{ beep: loopBuf env.world.shruti }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "purescript-wags",
"version": "0.5.2",
"version": "0.5.3",
"description": "Web Audio Graphs as a Stream",
"scripts": {
"build": "spago build",
Expand Down
6 changes: 3 additions & 3 deletions src/WAGS/Validation.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Prelude hiding (Ordering(..))

import Data.Typelevel.Bool (False, True)
import Data.Typelevel.Num (class Pred, D0)
import Prim.Row (class Cons, class Lacks, class Nub)
import Prim.Row (class Cons, class Nub)
import Prim.Row as R
import Prim.RowList (class RowToList, RowList)
import Prim.RowList as RL
Expand Down Expand Up @@ -404,7 +404,6 @@ class GetInputList' (graph :: RowList Type) (inputs :: Row Type) | graph -> inpu
instance inputsAreInInputListNil :: GetInputList' RL.Nil ()
instance inputsAreInInputListCons ::
( Cons i Unit iii r
, Lacks i iii
, GetInputList' z iii
) =>
GetInputList' (RL.Cons a (NodeC (CTOR.TInput i) f) z) r
Expand All @@ -416,7 +415,8 @@ class GetInputList (graph :: Row Type) (inputs :: Row Type) | graph -> inputs

instance inputsAreInInputListAll ::
( RowToList graph graphR
, GetInputList' graphR inputs
, GetInputList' graphR inputs'
, Nub inputs' inputs
) =>
GetInputList graph inputs

Expand Down

0 comments on commit 9fe2d86

Please sign in to comment.