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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## 1.1.1 (May 20, 2011)
2
+
3
+ Features:
4
+
5
+ - Minor implementation improvements
6
+
7
+
1
8
  ## 1.1.0 (May 19, 2011)
2
9
 
3
10
  Features:
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
- Simple and Compound intervals:
9
+
10
+ ### Intervals
11
+
12
+ Simples:
9
13
 
10
- MusicUtils.number(:do, :mi) #=> 3 (3th)
11
- MusicUtils.semitones(:do, :mi, 1) #=> 16 (semi-tones)
12
- MusicUtils.quality(:do, :mi) #=> M (major)
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, :re) #=> M2
17
- MusicUtils.short(:do, :re, 1) #=> M9
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) #=> [:fa, :sol, :la, :sib, :do, :re, :mi]
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
- * Add more rspec examples
32
- * Add validations (notes, alterations, etc)
62
+
63
+ * Add validations (notes, alterations, etc)
64
+
33
65
 
34
66
  Copyright
35
67
  ---------
data/Rakefile CHANGED
@@ -31,5 +31,5 @@ end
31
31
  # Profiler tasks
32
32
  desc "Run profiler"
33
33
  task :profile do
34
- `ruby -w -rprofile benchmark/music-utils_bm.rb 10000`
34
+ `ruby -w -rprofile benchmark/music-utils_bm.rb 1000`
35
35
  end
@@ -4,7 +4,9 @@ require 'music-utils'
4
4
  require 'music-utils/scales/scales'
5
5
  require 'benchmark'
6
6
 
7
- n = (ARGV[0].to_i != 0) ? ARGV[0].to_i : 100000
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', 'mi') }
23
+ n.times { MusicUtils.number('do', 'sol') }
22
24
  end
23
25
  b.report('with strings (quality):') do
24
- n.times { MusicUtils.quality('do', 'mi') }
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', 'mi') }
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(Scales::DO, Scales::MI) }
33
+ n.times { MusicUtils.number(DO, SOL) }
32
34
  end
33
35
  b.report('with scales (quality):') do
34
- n.times { MusicUtils.quality(Scales::DO, Scales::MI) }
36
+ n.times { MusicUtils.quality(DO, SOL) }
35
37
  end
36
38
  b.report('with scales (short notation):') do
37
- n.times { MusicUtils.short(Scales::DO, Scales::MI) }
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
+
@@ -1,5 +1,6 @@
1
1
  require 'music-utils/note/note'
2
2
 
3
+ module MusicUtils
3
4
  # Scales module
4
5
  module Scales
5
6
 
@@ -148,3 +149,4 @@ module Scales
148
149
  end
149
150
 
150
151
  end
152
+ end
@@ -1,3 +1,3 @@
1
1
  module MusicUtils
2
- VERSION = '1.1.0'
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 for music. At the moment only to classify intervals.}
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
@@ -1,7 +1,7 @@
1
1
  require 'music-utils'
2
2
 
3
3
  describe MusicUtils do
4
- include Scales
4
+ include MusicUtils::Scales
5
5
 
6
6
  context "Intervals" do
7
7
 
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.0
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-19 00:00:00.000000000Z
12
+ date: 2011-05-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &75690210 !ruby/object:Gem::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: *75690210
24
+ version_requirements: *74447040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &75690020 !ruby/object:Gem::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: *75690020
35
+ version_requirements: *74446850
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &75689790 !ruby/object:Gem::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: *75689790
47
- description: Utils for music. At the moment only to classify intervals.
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: []