stave 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stave/core/note_collection.rb +12 -0
- data/lib/stave/theory/degree.rb +4 -0
- data/lib/stave/theory/note.rb +8 -0
- data/lib/stave/theory/scale.rb +6 -2
- data/lib/stave/theory/scale_type.rb +5 -5
- data/lib/stave/version.rb +1 -1
- 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: 0cf07a51299c29e08fc087a57c7956dfbef43c06ef913fdda11bdcbe67ef40ff
|
4
|
+
data.tar.gz: 353ec540396d0e6d0031c43ab3915684f79b532455ed74c979c485caeaca47f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0bb69f03b3aac8f5ddaadb4e305d3c27d90b8a2d85796a64032b8d45a75d3947d6987a13b6d423351a92ca689d3726d3fbfae5962904936095c88d477559311
|
7
|
+
data.tar.gz: 919b81b27591ff1b08de445a66b3860b3d73e79b2fb298935308fa5117c4d47c7fde511056d421e5076f1ab11e3db694e09afe361f2129023c5537dc3d40f910
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module Stave
|
2
2
|
module Core
|
3
3
|
class NoteCollection
|
4
|
+
extend Forwardable
|
5
|
+
|
6
|
+
def_delegators :type, :degrees
|
7
|
+
|
4
8
|
attr_reader :root, :type
|
5
9
|
|
6
10
|
def initialize(root:, type:)
|
@@ -20,6 +24,14 @@ module Stave
|
|
20
24
|
notes[position - 1]
|
21
25
|
end
|
22
26
|
|
27
|
+
def note_degree(note)
|
28
|
+
return unless notes.include?(note)
|
29
|
+
|
30
|
+
position = notes.index(note)
|
31
|
+
|
32
|
+
degrees[position]
|
33
|
+
end
|
34
|
+
|
23
35
|
def uniq
|
24
36
|
notes.uniq(&:variant)
|
25
37
|
end
|
data/lib/stave/theory/degree.rb
CHANGED
data/lib/stave/theory/note.rb
CHANGED
@@ -214,6 +214,10 @@ module Stave
|
|
214
214
|
note_above(interval.invert!)
|
215
215
|
end
|
216
216
|
|
217
|
+
def self.double_flats
|
218
|
+
where(accidental: Accidental.double_flat)
|
219
|
+
end
|
220
|
+
|
217
221
|
def self.flats
|
218
222
|
where(accidental: Accidental.flat)
|
219
223
|
end
|
@@ -226,6 +230,10 @@ module Stave
|
|
226
230
|
where(accidental: Accidental.sharp)
|
227
231
|
end
|
228
232
|
|
233
|
+
def self.double_sharps
|
234
|
+
where(accidental: Accidental.double_sharp)
|
235
|
+
end
|
236
|
+
|
229
237
|
def self.single_accidental
|
230
238
|
flats + naturals + sharps
|
231
239
|
end
|
data/lib/stave/theory/scale.rb
CHANGED
@@ -6,13 +6,13 @@ module Stave
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def triads
|
9
|
-
return unless type.
|
9
|
+
return unless type.heptatonic?
|
10
10
|
|
11
11
|
harmonise!(type.triad_types)
|
12
12
|
end
|
13
13
|
|
14
14
|
def sevenths
|
15
|
-
return unless type.
|
15
|
+
return unless type.heptatonic?
|
16
16
|
|
17
17
|
harmonise!(type.seventh_types)
|
18
18
|
end
|
@@ -26,6 +26,10 @@ module Stave
|
|
26
26
|
)
|
27
27
|
end
|
28
28
|
|
29
|
+
def symbol
|
30
|
+
"#{root.symbol} #{type.symbol}"
|
31
|
+
end
|
32
|
+
|
29
33
|
private
|
30
34
|
|
31
35
|
def harmonise!(chord_types)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Stave
|
2
2
|
module Theory
|
3
3
|
class ScaleType < Core::DegreeCollection
|
4
|
-
variant :major, degrees: [
|
4
|
+
variant :major, symbol: "major", degrees: [
|
5
5
|
Degree.root,
|
6
6
|
Degree.two,
|
7
7
|
Degree.three,
|
@@ -12,7 +12,7 @@ module Stave
|
|
12
12
|
Degree.octave
|
13
13
|
]
|
14
14
|
|
15
|
-
variant :minor, degrees: [
|
15
|
+
variant :minor, symbol: "minor", degrees: [
|
16
16
|
Degree.root,
|
17
17
|
Degree.two,
|
18
18
|
Degree.flat_three,
|
@@ -24,7 +24,7 @@ module Stave
|
|
24
24
|
]
|
25
25
|
|
26
26
|
with_options suffix: :pentatonic do
|
27
|
-
variant :major, degrees: [
|
27
|
+
variant :major, symbol: "major pentatonic", degrees: [
|
28
28
|
Degree.root,
|
29
29
|
Degree.two,
|
30
30
|
Degree.three,
|
@@ -33,7 +33,7 @@ module Stave
|
|
33
33
|
Degree.octave
|
34
34
|
]
|
35
35
|
|
36
|
-
variant :minor, degrees: [
|
36
|
+
variant :minor, symbol: "minor pentatonic", degrees: [
|
37
37
|
Degree.root,
|
38
38
|
Degree.flat_three,
|
39
39
|
Degree.four,
|
@@ -47,7 +47,7 @@ module Stave
|
|
47
47
|
count == 5
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def heptatonic?
|
51
51
|
count == 7
|
52
52
|
end
|
53
53
|
|
data/lib/stave/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Welham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|