music-utils 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +22 -6
- data/README.md +9 -2
- data/lib/interval.rb +3 -1
- data/music-utils.gemspec +2 -2
- data/spec/interval_spec.rb +27 -5
- metadata +5 -5
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,33 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.5.1 (April 27, 2011)
|
2
2
|
|
3
3
|
Features:
|
4
4
|
|
5
|
-
-
|
6
|
-
|
5
|
+
- Fixed compound intervals quality error
|
6
|
+
|
7
|
+
|
8
|
+
## 0.5.0 (April 26, 2011)
|
9
|
+
|
10
|
+
Features:
|
11
|
+
|
12
|
+
- Added short notation method
|
13
|
+
|
14
|
+
|
15
|
+
## 0.4.0 (April 26, 2011)
|
16
|
+
|
17
|
+
Features:
|
18
|
+
|
19
|
+
- Added support for notes alterations
|
20
|
+
|
21
|
+
|
7
22
|
## 0.3.20 (April 26, 2011)
|
8
23
|
|
9
24
|
Features:
|
10
25
|
|
11
26
|
- Added support to full diatonic scale in quality method
|
12
|
-
|
13
|
-
|
27
|
+
|
28
|
+
|
29
|
+
## 0.0.1 (March 23, 2011)
|
14
30
|
|
15
31
|
Features:
|
16
32
|
|
17
|
-
-
|
33
|
+
- First commit
|
data/README.md
CHANGED
@@ -11,18 +11,25 @@ Simple intervals:
|
|
11
11
|
* Interval.new('do', 'mi', 0).semitone #=> 4 (semi-tones)
|
12
12
|
* Interval.new('do', 'mi', 0).quality #=> M (major)
|
13
13
|
* Interval.new('do#', 'mi', 0).quality #=> m (minor)
|
14
|
-
* Interval.new('do#', 'mi', 0).short #=> m3 (minor 3th)
|
15
14
|
|
16
15
|
Compound intervals:
|
17
16
|
|
18
17
|
* Interval.new('do', 'mi', 1).number #=> 10 (10th)
|
19
18
|
* Interval.new('do', 'mi', 1).semitone #=> 16 (semi-tones)
|
20
19
|
* Interval.new('do', 'mi', 1).quality #=> M (major)
|
20
|
+
* Interval.new('dob', 'mi#', 1).quality #=> AA (augmented plus)
|
21
|
+
|
22
|
+
Short Notation:
|
23
|
+
|
24
|
+
* Interval.new('do', 're', 0).short #=> M2
|
25
|
+
* Interval.new('do', 're', 1).short #=> M9
|
26
|
+
* Interval.new('do#', 'mi', 0).short #=> m3
|
27
|
+
* Interval.new('do#', 'mi', 1).short #=> m10
|
21
28
|
|
22
29
|
To Do
|
23
30
|
-----
|
24
31
|
* Add more rspec examples
|
25
|
-
*
|
32
|
+
* Add validations (notes, alterations, etc)
|
26
33
|
|
27
34
|
Copyright
|
28
35
|
---------
|
data/lib/interval.rb
CHANGED
@@ -93,7 +93,9 @@ class Interval
|
|
93
93
|
|
94
94
|
# Returns the quality of the interval
|
95
95
|
def quality
|
96
|
-
|
96
|
+
s = ( @step > 0 and semitone - (12 * @step) ) || semitone
|
97
|
+
n = ( @step > 0 and number - (7 * @step) ) || number
|
98
|
+
QUALITIES[n][s]
|
97
99
|
end
|
98
100
|
|
99
101
|
# Returns the class interval in the short notation
|
data/music-utils.gemspec
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
# Basic Info
|
4
4
|
s.name = 'music-utils'
|
5
|
-
s.version = '0.5.
|
5
|
+
s.version = '0.5.1'
|
6
6
|
s.summary = 'music-utils'
|
7
|
-
s.description = 'Utils for music'
|
7
|
+
s.description = 'Utils for music. At the moment only one class to classify intervals.'
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ['Jorge Luis Pérez']
|
10
10
|
s.email = ['jorgeluis700@gmail.com']
|
data/spec/interval_spec.rb
CHANGED
@@ -57,15 +57,26 @@ describe Interval do
|
|
57
57
|
i.quality.should == 'm'
|
58
58
|
end
|
59
59
|
|
60
|
-
it "quality of interval
|
61
|
-
i = Interval.new('
|
62
|
-
i.quality.should == '
|
60
|
+
it "quality of interval do#-mi should be m" do
|
61
|
+
i = Interval.new('do#', 'mi', 0)
|
62
|
+
i.quality.should == 'm'
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
it "quality of interval do-do should be P" do
|
66
66
|
i = Interval.new('do', 'do', 0)
|
67
67
|
i.quality.should == 'P'
|
68
68
|
end
|
69
|
+
|
70
|
+
it "quality of compound interval dob-mi# should be AA" do
|
71
|
+
i = Interval.new('dob', 'mi#', 1)
|
72
|
+
i.quality.should == 'AA'
|
73
|
+
end
|
74
|
+
|
75
|
+
it "quality of compound interval do-mi should be M" do
|
76
|
+
i = Interval.new('do', 'mi', 1)
|
77
|
+
i.quality.should == 'M'
|
78
|
+
end
|
79
|
+
|
69
80
|
end
|
70
81
|
|
71
82
|
context "Short Notation" do
|
@@ -74,10 +85,21 @@ describe Interval do
|
|
74
85
|
i.short.should == 'M2'
|
75
86
|
end
|
76
87
|
|
77
|
-
it "the short notation of do-re interval should be
|
88
|
+
it "the short notation of do-re compound interval should be M9" do
|
89
|
+
i = Interval.new('do', 're', 1)
|
90
|
+
i.short.should == 'M9'
|
91
|
+
end
|
92
|
+
|
93
|
+
it "the short notation of do#-mi interval should be m3" do
|
78
94
|
i = Interval.new('do#', 'mi', 0)
|
79
95
|
i.short.should == 'm3'
|
80
96
|
end
|
97
|
+
|
98
|
+
it "the short notation of do#-mi compound interval should be m10" do
|
99
|
+
i = Interval.new('do#', 'mi', 1)
|
100
|
+
i.short.should == 'm10'
|
101
|
+
end
|
102
|
+
|
81
103
|
end
|
82
104
|
end
|
83
105
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: music-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-04-27 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &23354172 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,8 +21,8 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
description: Utils for music
|
24
|
+
version_requirements: *23354172
|
25
|
+
description: Utils for music. At the moment only one class to classify intervals.
|
26
26
|
email:
|
27
27
|
- jorgeluis700@gmail.com
|
28
28
|
executables: []
|
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
54
|
version: '0'
|
55
55
|
segments:
|
56
56
|
- 0
|
57
|
-
hash:
|
57
|
+
hash: -794356655
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
59
|
none: false
|
60
60
|
requirements:
|