-
Notifications
You must be signed in to change notification settings - Fork 0
/
SignalDiagrams.hs
40 lines (34 loc) · 1.65 KB
/
SignalDiagrams.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module SignalDiagrams where
import Shared (linearDiagramVerticalPadding,arcMidpoint,showDoubleTruncated,showValueMapTruncatedDouble,lineOfText)
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
import qualified PatternExpressions as PE
import qualified LinearDiagrams.LinearDiagrams as Lin
import qualified LinearDiagrams.Arc as A
import qualified LinearDiagrams.Curve as C
import qualified Sound.Tidal.Context as T
sigEvaluatesAtMiddle :: Diagram B
sigEvaluatesAtMiddle =
vsep linearDiagramVerticalPadding [
(C.curveDiagramLabeledPoint show PE.sigEvaluatesAtMiddleFunctionExpr (arcMidpoint PE.sigEvaluatesAtMiddleArcExpr)
<> C.curveDiagram PE.sigEvaluatesAtMiddleFunctionExpr 10)
,A.arcDiagram [PE.sigEvaluatesAtMiddleArcExpr]
]
sigToSetPanning :: Diagram B
sigToSetPanning =
vsep linearDiagramVerticalPadding [
(mconcat labeledpoints
<> C.curveDiagram PE.sigToSetPanningFunctionExpr 1)
,strut (unitY * 0.01)
,lineOfText PE.sigToSetPanningSegmentedCurveStringExpr
,Lin.diagramFromWholes showDoubleTruncated PE.sigToSetPanningSegmentedCurveExpr 1
,strut (unitY * 0.01)
,lineOfText PE.sigToSetPanningStringExpr
,Lin.diagramFromWholes showValueMapTruncatedDouble PE.sigToSetPanningExpr 1
]
where
segmentevents = T.queryArc PE.sigToSetPanningSegmentedCurveExpr (T.Arc 0 1)
arcs = map T.eventPart segmentevents
labeledpoints = map curvePointFromArc arcs
curvePointFromArc :: T.Arc -> Diagram B
curvePointFromArc thearc = C.curveDiagramLabeledPoint showDoubleTruncated PE.sigToSetPanningFunctionExpr (arcMidpoint thearc)