synth_blocks 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/synth_blocks/mod/adsr.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b48b18ff126e75f9b5cf3eedf13a9c7b3d80d09c2d2daa35366143ac57ee319
|
4
|
+
data.tar.gz: f092bdb9ce66e45f45217839c7c3bec68c0778a78956f0738841e1ce4ce9bc5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 560831bb8cf63cf5532d16e89653982fdebd0af5393a3910ef139cfc6b068517fe89a33a1fc33ecdf0bbda643c0fc90184331c256ef4cc45067d19fe2368e5a7
|
7
|
+
data.tar.gz: 294b32b51dc7a6c1430b38d0b3ac1ab03e1c7fc18191e9ddb420ec1fed2f6d08bd91b209b1e3a5484b32228fa4ead1406598271e41dc2831c077071fa6b0e913
|
@@ -56,26 +56,26 @@ module SynthBlocks
|
|
56
56
|
return @value = sustain
|
57
57
|
end
|
58
58
|
else # release
|
59
|
-
if
|
59
|
+
if released <= attack # when released in attack phase
|
60
60
|
attack_level = linear(@start_value, 1, attack, released)
|
61
|
-
return linear(attack_level, 0, release, t - released)
|
61
|
+
return [linear(attack_level, 0, release, t - released), 0].max
|
62
62
|
end
|
63
|
-
if
|
63
|
+
if released > attack && released <= attack_decay # when released in decay phase
|
64
64
|
decay_level = linear(1.0, sustain, decay, released - attack)
|
65
|
-
return @value = linear(decay_level, 0, release, t - released)
|
65
|
+
return @value = [linear(decay_level, 0, release, t - released), 0].max
|
66
66
|
end
|
67
|
-
if
|
68
|
-
return @value = linear(sustain, 0, release, t - released)
|
69
|
-
end
|
70
|
-
if t >= released + release # after release
|
71
|
-
return @value = 0.0
|
67
|
+
if released > attack_decay # normal release
|
68
|
+
return @value = [linear(sustain, 0, release, t - released), 0].max
|
72
69
|
end
|
73
70
|
end
|
71
|
+
0.0
|
74
72
|
end
|
75
73
|
|
76
74
|
private
|
77
75
|
|
78
76
|
def linear(start, target, length, time)
|
77
|
+
return start if time == 0
|
78
|
+
return target if length == 0
|
79
79
|
(target - start) / length * time + start
|
80
80
|
end
|
81
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synth_blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Krutisch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|