wtf_chord 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wtf_chord/chord.rb +1 -1
- data/lib/wtf_chord/collectors/piano.rb +6 -3
- data/lib/wtf_chord/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d79d3b4f0a6ef8088987819387a46e7e1b4fd4e03614f131dba94ea7cc19e6c8
|
4
|
+
data.tar.gz: e7122f195b69586a37c6a570bc0e3b64cf5f4ca8f1e357fc2504be86dfc0d0bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2defd3bdae6c97b0eeb1e899edc1204a53c61a124b6832ac5748c1083fae7714cf322ba53e0000fc36fd217bbd85c0393833fada192cc02df76a2aadd4661b1
|
7
|
+
data.tar.gz: 18d8cf19045668207068d5854108292cc045f35da1e9063b7a3d869c78d2d78a98cad034730b8f950c465223128acb30d754a2b84136926a3358484f8575beeb
|
data/lib/wtf_chord/chord.rb
CHANGED
@@ -16,8 +16,11 @@ module WTFChord
|
|
16
16
|
notes.each_cons(2).map { |(a, b)| (a.to_i - b.to_i).abs }
|
17
17
|
}
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
Sorting = -> (tone, notes) {
|
20
|
+
notes = notes.sort
|
21
|
+
mod = (notes[0].note.position - tone.position).abs.next
|
22
|
+
score = Distances[notes[1..-1]].sum
|
23
|
+
mod + score
|
21
24
|
}.curry(2).freeze
|
22
25
|
|
23
26
|
def collect!
|
@@ -28,7 +31,7 @@ module WTFChord
|
|
28
31
|
combination(size).
|
29
32
|
filter(&FilterProc[size])
|
30
33
|
@fingerings.uniq! { |x| x.map(&:key) }
|
31
|
-
@fingerings.sort_by!(&
|
34
|
+
@fingerings.sort_by!(&Sorting[tone])
|
32
35
|
@fingerings
|
33
36
|
end
|
34
37
|
end
|
data/lib/wtf_chord/version.rb
CHANGED