musa-dsl 0.26.1 → 0.26.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/musa-dsl/datasets/gdv.rb +22 -8
- 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: f7f400c1a2c9841fc229ddb34343788eb688c4ab627e3f5ad8d4bcb57bd9ab90
|
4
|
+
data.tar.gz: f0a0bf769dc19d17fc54818f83ca92174b223a503fb1f5145b996ac743bc0a1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d35323bf0ef3686f839fcbdc4683fe3c7a05e9de99b4fab7a365f55576fd125704b52833bbea89bfae11db3c70d9d34a2fb2a2400252bd6fedf1d881483000ce
|
7
|
+
data.tar.gz: bf02e13897e2441ce2d48c82a0ac9d1a2ba25ba244a22597597232710fb18efd688c8f5228fa94ef8956f9fea9818725c251d122dfe05086d4e745e1c745538c
|
@@ -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
|
|
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 = '2021-11-
|
3
|
+
s.version = '0.26.2'
|
4
|
+
s.date = '2021-11-25'
|
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.2
|
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: 2021-11-
|
11
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logger
|