musicality 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +8 -1
- data/bin/midify +3 -4
- data/examples/composition/auto_counterpoint.rb +53 -0
- data/examples/composition/part_generator.rb +51 -0
- data/examples/composition/scale_exercise.rb +41 -0
- data/examples/{hip.rb → notation/hip.rb} +1 -1
- data/examples/{missed_connection.rb → notation/missed_connection.rb} +1 -1
- data/examples/{song1.rb → notation/song1.rb} +1 -1
- data/examples/{song2.rb → notation/song2.rb} +1 -1
- data/lib/musicality.rb +34 -4
- data/lib/musicality/composition/generation/counterpoint_generator.rb +153 -0
- data/lib/musicality/composition/generation/random_rhythm_generator.rb +39 -0
- data/lib/musicality/composition/model/pitch_class.rb +33 -0
- data/lib/musicality/composition/model/pitch_classes.rb +22 -0
- data/lib/musicality/composition/model/scale.rb +34 -0
- data/lib/musicality/composition/model/scale_class.rb +37 -0
- data/lib/musicality/composition/model/scale_classes.rb +91 -0
- data/lib/musicality/composition/note_generation.rb +31 -0
- data/lib/musicality/composition/transposition.rb +8 -0
- data/lib/musicality/composition/util/adding_sequence.rb +24 -0
- data/lib/musicality/composition/util/biinfinite_sequence.rb +130 -0
- data/lib/musicality/composition/util/compound_sequence.rb +44 -0
- data/lib/musicality/composition/util/probabilities.rb +20 -0
- data/lib/musicality/composition/util/random_sampler.rb +26 -0
- data/lib/musicality/composition/util/repeating_sequence.rb +24 -0
- data/lib/musicality/errors.rb +2 -0
- data/lib/musicality/notation/conversion/score_conversion.rb +1 -1
- data/lib/musicality/notation/conversion/score_converter.rb +3 -3
- data/lib/musicality/notation/model/link.rb +26 -24
- data/lib/musicality/notation/model/links.rb +11 -0
- data/lib/musicality/notation/model/note.rb +14 -15
- data/lib/musicality/notation/model/part.rb +3 -3
- data/lib/musicality/notation/model/pitch.rb +8 -0
- data/lib/musicality/notation/model/score.rb +70 -44
- data/lib/musicality/notation/model/symbols.rb +22 -0
- data/lib/musicality/notation/packing/score_packing.rb +2 -3
- data/lib/musicality/notation/parsing/articulation_parsing.rb +4 -4
- data/lib/musicality/notation/parsing/articulation_parsing.treetop +2 -2
- data/lib/musicality/notation/parsing/link_nodes.rb +2 -14
- data/lib/musicality/notation/parsing/link_parsing.rb +9 -107
- data/lib/musicality/notation/parsing/link_parsing.treetop +4 -12
- data/lib/musicality/notation/parsing/note_node.rb +23 -21
- data/lib/musicality/notation/parsing/note_parsing.rb +70 -70
- data/lib/musicality/notation/parsing/note_parsing.treetop +6 -3
- data/lib/musicality/notation/parsing/pitch_node.rb +4 -2
- data/lib/musicality/performance/conversion/score_collator.rb +3 -3
- data/lib/musicality/performance/midi/midi_util.rb +13 -6
- data/lib/musicality/performance/midi/score_sequencing.rb +17 -0
- data/lib/musicality/printing/lilypond/errors.rb +5 -0
- data/lib/musicality/printing/lilypond/meter_engraving.rb +11 -0
- data/lib/musicality/printing/lilypond/note_engraving.rb +53 -0
- data/lib/musicality/printing/lilypond/part_engraver.rb +12 -0
- data/lib/musicality/printing/lilypond/pitch_engraving.rb +30 -0
- data/lib/musicality/printing/lilypond/score_engraver.rb +78 -0
- data/lib/musicality/version.rb +1 -1
- data/spec/composition/generation/random_rhythm_generator_spec.rb +50 -0
- data/spec/composition/model/pitch_class_spec.rb +75 -0
- data/spec/composition/model/pitch_classes_spec.rb +24 -0
- data/spec/composition/model/scale_class_spec.rb +98 -0
- data/spec/composition/model/scale_spec.rb +110 -0
- data/spec/composition/note_generation_spec.rb +113 -0
- data/spec/composition/transposition_spec.rb +17 -0
- data/spec/composition/util/adding_sequence_spec.rb +176 -0
- data/spec/composition/util/compound_sequence_spec.rb +50 -0
- data/spec/composition/util/probabilities_spec.rb +39 -0
- data/spec/composition/util/random_sampler_spec.rb +47 -0
- data/spec/composition/util/repeating_sequence_spec.rb +151 -0
- data/spec/notation/conversion/score_conversion_spec.rb +3 -3
- data/spec/notation/conversion/score_converter_spec.rb +24 -24
- data/spec/notation/model/link_spec.rb +27 -25
- data/spec/notation/model/note_spec.rb +9 -6
- data/spec/notation/model/pitch_spec.rb +24 -1
- data/spec/notation/model/score_spec.rb +57 -16
- data/spec/notation/packing/score_packing_spec.rb +134 -206
- data/spec/notation/parsing/articulation_parsing_spec.rb +1 -8
- data/spec/notation/parsing/convenience_methods_spec.rb +1 -1
- data/spec/notation/parsing/link_nodes_spec.rb +3 -4
- data/spec/notation/parsing/link_parsing_spec.rb +10 -4
- data/spec/notation/parsing/note_node_spec.rb +8 -7
- data/spec/notation/parsing/note_parsing_spec.rb +9 -12
- data/spec/performance/conversion/score_collator_spec.rb +14 -14
- data/spec/performance/midi/midi_util_spec.rb +26 -0
- data/spec/performance/midi/score_sequencer_spec.rb +1 -1
- metadata +57 -12
- data/lib/musicality/notation/model/program.rb +0 -53
- data/lib/musicality/notation/packing/program_packing.rb +0 -16
- data/spec/notation/model/program_spec.rb +0 -50
- data/spec/notation/packing/program_packing_spec.rb +0 -33
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
-
|
3
|
-
describe Program do
|
4
|
-
|
5
|
-
it "should assign the segments given during initialization" do
|
6
|
-
segments = [ 0.0...5.0, 0.0...4.0, 5.0...10.0 ]
|
7
|
-
program = Program.new segments
|
8
|
-
program.segments.should eq(segments.clone)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#include?" do
|
12
|
-
it "should return true for any offset which would be encountered" do
|
13
|
-
segments = [ 0.0...5.0, 0.0...4.0, 5.0...10.0 ]
|
14
|
-
program = Program.new segments
|
15
|
-
|
16
|
-
[0.0, 4.0, 5.0, 9.999].each do |offset|
|
17
|
-
program.include?(offset).should be true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return false for any offset which would not be encountered" do
|
22
|
-
segments = [ 0.0...5.0, 0.0...4.0, 5.0...10.0 ]
|
23
|
-
program = Program.new segments
|
24
|
-
|
25
|
-
[-0.000001, 10.000001].each do |offset|
|
26
|
-
program.include?(offset).should be false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#valid?' do
|
32
|
-
context 'increasing, positive segments' do
|
33
|
-
it 'should return true' do
|
34
|
-
Program.new([0..2,1..2,0..4]).should be_valid
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'decreasing, positive segments' do
|
39
|
-
it 'should return false' do
|
40
|
-
Program.new([2..0,2..1,04..0]).should be_invalid
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'increasing, negative segments' do
|
45
|
-
it 'should return false' do
|
46
|
-
Program.new([-1..2,-2..0,-2..2]).should be_invalid
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
-
|
3
|
-
describe Program do
|
4
|
-
before :all do
|
5
|
-
@p = Program.new([0...5,3.0...6.5,("1/2".to_r)...("3/2".to_r)])
|
6
|
-
@a = @p.pack
|
7
|
-
@p2 = Program.unpack(@a)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#pack' do
|
11
|
-
it 'should return an Array' do
|
12
|
-
@a.should be_a Array
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should return an array with same size as # of segments' do
|
16
|
-
@a.size.should eq @p.segments.size
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should return an array of strings' do
|
20
|
-
@a.each {|x| x.should be_a String }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#unpack' do
|
25
|
-
it 'should return a Program' do
|
26
|
-
@p2.should be_a Program
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should successfully unpack program segments' do
|
30
|
-
@p2.segments.should eq @p.segments
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|