music-utils 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/README.md +43 -11
- data/Rakefile +1 -1
- data/benchmark/music-utils_bm.rb +21 -7
- data/lib/music-utils/scales/scales.rb +2 -0
- data/lib/music-utils/version.rb +2 -2
- data/music-utils.gemspec +2 -2
- data/spec/music-utils_spec.rb +1 -1
- metadata +11 -10
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,35 +1,67 @@
|
|
1
1
|
music-utils
|
2
|
-
|
2
|
+
===========
|
3
|
+
|
4
|
+
Utils to clasify music intervals, create scales and more.
|
3
5
|
|
4
|
-
Utils for music. For now to classify music intervals and create scales.
|
5
6
|
|
6
7
|
Examples
|
7
8
|
--------
|
8
|
-
|
9
|
+
|
10
|
+
### Intervals
|
11
|
+
|
12
|
+
Simples:
|
9
13
|
|
10
|
-
MusicUtils.number(:do, :mi)
|
11
|
-
MusicUtils.semitones(:do, :mi
|
12
|
-
MusicUtils.quality(:do, :mi)
|
14
|
+
MusicUtils.number(:do, :mi) #=> 3 (3th)
|
15
|
+
MusicUtils.semitones(:do, :mi) #=> 4 (semi-tones)
|
16
|
+
MusicUtils.quality(:do, :mi) #=> M (major)
|
17
|
+
|
18
|
+
Compounds:
|
19
|
+
|
20
|
+
MusicUtils.number(:do, :mi, 1) #=> 3 (3th)
|
21
|
+
MusicUtils.semitones(:do, :mi, 1) #=> 16 (semi-tones)
|
22
|
+
MusicUtils.quality(:do, :mi, 1) #=> M (major)
|
13
23
|
|
14
24
|
Short Notation:
|
15
25
|
|
16
|
-
MusicUtils.short(:do, :
|
17
|
-
MusicUtils.short(:do, :
|
26
|
+
MusicUtils.short(:do, :mi) #=> M2
|
27
|
+
MusicUtils.short(:do, :mi, 1) #=> M9
|
28
|
+
|
29
|
+
### Scales
|
18
30
|
|
19
31
|
Create scales:
|
20
32
|
|
21
|
-
MusicUtils.scale(:fa, MusicUtils::MAJ_SCALE)
|
33
|
+
MusicUtils.scale(:fa, MusicUtils::MAJ_SCALE) #=> [:fa, :sol, :la, :sib, :do, :re, :mi]
|
22
34
|
|
23
35
|
|
24
36
|
Installation
|
25
37
|
-----------
|
26
38
|
|
27
39
|
gem install music-utils
|
40
|
+
|
41
|
+
|
42
|
+
Usage
|
43
|
+
-----
|
44
|
+
The `MusicUtils` module has constants to refer to common items like notes and scales.
|
45
|
+
|
46
|
+
require 'music-utils'
|
47
|
+
|
48
|
+
MusicUtils.short(MusicUtils::SOL, MusicUtils::DOF)
|
49
|
+
MusicUtils.scale(MusicUtils::SOL, MusicUtils::MAJ_SCALE)
|
50
|
+
|
51
|
+
|
52
|
+
Testing
|
53
|
+
-------
|
54
|
+
|
55
|
+
To run the tests:
|
56
|
+
|
57
|
+
$ rake
|
58
|
+
|
28
59
|
|
29
60
|
To Do
|
30
61
|
-----
|
31
|
-
|
32
|
-
|
62
|
+
|
63
|
+
* Add validations (notes, alterations, etc)
|
64
|
+
|
33
65
|
|
34
66
|
Copyright
|
35
67
|
---------
|
data/Rakefile
CHANGED
data/benchmark/music-utils_bm.rb
CHANGED
@@ -4,7 +4,9 @@ require 'music-utils'
|
|
4
4
|
require 'music-utils/scales/scales'
|
5
5
|
require 'benchmark'
|
6
6
|
|
7
|
-
|
7
|
+
include MusicUtils::Scales
|
8
|
+
|
9
|
+
n = (ARGV[0].to_i != 0) ? ARGV[0].to_i : 50000
|
8
10
|
label_width = 60
|
9
11
|
|
10
12
|
# Helper method to print benchmarks titles
|
@@ -18,22 +20,34 @@ end
|
|
18
20
|
title 'Classifying do-mi interval', n
|
19
21
|
Benchmark.bm(label_width) do |b|
|
20
22
|
b.report('with strings (number):') do
|
21
|
-
n.times { MusicUtils.number('do', '
|
23
|
+
n.times { MusicUtils.number('do', 'sol') }
|
22
24
|
end
|
23
25
|
b.report('with strings (quality):') do
|
24
|
-
n.times { MusicUtils.quality('do', '
|
26
|
+
n.times { MusicUtils.quality('do', 'sol') }
|
25
27
|
end
|
26
28
|
b.report('with strings (short notation):') do
|
27
|
-
n.times { MusicUtils.short('do', '
|
29
|
+
n.times { MusicUtils.short('do', 'sol') }
|
28
30
|
end
|
29
31
|
|
30
32
|
b.report('with scales (number):') do
|
31
|
-
n.times { MusicUtils.number(
|
33
|
+
n.times { MusicUtils.number(DO, SOL) }
|
32
34
|
end
|
33
35
|
b.report('with scales (quality):') do
|
34
|
-
n.times { MusicUtils.quality(
|
36
|
+
n.times { MusicUtils.quality(DO, SOL) }
|
35
37
|
end
|
36
38
|
b.report('with scales (short notation):') do
|
37
|
-
n.times { MusicUtils.short(
|
39
|
+
n.times { MusicUtils.short(DO, SOL) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
title 'Create scales', n
|
44
|
+
Benchmark.bm(label_width) do |b|
|
45
|
+
b.report('FA major scale: ') do
|
46
|
+
n.times { MusicUtils.scale(:fa, MusicUtils::MAJ_SCALE) }
|
47
|
+
end
|
48
|
+
b.report('SIb natural minor scale: ') do
|
49
|
+
n.times { MusicUtils.scale(:sif, MusicUtils::NATURAL_MIN_SCALE) }
|
38
50
|
end
|
39
51
|
end
|
52
|
+
|
53
|
+
|
data/lib/music-utils/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module MusicUtils
|
2
|
-
VERSION = '1.1.
|
3
|
-
end
|
2
|
+
VERSION = '1.1.1'
|
3
|
+
end
|
data/music-utils.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.authors = ["Jorge Luis Pérez"]
|
11
11
|
s.email = ["jorgeluis700@gmail.com"]
|
12
12
|
s.homepage = "http://github.com/jorgeluis700/music-utils"
|
13
|
-
s.summary = %q{Utils for music}
|
14
|
-
s.description = %q{Utils
|
13
|
+
s.summary = %q{Utils for common music tasks.}
|
14
|
+
s.description = %q{Utils to classify music intervals, create scales and more. See README.md and CHANGELOG.md on homepage for more info.}
|
15
15
|
s.license = %q{MIT}
|
16
16
|
|
17
17
|
# Files
|
data/spec/music-utils_spec.rb
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-05-
|
12
|
+
date: 2011-05-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &74447040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.8'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *74447040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &74446850 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *74446850
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &74446620 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,8 +43,9 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
description: Utils
|
46
|
+
version_requirements: *74446620
|
47
|
+
description: Utils to classify music intervals, create scales and more. See README.md
|
48
|
+
and CHANGELOG.md on homepage for more info.
|
48
49
|
email:
|
49
50
|
- jorgeluis700@gmail.com
|
50
51
|
executables: []
|
@@ -90,5 +91,5 @@ rubyforge_project:
|
|
90
91
|
rubygems_version: 1.7.2
|
91
92
|
signing_key:
|
92
93
|
specification_version: 3
|
93
|
-
summary: Utils for music
|
94
|
+
summary: Utils for common music tasks.
|
94
95
|
test_files: []
|