Repository navigation
Expand file tree
/
Copy pathplot-flow.etchl
More file actions
75 lines (68 loc) · 1.79 KB
/
Copy pathplot-flow.etchl
File metadata and controls
75 lines (68 loc) · 1.79 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use "etchl/math" as math
use "etchl/palette" as palette
diagram "Building a signal" {
subtitle "Each stage names what it adds, and draws the signal it produces"
arrange compact { gap = 60 }
carrier: rectangle "Carrier" {
size = (200, 280)
body = "sin(2.5t)"
style = palette.info
vertical-align = top
}
envelope: rectangle "Envelope" {
at = (carrier.bounds.right + 60, carrier.bounds.top)
size = (200, 280)
body = "exp(-t/9)"
style = palette.warning
vertical-align = top
}
damped: rectangle "Damped" {
at = (envelope.bounds.right + 60, envelope.bounds.top)
size = (200, 280)
body = "their product"
style = palette.success
vertical-align = top
}
summed: rectangle "Summed" {
at = (damped.bounds.right + 60, damped.bounds.top)
size = (200, 280)
body = "plus a harmonic"
style = palette.accent
vertical-align = top
}
carrier -> envelope
envelope -> damped
damped -> summed
carrier-curve: math.plot {
at = (carrier.bounds.left + 15, carrier.bounds.top + 190)
x = 9.5 * t
y = 50 * sin(2.5*t)
t in [0, 18]
stroke = "#1d4ed8"
stroke-width = 1
}
envelope-curve: math.plot {
at = (envelope.bounds.left + 15, envelope.bounds.top + 240)
x = 9.5 * t
y = 0 - 95 * exp(0 - t / 9)
t in [0, 18]
stroke = "#b45309"
stroke-width = 1
}
damped-curve: math.plot {
at = (damped.bounds.left + 15, damped.bounds.top + 190)
x = 9.5 * t
y = 50 * sin(2.5*t) * exp(0 - t / 9)
t in [0, 18]
stroke = "#15803d"
stroke-width = 1
}
summed-curve: math.plot {
at = (summed.bounds.left + 15, summed.bounds.top + 190)
x = 9.5 * t
y = 50 * sin(2.5*t) * exp(0 - t / 9) + 20 * sin(7.5*t) * exp(0 - t / 5)
t in [0, 18]
stroke = "#7c3aed"
stroke-width = 1
}
}