music_theory 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/lib/music_theory/octave.rb +4 -4
- data/lib/music_theory/scale.rb +1 -1
- data/lib/music_theory/scale_steps.rb +1 -2
- data/lib/music_theory/version.rb +1 -1
- data/samples/arpeggios.rb +0 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e22408edb41ccb659ba1fc6763a3cfb634dab4
|
4
|
+
data.tar.gz: 58d8619d48f27e1edbcfe65cbe684eea0da72a09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c990897d7be49af0b28c18316931fd233499bde935f12936448c5ac5017147e171d41e3afb223565e4955529e068a6cd0876e512722a2c7bb8f569da51338449
|
7
|
+
data.tar.gz: bd35d2b07a6b8acf3e2e4c1a138f46bdc784b03d06bf735675764f6bece46a0f550744de8af8156bd919f478a47aaf96fb573781b557999fce8a477549769990
|
data/lib/music_theory/octave.rb
CHANGED
@@ -6,10 +6,10 @@ module MusicTheory
|
|
6
6
|
attr_accessor :starting_note, :amount, :direction, :output_file_name, :all_notes
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
|
-
@starting_note = options[:starting_note] || MusicTheory::Note.new
|
10
|
-
@amount= options[:amount] || 2
|
11
|
-
@direction = options[:direction] || 'asc'
|
12
|
-
@output_file_name = options[:output_file_name] || 'octave'
|
9
|
+
@starting_note = options[:starting_note] || MusicTheory::Note.new # Note to start on
|
10
|
+
@amount = options[:amount] || 2 # Number of octaves to repeat
|
11
|
+
@direction = options[:direction] || 'asc' # Number of seconds per note
|
12
|
+
@output_file_name = options[:output_file_name] || 'octave' # File name to write (without extension)
|
13
13
|
build_octave
|
14
14
|
end
|
15
15
|
|
data/lib/music_theory/scale.rb
CHANGED
@@ -5,7 +5,7 @@ module MusicTheory
|
|
5
5
|
class Scale
|
6
6
|
include MusicTheory::Output
|
7
7
|
include MusicTheory::ScaleSteps
|
8
|
-
attr_accessor :starting_note, :
|
8
|
+
attr_accessor :starting_note, :output_file_name, :all_notes, :scale_type, :scale_notes, :distort, :duration, :frequency
|
9
9
|
|
10
10
|
def initialize(scale_type = :major, options = {})
|
11
11
|
@scale_type = scale_type
|
@@ -36,8 +36,7 @@ module MusicTheory
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def set_scale_step(jump)
|
39
|
-
|
40
|
-
new_chord_scale
|
39
|
+
MusicTheory::Scale.new scale_type, distort: distort, frequency: scale_notes[jump].frequency, duration: duration
|
41
40
|
end
|
42
41
|
|
43
42
|
end
|
data/lib/music_theory/version.rb
CHANGED
data/samples/arpeggios.rb
CHANGED
@@ -4,8 +4,6 @@ frequency = 293.665 # Middle D
|
|
4
4
|
scale = MusicTheory::Scale.new :major, distort: false, frequency: frequency, duration: 0.5
|
5
5
|
arpeggios = [scale.i.arpeggio, scale.iv.arpeggio, scale.v.arpeggio, scale.iv.arpeggio]
|
6
6
|
chords = [scale.i.chord, scale.iv.chord, scale.v.chord, scale.iv.chord]
|
7
|
-
|
8
7
|
harmony = MusicTheory::Harmonize.new arpeggios.map(&:samples).flatten, chords.map(&:samples).flatten
|
9
8
|
|
10
|
-
|
11
9
|
p = MusicTheory::Play.new arpeggios + [harmony] + [scale.i.chord]
|