musa-dsl 0.22.2 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/lib/musa-dsl.rb +14 -8
- data/lib/musa-dsl/core-ext/deep-copy.rb +12 -1
- data/lib/musa-dsl/core-ext/inspect-nice.rb +1 -2
- data/lib/musa-dsl/core-ext/smart-proc-binder.rb +13 -11
- data/lib/musa-dsl/datasets/p.rb +41 -16
- data/lib/musa-dsl/datasets/score/to-mxml/process-pdv.rb +14 -12
- data/lib/musa-dsl/datasets/score/to-mxml/process-ps.rb +32 -6
- data/lib/musa-dsl/datasets/score/to-mxml/to-mxml.rb +24 -10
- data/lib/musa-dsl/generative/backboner.rb +6 -11
- data/lib/musa-dsl/generative/generative-grammar.rb +1 -3
- data/lib/musa-dsl/generative/markov.rb +10 -6
- data/lib/musa-dsl/logger/logger.rb +6 -1
- data/lib/musa-dsl/matrix/matrix.rb +9 -7
- data/lib/musa-dsl/midi/midi-voices.rb +1 -0
- data/lib/musa-dsl/music/scales.rb +1 -1
- data/lib/musa-dsl/neumalang/neumalang.rb +1 -1
- data/lib/musa-dsl/neumas/array-to-neumas.rb +1 -1
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +9 -4
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +30 -129
- data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +10 -24
- data/lib/musa-dsl/sequencer/base-sequencer-tick-based.rb +9 -9
- data/lib/musa-dsl/sequencer/base-sequencer-tickless-based.rb +3 -5
- data/lib/musa-dsl/sequencer/{base-sequencer-public.rb → base-sequencer.rb} +15 -23
- data/lib/musa-dsl/sequencer/sequencer-dsl.rb +9 -7
- data/lib/musa-dsl/sequencer/sequencer.rb +8 -1
- data/lib/musa-dsl/series/base-series.rb +293 -144
- data/lib/musa-dsl/series/buffer-serie.rb +237 -0
- data/lib/musa-dsl/series/hash-or-array-serie-splitter.rb +139 -60
- data/lib/musa-dsl/series/main-serie-constructors.rb +254 -165
- data/lib/musa-dsl/series/main-serie-operations.rb +308 -303
- data/lib/musa-dsl/series/proxy-serie.rb +21 -41
- data/lib/musa-dsl/series/quantizer-serie.rb +44 -46
- data/lib/musa-dsl/series/queue-serie.rb +39 -43
- data/lib/musa-dsl/series/series-composer.rb +149 -0
- data/lib/musa-dsl/series/series.rb +6 -2
- data/lib/musa-dsl/series/timed-serie.rb +343 -0
- data/musa-dsl.gemspec +13 -3
- metadata +11 -11
- data/lib/musa-dsl/series/flattener-timed-serie.rb +0 -61
- data/lib/musa-dsl/series/holder-serie.rb +0 -87
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4a1fb5e2fc74d27266ed15f6edcc335c61b580f3c8fa83fd2c425066230a42b
|
4
|
+
data.tar.gz: 5778babbeeab02ea23d511369946990209929b284e0025f65a67602a1c8fa504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33c4b5ab4b14c941ed36ede8919961f0c9bc4d0ec6acf34f2b02f297483c17dfb2e23d270118143c7199f2e073cf001591ad393cae09cbc41e75ac20d8f82c7a
|
7
|
+
data.tar.gz: 4ffcea9a0a82bd7f97ef659ba0a3b03d9b319980df8987986ee0f63eb694d144fc03d0299b3a87665b78a52fafb5d9b840cf10e7461f36cbfe58b30ce4712f22
|
data/Gemfile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
gem 'logger', '~> 1.4', '>= 1.4.3'
|
4
|
+
|
3
5
|
group :neuma do
|
4
6
|
gem 'citrus', '~> 3.0.0'
|
5
7
|
end
|
@@ -10,8 +12,8 @@ group :transport do
|
|
10
12
|
end
|
11
13
|
|
12
14
|
group :test do
|
13
|
-
gem 'rspec', '~> 3.0'
|
14
15
|
gem 'descriptive-statistics'
|
16
|
+
gem 'rspec', '~> 3.0'
|
15
17
|
end
|
16
18
|
|
17
19
|
group :documentation do
|
data/lib/musa-dsl.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Musa
|
2
|
-
VERSION = '0.
|
2
|
+
VERSION = '0.23.0'
|
3
3
|
end
|
4
4
|
|
5
5
|
require_relative 'musa-dsl/core-ext'
|
@@ -27,21 +27,30 @@ require_relative 'musa-dsl/music'
|
|
27
27
|
require_relative 'musa-dsl/generative'
|
28
28
|
|
29
29
|
module Musa::All
|
30
|
+
# Core
|
31
|
+
#
|
30
32
|
include Musa::Logger
|
31
33
|
|
32
34
|
include Musa::Clock
|
33
35
|
include Musa::Transport
|
34
36
|
include Musa::Sequencer
|
35
37
|
|
36
|
-
include Musa::
|
37
|
-
include Musa::Chords
|
38
|
+
include Musa::Series
|
38
39
|
include Musa::Datasets
|
39
40
|
|
40
41
|
include Musa::Neumalang
|
41
42
|
include Musa::Neumas
|
42
|
-
include Musa::Matrix
|
43
43
|
|
44
|
-
include Musa::
|
44
|
+
include Musa::Transcription
|
45
|
+
|
46
|
+
include Musa::REPL
|
47
|
+
|
48
|
+
# Extensions: ojo, el nombre extensions ya se usa para algunos paquetes de core-ext que funcionan con Refinements
|
49
|
+
#
|
50
|
+
include Musa::Scales
|
51
|
+
include Musa::Chords
|
52
|
+
|
53
|
+
include Musa::Matrix
|
45
54
|
|
46
55
|
include Musa::Darwin
|
47
56
|
include Musa::Markov
|
@@ -53,8 +62,5 @@ module Musa::All
|
|
53
62
|
|
54
63
|
include Musa::MusicXML
|
55
64
|
|
56
|
-
include Musa::Transcription
|
57
65
|
include Musa::Transcriptors
|
58
|
-
|
59
|
-
include Musa::REPL
|
60
66
|
end
|
@@ -118,7 +118,18 @@ module Musa
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def deep_copy_proc(register, object, method, freeze)
|
121
|
-
|
121
|
+
if (receiver_dup = registered(object.binding.receiver, register))
|
122
|
+
register(register,
|
123
|
+
object,
|
124
|
+
proc do |*args, **kargs|
|
125
|
+
# when the receiver of the proc is also a duplicated object
|
126
|
+
# the new copy of the proc should be the new object, not the original one.
|
127
|
+
#
|
128
|
+
receiver_dup.instance_exec(object, *args, **kargs, &object)
|
129
|
+
end)
|
130
|
+
else
|
131
|
+
register(register, object, object.dup)
|
132
|
+
end
|
122
133
|
end
|
123
134
|
|
124
135
|
def deep_copy_instance_variables(register, object, duplication, method, freeze)
|
@@ -12,7 +12,6 @@ module Musa
|
|
12
12
|
alias to_s inspect
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
15
|
refine Rational.singleton_class do
|
17
16
|
attr_accessor :to_s_as_inspect
|
18
17
|
end
|
@@ -43,7 +42,7 @@ module Musa
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def to_s
|
46
|
-
inspect simple:
|
45
|
+
inspect simple: !Rational.to_s_as_inspect
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
@@ -2,8 +2,8 @@ module Musa
|
|
2
2
|
module Extension
|
3
3
|
module SmartProcBinder
|
4
4
|
class SmartProcBinder
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(block, on_rescue: nil)
|
6
|
+
@block = block
|
7
7
|
@on_rescue = on_rescue
|
8
8
|
|
9
9
|
@key_parameters = {}
|
@@ -12,7 +12,7 @@ module Musa
|
|
12
12
|
@value_parameters_count = 0
|
13
13
|
@has_value_rest = false
|
14
14
|
|
15
|
-
|
15
|
+
block.parameters.each do |parameter|
|
16
16
|
@key_parameters[parameter[1]] = nil if parameter[0] == :key || parameter[0] == :keyreq
|
17
17
|
@has_key_rest = true if parameter[0] == :keyrest
|
18
18
|
|
@@ -21,8 +21,12 @@ module Musa
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def proc
|
25
|
+
@block
|
26
|
+
end
|
27
|
+
|
24
28
|
def parameters
|
25
|
-
@
|
29
|
+
@block.parameters
|
26
30
|
end
|
27
31
|
|
28
32
|
def call(*value_parameters, **key_parameters)
|
@@ -41,26 +45,24 @@ module Musa
|
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
|
-
def __call(value_parameters, key_parameters)
|
48
|
+
private def __call(value_parameters, key_parameters)
|
45
49
|
effective_value_parameters, effective_key_parameters = apply(*value_parameters, **key_parameters)
|
46
50
|
|
47
51
|
if effective_key_parameters.empty?
|
48
52
|
if effective_value_parameters.empty?
|
49
|
-
@
|
53
|
+
@block.call
|
50
54
|
else
|
51
|
-
@
|
55
|
+
@block.call *effective_value_parameters
|
52
56
|
end
|
53
57
|
else
|
54
58
|
if effective_value_parameters.empty?
|
55
|
-
@
|
59
|
+
@block.call **effective_key_parameters
|
56
60
|
else
|
57
|
-
@
|
61
|
+
@block.call *effective_value_parameters, **effective_key_parameters
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
61
65
|
|
62
|
-
private :__call
|
63
|
-
|
64
66
|
def key?(key)
|
65
67
|
@has_key_rest || @key_parameters.include?(key)
|
66
68
|
end
|
data/lib/musa-dsl/datasets/p.rb
CHANGED
@@ -13,7 +13,7 @@ module Musa::Datasets
|
|
13
13
|
|
14
14
|
# TODO if instead of using clone (needed because of p.shift) we use index counter the P elements would be evaluated on the last moment
|
15
15
|
|
16
|
-
Musa::Series::E(clone, base_duration) do |p, base_duration|
|
16
|
+
Musa::Series::Constructors.E(clone, base_duration) do |p, base_duration|
|
17
17
|
(p.size >= 3) ?
|
18
18
|
{ from: p.shift,
|
19
19
|
duration: p.shift * base_duration,
|
@@ -22,24 +22,13 @@ module Musa::Datasets
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def to_timed_serie(time_start
|
25
|
+
def to_timed_serie(time_start: nil, time_start_component: nil, base_duration: nil)
|
26
26
|
time_start ||= 0r
|
27
|
-
|
28
|
-
|
29
|
-
# TODO if instead of using clone (needed because of p.shift) we use index counter the P elements would be evaluated on the last moment
|
27
|
+
time_start += self.first[time_start_component] if time_start_component
|
30
28
|
|
31
|
-
|
32
|
-
value = p.shift
|
33
|
-
|
34
|
-
if value
|
35
|
-
r = { time: context[:time], value: value } if !value.nil?
|
36
|
-
|
37
|
-
delta_time = p.shift
|
38
|
-
context[:time] += delta_time * base_duration if delta_time
|
29
|
+
base_duration ||= 1/4r # TODO review incoherence between neumalang 1/4r base duration for quarter notes and general 1r size of bar
|
39
30
|
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
31
|
+
PtoTimedSerie.new(self, base_duration, time_start)
|
43
32
|
end
|
44
33
|
|
45
34
|
def map(&block)
|
@@ -55,5 +44,41 @@ module Musa::Datasets
|
|
55
44
|
end
|
56
45
|
end
|
57
46
|
end
|
47
|
+
|
48
|
+
class PtoTimedSerie
|
49
|
+
include Musa::Series::Serie.base
|
50
|
+
|
51
|
+
def initialize(origin, base_duration, time_start)
|
52
|
+
@origin = origin
|
53
|
+
@base_duration = base_duration
|
54
|
+
@time_start = time_start
|
55
|
+
|
56
|
+
init
|
57
|
+
|
58
|
+
mark_as_prototype!
|
59
|
+
end
|
60
|
+
|
61
|
+
attr_accessor :origin
|
62
|
+
attr_accessor :base_duration
|
63
|
+
attr_accessor :time_start
|
64
|
+
|
65
|
+
private def _init
|
66
|
+
@index = 0
|
67
|
+
@time = @time_start
|
68
|
+
end
|
69
|
+
|
70
|
+
private def _next_value
|
71
|
+
if value = @origin[@index]
|
72
|
+
@index += 1
|
73
|
+
r = { time: @time, value: value }.extend(AbsTimed)
|
74
|
+
|
75
|
+
delta_time = @origin[@index]
|
76
|
+
@index += 1
|
77
|
+
@time += delta_time * @base_duration if delta_time
|
78
|
+
|
79
|
+
r
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
58
83
|
end
|
59
84
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'prime'
|
2
2
|
|
3
3
|
module Musa::Datasets::Score::ToMXML
|
4
|
-
|
4
|
+
using Musa::Extension::InspectNice
|
5
5
|
|
6
|
-
def process_pdv(measure, bar, divisions_per_bar, element, pointer, logger, do_log)
|
6
|
+
private def process_pdv(measure, bar, divisions_per_bar, element, pointer, logger, do_log)
|
7
7
|
|
8
8
|
pitch, octave, sharps = pitch_and_octave_and_sharps(element[:dataset])
|
9
9
|
|
@@ -21,24 +21,26 @@ module Musa::Datasets::Score::ToMXML
|
|
21
21
|
decompose_as_sum_of_simple_durations(effective_duration))
|
22
22
|
|
23
23
|
if do_log
|
24
|
-
logger.debug
|
25
|
-
logger.debug ""
|
26
|
-
logger.debug
|
27
|
-
logger.debug "
|
28
|
-
logger.debug "
|
24
|
+
logger.debug ''
|
25
|
+
logger.debug('process_pdv') { "processing #{element.inspect}" }
|
26
|
+
logger.debug { "" }
|
27
|
+
logger.debug { " pointer #{pointer.inspect} continue_from_previous #{continue_from_previous_bar} continue_to_next #{continue_to_next_bar}" }
|
28
|
+
logger.debug { " effective_start #{effective_start.inspect} effective_duration #{effective_duration.inspect}" }
|
29
|
+
logger.debug { " duration decomposition #{effective_duration_decomposition}" }
|
29
30
|
end
|
30
31
|
|
31
32
|
if pointer > effective_start
|
32
33
|
duration_to_go_back = (pointer - effective_start)
|
33
34
|
|
34
|
-
logger.debug
|
35
|
+
logger.debug ''
|
36
|
+
logger.debug { " -> adding backup #{duration_to_go_back * divisions_per_bar}" } if do_log
|
35
37
|
|
36
38
|
measure.add_backup(duration_to_go_back * divisions_per_bar)
|
37
39
|
pointer -= duration_to_go_back
|
38
40
|
|
39
41
|
|
40
42
|
elsif pointer < effective_start
|
41
|
-
warn "
|
43
|
+
logger.warn { " -> adding start rest duration #{effective_start - pointer} start #{bar + pointer} finish #{bar + effective_start}" } if do_log
|
42
44
|
|
43
45
|
pointer = process_pdv(measure, bar, divisions_per_bar,
|
44
46
|
{ start: bar + pointer,
|
@@ -125,7 +127,7 @@ module Musa::Datasets::Score::ToMXML
|
|
125
127
|
pointer
|
126
128
|
end
|
127
129
|
|
128
|
-
def pitch_and_octave_and_sharps(pdv)
|
130
|
+
private def pitch_and_octave_and_sharps(pdv)
|
129
131
|
if pdv[:pitch] == :silence
|
130
132
|
[:silence, nil, nil]
|
131
133
|
else
|
@@ -143,7 +145,7 @@ module Musa::Datasets::Score::ToMXML
|
|
143
145
|
end
|
144
146
|
end
|
145
147
|
|
146
|
-
def dynamics_index_of(midi_velocity)
|
148
|
+
private def dynamics_index_of(midi_velocity)
|
147
149
|
return nil unless midi_velocity
|
148
150
|
|
149
151
|
# ppp = midi 16 ... fff = midi 127
|
@@ -153,7 +155,7 @@ module Musa::Datasets::Score::ToMXML
|
|
153
155
|
.index { |r| r.cover? midi_velocity.round.to_i }
|
154
156
|
end
|
155
157
|
|
156
|
-
def dynamics_to_string(dynamics_index)
|
158
|
+
private def dynamics_to_string(dynamics_index)
|
157
159
|
return nil unless dynamics_index
|
158
160
|
['pppppp', 'ppppp', 'pppp', 'ppp', 'pp', 'p', 'mp', 'mf', 'f', 'ff', 'fff'][dynamics_index.round.to_i]
|
159
161
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
module Musa::Datasets::Score::ToMXML
|
2
|
-
|
2
|
+
using Musa::Extension::InspectNice
|
3
3
|
|
4
4
|
DynamicsContext = Struct.new(:last_dynamics)
|
5
5
|
private_constant :DynamicsContext
|
6
6
|
|
7
|
-
def process_ps(measure, element, context, logger, do_log)
|
7
|
+
private def process_ps(measure, element, context, logger, do_log)
|
8
8
|
context ||= DynamicsContext.new
|
9
9
|
|
10
|
-
logger.debug
|
10
|
+
logger.debug ''
|
11
|
+
logger.debug('process_ps') { "processing #{element.inspect}" } if do_log
|
11
12
|
|
12
13
|
case element[:dataset][:type]
|
13
14
|
when :crescendo, :diminuendo
|
@@ -15,7 +16,14 @@ module Musa::Datasets::Score::ToMXML
|
|
15
16
|
dynamics = dynamics_to_string(element[:dataset][:from])
|
16
17
|
|
17
18
|
if dynamics != context.last_dynamics
|
18
|
-
|
19
|
+
if dynamics
|
20
|
+
if element[:dataset][:from] < 0
|
21
|
+
logger.warn { "dynamics #{element[:dataset][:from]} not renderizable" } if do_log
|
22
|
+
elsif element[:dataset][:from] > 0
|
23
|
+
measure.add_dynamics dynamics, placement: 'below'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
19
27
|
context.last_dynamics = dynamics
|
20
28
|
end
|
21
29
|
|
@@ -29,7 +37,16 @@ module Musa::Datasets::Score::ToMXML
|
|
29
37
|
|
30
38
|
dynamics = dynamics_to_string(element[:dataset][:to])
|
31
39
|
|
32
|
-
|
40
|
+
if dynamics != context.last_dynamics
|
41
|
+
if dynamics
|
42
|
+
if element[:dataset][:to] < 0
|
43
|
+
logger.warn { "dynamics #{element[:dataset][:to]} not renderizable" } if do_log
|
44
|
+
elsif element[:dataset][:to] > 0
|
45
|
+
measure.add_dynamics dynamics, placement: 'below'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
33
50
|
context.last_dynamics = dynamics
|
34
51
|
end
|
35
52
|
|
@@ -37,7 +54,16 @@ module Musa::Datasets::Score::ToMXML
|
|
37
54
|
dynamics = dynamics_to_string(element[:dataset][:from])
|
38
55
|
|
39
56
|
if dynamics != context.last_dynamics
|
40
|
-
|
57
|
+
|
58
|
+
|
59
|
+
if dynamics
|
60
|
+
if element[:dataset][:from] < 0
|
61
|
+
logger.warn { "dynamics #{element[:dataset][:to]} not renderizable" } if do_log
|
62
|
+
elsif element[:dataset][:from] > 0
|
63
|
+
measure.add_dynamics dynamics, placement: 'below'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
41
67
|
context.last_dynamics = dynamics
|
42
68
|
end
|
43
69
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative '../../../logger'
|
2
2
|
require_relative '../../../musicxml'
|
3
|
+
require_relative '../../../core-ext/inspect-nice'
|
3
4
|
|
4
5
|
require_relative 'process-time'
|
5
6
|
require_relative 'process-pdv'
|
@@ -10,6 +11,8 @@ module Musa::Datasets; class Score
|
|
10
11
|
include Musa::MusicXML::Builder
|
11
12
|
include Musa::Datasets
|
12
13
|
|
14
|
+
using Musa::Extension::InspectNice
|
15
|
+
|
13
16
|
def to_mxml(beats_per_bar, ticks_per_beat,
|
14
17
|
bpm: nil,
|
15
18
|
title: nil,
|
@@ -22,7 +25,12 @@ module Musa::Datasets; class Score
|
|
22
25
|
bpm ||= 90
|
23
26
|
title ||= 'Untitled'
|
24
27
|
creators ||= { composer: 'Unknown' }
|
25
|
-
|
28
|
+
|
29
|
+
if logger.nil?
|
30
|
+
logger = Musa::Logger::Logger.new
|
31
|
+
logger.debug! if do_log
|
32
|
+
end
|
33
|
+
|
26
34
|
do_log ||= nil
|
27
35
|
|
28
36
|
mxml = ScorePartwise.new do |_|
|
@@ -54,12 +62,16 @@ module Musa::Datasets; class Score
|
|
54
62
|
end
|
55
63
|
|
56
64
|
if do_log
|
57
|
-
logger.debug
|
58
|
-
logger.debug
|
65
|
+
logger.debug ""
|
66
|
+
logger.debug"score.to_mxml log:"
|
67
|
+
logger.debug"------------------"
|
59
68
|
end
|
60
69
|
|
61
70
|
parts.each_key do |part_id|
|
62
|
-
fill_part mxml.parts[part_id],
|
71
|
+
fill_part mxml.parts[part_id],
|
72
|
+
beats_per_bar * ticks_per_beat,
|
73
|
+
(parts.size > 1 ? part_id : nil),
|
74
|
+
logger, do_log
|
63
75
|
end
|
64
76
|
|
65
77
|
mxml
|
@@ -74,7 +86,7 @@ module Musa::Datasets; class Score
|
|
74
86
|
(1..finish || 0).each do |bar|
|
75
87
|
if do_log
|
76
88
|
logger.debug ""
|
77
|
-
logger.debug msg = "filling part #{part.name} (#{instrument}): processing bar #{bar}"
|
89
|
+
logger.debug msg = "filling part #{part.name} (#{instrument || 'nil'}): processing bar #{bar}"
|
78
90
|
logger.debug "-" * msg.size
|
79
91
|
end
|
80
92
|
|
@@ -83,7 +95,7 @@ module Musa::Datasets; class Score
|
|
83
95
|
|
84
96
|
pointer = 0r
|
85
97
|
|
86
|
-
instrument_score = subset { |dataset| dataset[:instrument] == instrument }
|
98
|
+
instrument_score = subset { |dataset| instrument.nil? || dataset[:instrument] == instrument }
|
87
99
|
|
88
100
|
bar_elements = \
|
89
101
|
(instrument_score.changes_between(bar, bar + 1).select { |p| p[:dataset].is_a?(PS) } +
|
@@ -92,7 +104,7 @@ module Musa::Datasets; class Score
|
|
92
104
|
e[:dataset].is_a?(PS) ? 0 : 1 ] }
|
93
105
|
|
94
106
|
if pdvs.empty?
|
95
|
-
logger.debug "\
|
107
|
+
logger.debug "\nadding full bar silence..." if do_log
|
96
108
|
|
97
109
|
process_pdv(measure, bar, divisions_per_bar,
|
98
110
|
{ start: bar,
|
@@ -104,7 +116,7 @@ module Musa::Datasets; class Score
|
|
104
116
|
else
|
105
117
|
first = bar_elements.first
|
106
118
|
|
107
|
-
logger.debug "\nfirst element #{first}" if do_log
|
119
|
+
logger.debug "\nfirst element #{first.inspect}" if do_log
|
108
120
|
|
109
121
|
# TODO habrá que arreglar el cálculo de pointer cuando haya avances y retrocesos para que
|
110
122
|
# TODO no añada silencios incorrectos al principio o al final
|
@@ -113,7 +125,7 @@ module Musa::Datasets; class Score
|
|
113
125
|
|
114
126
|
silence_duration = first[:start_in_interval] - bar
|
115
127
|
|
116
|
-
logger.debug "\
|
128
|
+
logger.debug "\nadding initial silence for duration #{silence_duration}..." if do_log
|
117
129
|
|
118
130
|
pointer = process_pdv(measure, bar, divisions_per_bar,
|
119
131
|
{ start: bar,
|
@@ -124,6 +136,8 @@ module Musa::Datasets; class Score
|
|
124
136
|
do_log)
|
125
137
|
end
|
126
138
|
|
139
|
+
logger.debug "\nadding PDV and PS elements..." if do_log
|
140
|
+
|
127
141
|
bar_elements.each do |element|
|
128
142
|
case element[:dataset]
|
129
143
|
when PDV
|
@@ -140,7 +154,7 @@ module Musa::Datasets; class Score
|
|
140
154
|
if pointer < 1r
|
141
155
|
silence_duration = 1r - pointer
|
142
156
|
|
143
|
-
logger.debug "\nadded ending silence for duration #{silence_duration}" if do_log
|
157
|
+
logger.debug "\nadded ending silence for duration #{silence_duration}..." if do_log
|
144
158
|
|
145
159
|
process_pdv(measure, bar, divisions_per_bar,
|
146
160
|
{ start: bar + pointer,
|