music_theory 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3c00902c9f5e41c431cbff53ee81bc518fcb32e
4
- data.tar.gz: ed04152234b50e11e169f55721d2f78af92bf141
3
+ metadata.gz: b63ead96b6711b0b9bca6a540d2546b36558405c
4
+ data.tar.gz: 4bbc82906a867e4d3fad79c73818323acbb6d553
5
5
  SHA512:
6
- metadata.gz: 3e363c3fdc8f3dcd033639164cfa0efbb2f5ee2754e783450cafee6559c43c44f760161ec8b4fe08d5019ef9ece27af8c64d18a6b309f9aa596331dd45b1bf74
7
- data.tar.gz: 3523354f9bf79915aa4b2c64b9f7dd71702efbb75018a6373574362cd638caef98d0e4ba709b05b74ba66975ff335c03e87b0f1766515c00a2a2907bc2de6e63
6
+ metadata.gz: 8d692ee0612257e939f392d14715644a89af698f52d2fb58b1fb498ba7c0f6c4bc301745a2b505f82aeb1dbf1aeb7b45c8cc6e7773aab33c1a21525ebfb80c97
7
+ data.tar.gz: 0f8be28c654a07054cdf58adcc9874d2557125ab1c392a3f6945d5538e04fe2642a563a1798dd254e7ce0645413596736f241d2fe83747f6c63cd48c7ebc6211
@@ -0,0 +1,25 @@
1
+ require 'music_theory/output'
2
+
3
+ module MusicTheory
4
+ class Arpeggio
5
+ include MusicTheory::Output
6
+
7
+ attr_accessor :third, :duration, :all_notes, :output_file_name
8
+
9
+ def initialize(third, options = {})
10
+ @duration = options[:duration] || 0.25
11
+ @third = third
12
+ @output_file_name = options[:output_file_name] || 'chord' # File name to write (without extension)
13
+ end
14
+
15
+ def arpeggionate
16
+ third.all_notes.each {|note| note.duration = duration}
17
+ third.all_notes + [third.all_notes[2], third.all_notes[1], third.all_notes[0], third.all_notes[1]]
18
+ end
19
+
20
+ def samples
21
+ arpeggionate.map(&:samples).flatten
22
+ end
23
+
24
+ end
25
+ end
@@ -55,6 +55,10 @@ module MusicTheory
55
55
  third ||= MusicTheory::Third.new self
56
56
  end
57
57
 
58
+ def arpeggio
59
+ arpeggio ||= third.arpeggio
60
+ end
61
+
58
62
  def chord
59
63
  third.chord
60
64
  end
@@ -26,9 +26,14 @@ module MusicTheory
26
26
  chord ||= MusicTheory::Chord.new self
27
27
  end
28
28
 
29
+ def arpeggio
30
+ arpeggio ||= MusicTheory::Arpeggio.new self
31
+ end
32
+
29
33
  def output_file_name
30
34
  scale.output_file_name || 'thirds'
31
35
  end
32
36
 
37
+
33
38
  end
34
39
  end
@@ -1,3 +1,3 @@
1
1
  module MusicTheory
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/music_theory.rb CHANGED
@@ -9,6 +9,7 @@ require "music_theory/scale_steps"
9
9
  require "music_theory/modes"
10
10
  require "music_theory/third"
11
11
  require "music_theory/chord"
12
+ require "music_theory/arpeggio"
12
13
  require "music_theory/harmonize"
13
14
  require "music_theory/output"
14
15
  require "music_theory/play"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: music_theory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
@@ -93,6 +93,7 @@ files:
93
93
  - README.md
94
94
  - Rakefile
95
95
  - lib/music_theory.rb
96
+ - lib/music_theory/arpeggio.rb
96
97
  - lib/music_theory/chord.rb
97
98
  - lib/music_theory/harmonize.rb
98
99
  - lib/music_theory/modes.rb