musa-dsl 0.26.0 → 0.26.4
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/musa-dsl/datasets/gdv.rb +22 -8
- data/lib/musa-dsl/midi/midi-voices.rb +20 -1
- data/lib/musa-dsl/repl/repl.rb +6 -5
- data/lib/musa-dsl.rb +1 -1
- data/musa-dsl.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0631b9bf8dbc0fedbfe7c00bdc5c4da34c3b319ade3de83fa49d08f7b95ea9b0
|
4
|
+
data.tar.gz: 1c258db1cd5105a794e9cbfec73e12fc8e6ec3565395d25c234ec3ac0aed5d28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86068de4a4b03eb6615438863fe62302b8d4c899058bf1faba5d2aef00608b91bb61b0a54775736ecf99b7ad91a9b765085f68201daeba537df042634f806c97
|
7
|
+
data.tar.gz: bd321b8c0d140557fd2a747f5e1d8ecdf9335e6865abfc4d1cce2182e6493dd4e8983f0cdc208beefd91f098f589ff566afa33dcb534e7549d1a1e11609b0e8e
|
@@ -16,16 +16,20 @@ module Musa::Datasets
|
|
16
16
|
|
17
17
|
attr_accessor :base_duration
|
18
18
|
|
19
|
+
# TODO create a customizable MIDI velocity to score dynamics bidirectional conversor
|
20
|
+
# ppp = 16 ... fff = 127 (-5 ... 4) the standard used by Musescore 3 and others starts at ppp = 16
|
21
|
+
VELOCITY_MAP = [1, 8, 16, 33, 49, 64, 80, 96, 112, 127].freeze
|
22
|
+
|
19
23
|
def to_pdv(scale)
|
20
24
|
pdv = {}.extend PDV
|
21
25
|
pdv.base_duration = @base_duration
|
22
26
|
|
23
27
|
if self[:grade]
|
24
28
|
pdv[:pitch] = if self[:silence]
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
:silence
|
30
|
+
else
|
31
|
+
scale[self[:grade]].sharp(self[:sharps] || 0).octave(self[:octave] || 0).pitch
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
if self[:duration]
|
@@ -41,9 +45,19 @@ module Musa::Datasets
|
|
41
45
|
end
|
42
46
|
|
43
47
|
if self[:velocity]
|
44
|
-
|
45
|
-
|
46
|
-
|
48
|
+
index = if (-5..4).cover?(self[:velocity])
|
49
|
+
self[:velocity]
|
50
|
+
else
|
51
|
+
self[:velocity] < -5 ? -5 : 4
|
52
|
+
end
|
53
|
+
|
54
|
+
index_min = index.floor
|
55
|
+
index_max = index.ceil
|
56
|
+
|
57
|
+
velocity = VELOCITY_MAP[index_min + 5] +
|
58
|
+
(VELOCITY_MAP[index_max + 5] - VELOCITY_MAP[index_min + 5]) * (self[:velocity] - index_min)
|
59
|
+
|
60
|
+
pdv[:velocity] = velocity
|
47
61
|
end
|
48
62
|
|
49
63
|
(keys - NaturalKeys).each { |k| pdv[k] = self[k] }
|
@@ -52,7 +66,7 @@ module Musa::Datasets
|
|
52
66
|
end
|
53
67
|
|
54
68
|
def to_neuma
|
55
|
-
@base_duration ||= Rational(1,4)
|
69
|
+
@base_duration ||= Rational(1, 4)
|
56
70
|
|
57
71
|
attributes = []
|
58
72
|
|
@@ -138,7 +138,26 @@ module Musa
|
|
138
138
|
@output = output
|
139
139
|
@channel = channel
|
140
140
|
|
141
|
-
@controller_map = {
|
141
|
+
@controller_map = { mod_wheel: 1,
|
142
|
+
breath: 2,
|
143
|
+
volume: 7,
|
144
|
+
expression: 11,
|
145
|
+
general_purpose_1: 16,
|
146
|
+
general_purpose_2: 17,
|
147
|
+
general_purpose_3: 18,
|
148
|
+
general_purpose_4: 19,
|
149
|
+
|
150
|
+
mod_wheel_lsb: 1 + 32,
|
151
|
+
breath_lsb: 2 + 32,
|
152
|
+
volume_lsb: 7 + 32,
|
153
|
+
expression_lsb: 11 + 32,
|
154
|
+
general_purpose_1_lsb: 16 + 32,
|
155
|
+
general_purpose_2_lsb: 17 + 32,
|
156
|
+
general_purpose_3_lsb: 18 + 32,
|
157
|
+
general_purpose_4_lsb: 19 + 32,
|
158
|
+
|
159
|
+
sustain_pedal: 64,
|
160
|
+
portamento: 65 }
|
142
161
|
@controller = []
|
143
162
|
end
|
144
163
|
|
data/lib/musa-dsl/repl/repl.rb
CHANGED
@@ -6,13 +6,14 @@ module Musa
|
|
6
6
|
class REPL
|
7
7
|
@@repl_mutex = Mutex.new
|
8
8
|
|
9
|
-
def initialize(binder = nil, port: nil, after_eval: nil, logger: nil)
|
9
|
+
def initialize(binder = nil, port: nil, after_eval: nil, logger: nil, highlight_exception: true)
|
10
10
|
|
11
11
|
self.binder = binder
|
12
12
|
|
13
13
|
port ||= 1327
|
14
14
|
|
15
15
|
@logger = logger || Musa::Logger::Logger.new
|
16
|
+
@highlight_exception = highlight_exception
|
16
17
|
|
17
18
|
@block_source = nil
|
18
19
|
|
@@ -52,7 +53,7 @@ module Musa
|
|
52
53
|
|
53
54
|
rescue StandardError, ScriptError => e
|
54
55
|
@logger.warn('REPL') { 'code execution error' }
|
55
|
-
@logger.warn('REPL') { e.full_message(highlight:
|
56
|
+
@logger.warn('REPL') { e.full_message(highlight: @highlight_exception, order: :top) }
|
56
57
|
|
57
58
|
send_exception e, output: @connection
|
58
59
|
else
|
@@ -66,7 +67,7 @@ module Musa
|
|
66
67
|
|
67
68
|
rescue IOError, Errno::ECONNRESET, Errno::EPIPE => e
|
68
69
|
@logger.warn('REPL') { 'lost connection' }
|
69
|
-
@logger.warn('REPL') { e.full_message(highlight:
|
70
|
+
@logger.warn('REPL') { e.full_message(highlight: @highlight_exception, order: :top) }
|
70
71
|
|
71
72
|
ensure
|
72
73
|
@logger.debug("REPL") { "closing connection (running #{@run})" }
|
@@ -77,7 +78,7 @@ module Musa
|
|
77
78
|
end
|
78
79
|
rescue Errno::ECONNRESET, Errno::EPIPE => e
|
79
80
|
@logger.warn('REPL') { 'connection failure while getting server port; will retry...' }
|
80
|
-
@logger.warn('REPL') { e.full_message(highlight:
|
81
|
+
@logger.warn('REPL') { e.full_message(highlight: @highlight_exception, order: :top) }
|
81
82
|
retry
|
82
83
|
|
83
84
|
end
|
@@ -130,7 +131,7 @@ module Musa
|
|
130
131
|
|
131
132
|
def send_exception(e, output:)
|
132
133
|
|
133
|
-
@logger.error('REPL') { e.full_message(highlight:
|
134
|
+
@logger.error('REPL') { e.full_message(highlight: @highlight_exception, order: :top) }
|
134
135
|
|
135
136
|
send output: output, command: '//error'
|
136
137
|
|
data/lib/musa-dsl.rb
CHANGED
data/musa-dsl.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'musa-dsl'
|
3
|
-
s.version = '0.26.
|
4
|
-
s.date = '
|
3
|
+
s.version = '0.26.4'
|
4
|
+
s.date = '2022-02-17'
|
5
5
|
s.summary = 'A simple Ruby DSL for making complex music'
|
6
6
|
s.description = 'Musa-DSL: A Ruby framework and DSL for algorithmic sound and musical thinking and composition'
|
7
7
|
s.authors = ['Javier Sánchez Yeste']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: musa-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Sánchez Yeste
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logger
|