shlisp_tools 0.0.3 → 0.0.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.
- data/.gitignore +2 -0
- data/README.md +24 -18
- data/bin/shlerb +2 -2
- data/examples/hexanies.txt.erb +147 -45
- data/examples/metaslendro.txt.erb +12 -12
- data/lib/shlisp_tools/ratio.rb +15 -0
- data/lib/shlisp_tools/scale.rb +5 -1
- data/lib/shlisp_tools/scales.rb +14 -41
- data/lib/shlisp_tools/shnth.rb +41 -20
- data/lib/shlisp_tools/version.rb +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -37,7 +37,7 @@ And then execute:
|
|
37
37
|
|
38
38
|
$ bundle
|
39
39
|
|
40
|
-
Or install it
|
40
|
+
Or install it manually:
|
41
41
|
|
42
42
|
$ gem install shlisp_tools
|
43
43
|
|
@@ -62,7 +62,7 @@ Here's an example of a shlerb file with a single situation. It plays a six-note
|
|
62
62
|
Slew_add = 5
|
63
63
|
Modo_mul = 2
|
64
64
|
%>
|
65
|
-
<% s1 = Scales::MetaSlendro_1.mul(120) %>
|
65
|
+
<% s1 = Scales::MetaSlendro_1.mul(120) %>
|
66
66
|
{
|
67
67
|
<%= Shnth::Situation_1 %>
|
68
68
|
|
@@ -73,18 +73,18 @@ Here's an example of a shlerb file with a single situation. It plays a six-note
|
|
73
73
|
|
74
74
|
(pan
|
75
75
|
(add
|
76
|
-
(modo (horna <%= s1[Shnth::
|
77
|
-
(modo (hornc <%= s1[Shnth::
|
78
|
-
(modo (horne <%= s1[Shnth::
|
76
|
+
(modo (horna <%= s1[Shnth::But_A].n %> <%= s1[Shnth::But_A].d %> (slewa (majora) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
77
|
+
(modo (hornc <%= s1[Shnth::But_C].n %> <%= s1[Shnth::But_C].d %> (slewc (majorc) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
78
|
+
(modo (horne <%= s1[Shnth::But_d].n %> <%= s1[Shnth::But_d].d %> (slewe (minord) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
79
79
|
)
|
80
80
|
144
|
81
81
|
)
|
82
82
|
|
83
83
|
(pan
|
84
84
|
(add
|
85
|
-
(modo (hornb <%= s1[Shnth::
|
86
|
-
(modo (hornd <%= s1[Shnth::
|
87
|
-
(modo (hornf <%= s1[Shnth::
|
85
|
+
(modo (hornb <%= s1[Shnth::But_B].n %> <%= s1[Shnth::But_B].d %> (slewb (majorb) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
86
|
+
(modo (hornd <%= s1[Shnth::But_D].n %> <%= s1[Shnth::But_D].d %> (slewd (majord) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
87
|
+
(modo (hornf <%= s1[Shnth::But_c].n %> <%= s1[Shnth::But_c].d %> (slewf (minorc) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
88
88
|
)
|
89
89
|
80
|
90
90
|
)
|
@@ -101,14 +101,7 @@ You can also define your own scales and add a scaling factor to bring them into
|
|
101
101
|
R = ShlispTools::Ratio
|
102
102
|
|
103
103
|
# define scale with 1/1 = 100 100
|
104
|
-
myMetaSlendro = S::Scale.new([
|
105
|
-
R::Ratio.new( 1, 1),
|
106
|
-
R::Ratio.new(37, 32),
|
107
|
-
R::Ratio.new(21, 16),
|
108
|
-
R::Ratio.new(49, 32),
|
109
|
-
R::Ratio.new( 7, 4),
|
110
|
-
R::Ratio.new( 2, 1)
|
111
|
-
]).mul(100)
|
104
|
+
myMetaSlendro = S::Scale.new(%w[ 1/1 37/32 21/16 49/32 7/4 2/1 ]).mul(100)
|
112
105
|
|
113
106
|
# get nume and deno for a given scale degree, using indexes 0 through 5 for a six-note scale
|
114
107
|
# 1/1:
|
@@ -119,13 +112,13 @@ You can also define your own scales and add a scaling factor to bring them into
|
|
119
112
|
# myMetaSlendro[1].nume
|
120
113
|
# myMetaSlendro[1].deno
|
121
114
|
#
|
122
|
-
# ...
|
115
|
+
# ...
|
123
116
|
|
124
117
|
%>
|
125
118
|
|
126
119
|
## Shtool
|
127
120
|
|
128
|
-
Shtool is a command-line program that collects together a few useful calculations.
|
121
|
+
Shtool is a command-line program that collects together a few useful calculations.
|
129
122
|
|
130
123
|
### Usage
|
131
124
|
|
@@ -137,6 +130,19 @@ Use <tt>shtool help</tt> for a list of the current set of operations and what th
|
|
137
130
|
|
138
131
|
* Ratio, Scale, and the Scales collection all assume "arab" mode.
|
139
132
|
|
133
|
+
## Version History
|
134
|
+
|
135
|
+
### 0.0.1 through 0.0.3
|
136
|
+
|
137
|
+
- details lost in the mists of time
|
138
|
+
|
139
|
+
### 0.0.4
|
140
|
+
|
141
|
+
- shlerb: don't generate extra lines in output
|
142
|
+
- Scales may now be written out as a list of ratios (e.g. "7/4"), which is hopefully a lot more intuitive as well as more succinct. The ratios must be inside "%w[]" delimiters and separated by spaces or tabs (see example above). All predefined scales are now written in this format.
|
143
|
+
- Shnth module: fixed Light_* macros to work properly; rename Bar_* to But_* because they are for buttons and not for bars (d'oh!); add "situ" which I am too lazy to document at the moment.
|
144
|
+
- Examples: various changes.
|
145
|
+
|
140
146
|
## TODO
|
141
147
|
|
142
148
|
- write tests
|
data/bin/shlerb
CHANGED
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
class Shlerb #:nodoc: all
|
16
16
|
TEMP_FILE = "_shlerb_temp"
|
17
|
-
|
17
|
+
|
18
18
|
def self.perform(infile)
|
19
19
|
template_file = File.open(infile, 'r').read
|
20
20
|
out = nil
|
@@ -38,7 +38,7 @@ class Shlerb #:nodoc: all
|
|
38
38
|
|
39
39
|
private
|
40
40
|
def self.herb(tmpl)
|
41
|
-
ERB.new(tmpl, nil
|
41
|
+
ERB.new(tmpl, nil).result(binding)
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
data/examples/hexanies.txt.erb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
# global settings
|
3
|
+
Slew_upp = 3
|
4
|
+
Slew_donn = 2
|
5
|
+
|
5
6
|
%>
|
7
|
+
|
6
8
|
<% s = Scales::Hexany1357.mul(127) %>
|
9
|
+
; <%= s.canonical %>
|
7
10
|
{
|
8
|
-
<%= Shnth::
|
11
|
+
<%= Shnth::situ(1) %>
|
9
12
|
|
10
13
|
; 60Hz-ish
|
11
14
|
(srate (short 36 79))
|
@@ -14,20 +17,20 @@
|
|
14
17
|
|
15
18
|
(pan
|
16
19
|
(add
|
17
|
-
(
|
18
|
-
(
|
19
|
-
(
|
20
|
-
(
|
20
|
+
(horna <%= s[Shnth::But_A].n %> <%= s[Shnth::But_A].d %> (slewa (majora) <%= Slew_upp %> <%= Slew_donn %>))
|
21
|
+
(hornc <%= s[Shnth::But_C].n %> <%= s[Shnth::But_C].d %> (slewc (majorc) <%= Slew_upp %> <%= Slew_donn %>))
|
22
|
+
(horne <%= s[Shnth::But_d].n %> <%= s[Shnth::But_d].d %> (slewe (minord) <%= Slew_upp %> <%= Slew_donn %>))
|
23
|
+
(horng <%= s[Shnth::But_b].n %> <%= s[Shnth::But_b].d %> (slewg (minorb) <%= Slew_upp %> <%= Slew_donn %>))
|
21
24
|
)
|
22
25
|
80
|
23
26
|
)
|
24
27
|
|
25
28
|
(pan
|
26
29
|
(add
|
27
|
-
(
|
28
|
-
(
|
29
|
-
(
|
30
|
-
(
|
30
|
+
(hornb <%= s[Shnth::But_B].n %> <%= s[Shnth::But_B].d %> (slewb (majorb) <%= Slew_upp %> <%= Slew_donn %>))
|
31
|
+
(hornd <%= s[Shnth::But_D].n %> <%= s[Shnth::But_D].d %> (slewd (majord) <%= Slew_upp %> <%= Slew_donn %>))
|
32
|
+
(hornf <%= s[Shnth::But_c].n %> <%= s[Shnth::But_c].d %> (slewf (minorc) <%= Slew_upp %> <%= Slew_donn %>))
|
33
|
+
(hornh <%= s[Shnth::But_a].n %> <%= s[Shnth::But_a].d %> (slewh (minora) <%= Slew_upp %> <%= Slew_donn %>))
|
31
34
|
)
|
32
35
|
144
|
33
36
|
)
|
@@ -35,69 +38,168 @@
|
|
35
38
|
)
|
36
39
|
}
|
37
40
|
|
41
|
+
<% s = Scales::Tenney_8.mul(127) %>
|
42
|
+
; <%= s.canonical %>
|
38
43
|
{
|
39
|
-
<%= Shnth::
|
44
|
+
<%= Shnth::situ(2) %>
|
40
45
|
|
41
46
|
; 60Hz-ish
|
42
|
-
(srate (short
|
47
|
+
(srate (short 36 79))
|
43
48
|
|
44
49
|
(arab
|
45
50
|
|
46
|
-
(corpb 60 60)
|
47
|
-
|
48
51
|
(pan
|
49
|
-
(
|
50
|
-
(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
(modo (sawg <%= s[Shnth::Bar_b].n %> <%= s[Shnth::Bar_b].d %> (slewg (minorb) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
55
|
-
)
|
56
|
-
120 (corpb) 100
|
52
|
+
(add
|
53
|
+
(horna <%= s[Shnth::But_A].n %> <%= s[Shnth::But_A].d %> (slewa (majora) <%= Slew_upp %> <%= Slew_donn %>))
|
54
|
+
(hornc <%= s[Shnth::But_C].n %> <%= s[Shnth::But_C].d %> (slewc (majorc) <%= Slew_upp %> <%= Slew_donn %>))
|
55
|
+
(horne <%= s[Shnth::But_d].n %> <%= s[Shnth::But_d].d %> (slewe (minord) <%= Slew_upp %> <%= Slew_donn %>))
|
56
|
+
(horng <%= s[Shnth::But_b].n %> <%= s[Shnth::But_b].d %> (slewg (minorb) <%= Slew_upp %> <%= Slew_donn %>))
|
57
57
|
)
|
58
58
|
80
|
59
59
|
)
|
60
60
|
|
61
61
|
(pan
|
62
|
-
(
|
63
|
-
(
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
(modo (sawh <%= s[Shnth::Bar_a].n %> <%= s[Shnth::Bar_a].d %> (slewh (minora) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
68
|
-
)
|
69
|
-
120 (corpb) 100
|
62
|
+
(add
|
63
|
+
(hornb <%= s[Shnth::But_B].n %> <%= s[Shnth::But_B].d %> (slewb (majorb) <%= Slew_upp %> <%= Slew_donn %>))
|
64
|
+
(hornd <%= s[Shnth::But_D].n %> <%= s[Shnth::But_D].d %> (slewd (majord) <%= Slew_upp %> <%= Slew_donn %>))
|
65
|
+
(hornf <%= s[Shnth::But_c].n %> <%= s[Shnth::But_c].d %> (slewf (minorc) <%= Slew_upp %> <%= Slew_donn %>))
|
66
|
+
(hornh <%= s[Shnth::But_a].n %> <%= s[Shnth::But_a].d %> (slewh (minora) <%= Slew_upp %> <%= Slew_donn %>))
|
70
67
|
)
|
71
68
|
144
|
72
69
|
)
|
73
70
|
|
74
71
|
)
|
72
|
+
}
|
73
|
+
|
74
|
+
<% s = Scales::Harrison_8.mul(127) %>
|
75
|
+
; <%= s.canonical %>
|
76
|
+
{
|
77
|
+
<%= Shnth::situ(3) %>
|
78
|
+
|
79
|
+
; 60Hz-ish
|
80
|
+
(srate (short 36 79))
|
81
|
+
|
82
|
+
(arab
|
83
|
+
|
84
|
+
(pan
|
85
|
+
(add
|
86
|
+
(horna <%= s[Shnth::But_A].n %> <%= s[Shnth::But_A].d %> (slewa (majora) <%= Slew_upp %> <%= Slew_donn %>))
|
87
|
+
(hornc <%= s[Shnth::But_C].n %> <%= s[Shnth::But_C].d %> (slewc (majorc) <%= Slew_upp %> <%= Slew_donn %>))
|
88
|
+
(horne <%= s[Shnth::But_d].n %> <%= s[Shnth::But_d].d %> (slewe (minord) <%= Slew_upp %> <%= Slew_donn %>))
|
89
|
+
(horng <%= s[Shnth::But_b].n %> <%= s[Shnth::But_b].d %> (slewg (minorb) <%= Slew_upp %> <%= Slew_donn %>))
|
90
|
+
)
|
91
|
+
80
|
92
|
+
)
|
75
93
|
|
94
|
+
(pan
|
95
|
+
(add
|
96
|
+
(hornb <%= s[Shnth::But_B].n %> <%= s[Shnth::But_B].d %> (slewb (majorb) <%= Slew_upp %> <%= Slew_donn %>))
|
97
|
+
(hornd <%= s[Shnth::But_D].n %> <%= s[Shnth::But_D].d %> (slewd (majord) <%= Slew_upp %> <%= Slew_donn %>))
|
98
|
+
(hornf <%= s[Shnth::But_c].n %> <%= s[Shnth::But_c].d %> (slewf (minorc) <%= Slew_upp %> <%= Slew_donn %>))
|
99
|
+
(hornh <%= s[Shnth::But_a].n %> <%= s[Shnth::But_a].d %> (slewh (minora) <%= Slew_upp %> <%= Slew_donn %>))
|
100
|
+
)
|
101
|
+
144
|
102
|
+
)
|
103
|
+
|
104
|
+
)
|
76
105
|
}
|
77
106
|
|
107
|
+
<% s = Scales::Bohlen_8.mul(127) %>
|
108
|
+
; <%= s.canonical %>
|
78
109
|
{
|
79
|
-
<%= Shnth::
|
110
|
+
<%= Shnth::situ(4) %>
|
111
|
+
|
112
|
+
; 60Hz-ish
|
113
|
+
(srate (short 36 79))
|
80
114
|
|
81
|
-
(
|
82
|
-
|
115
|
+
(arab
|
116
|
+
|
117
|
+
(pan
|
118
|
+
(add
|
119
|
+
(horna <%= s[Shnth::But_A].n %> <%= s[Shnth::But_A].d %> (slewa (majora) <%= Slew_upp %> <%= Slew_donn %>))
|
120
|
+
(hornc <%= s[Shnth::But_C].n %> <%= s[Shnth::But_C].d %> (slewc (majorc) <%= Slew_upp %> <%= Slew_donn %>))
|
121
|
+
(horne <%= s[Shnth::But_d].n %> <%= s[Shnth::But_d].d %> (slewe (minord) <%= Slew_upp %> <%= Slew_donn %>))
|
122
|
+
(horng <%= s[Shnth::But_b].n %> <%= s[Shnth::But_b].d %> (slewg (minorb) <%= Slew_upp %> <%= Slew_donn %>))
|
123
|
+
)
|
124
|
+
80
|
125
|
+
)
|
126
|
+
|
127
|
+
(pan
|
83
128
|
(add
|
84
|
-
(
|
85
|
-
(
|
129
|
+
(hornb <%= s[Shnth::But_B].n %> <%= s[Shnth::But_B].d %> (slewb (majorb) <%= Slew_upp %> <%= Slew_donn %>))
|
130
|
+
(hornd <%= s[Shnth::But_D].n %> <%= s[Shnth::But_D].d %> (slewd (majord) <%= Slew_upp %> <%= Slew_donn %>))
|
131
|
+
(hornf <%= s[Shnth::But_c].n %> <%= s[Shnth::But_c].d %> (slewf (minorc) <%= Slew_upp %> <%= Slew_donn %>))
|
132
|
+
(hornh <%= s[Shnth::But_a].n %> <%= s[Shnth::But_a].d %> (slewh (minora) <%= Slew_upp %> <%= Slew_donn %>))
|
86
133
|
)
|
87
|
-
|
88
|
-
(corp 10 60)
|
134
|
+
144
|
89
135
|
)
|
136
|
+
|
90
137
|
)
|
138
|
+
}
|
139
|
+
|
140
|
+
|
141
|
+
<% s = Scales::Fibo_9.mul(127) %>
|
142
|
+
; <%= s.canonical %>
|
143
|
+
{
|
144
|
+
<%= Shnth::situ(5) %>
|
145
|
+
|
146
|
+
; 60Hz-ish
|
147
|
+
(srate (short 36 79))
|
148
|
+
|
149
|
+
(arab
|
91
150
|
|
92
|
-
|
93
|
-
|
151
|
+
(pan
|
152
|
+
(add
|
153
|
+
(horna <%= s[Shnth::But_A].n %> <%= s[Shnth::But_A].d %> (slewa (majora) <%= Slew_upp %> <%= Slew_donn %>))
|
154
|
+
(hornc <%= s[Shnth::But_C].n %> <%= s[Shnth::But_C].d %> (slewc (majorc) <%= Slew_upp %> <%= Slew_donn %>))
|
155
|
+
(horne <%= s[Shnth::But_d].n %> <%= s[Shnth::But_d].d %> (slewe (minord) <%= Slew_upp %> <%= Slew_donn %>))
|
156
|
+
(horng <%= s[Shnth::But_b].n %> <%= s[Shnth::But_b].d %> (slewg (minorb) <%= Slew_upp %> <%= Slew_donn %>))
|
157
|
+
)
|
158
|
+
80
|
159
|
+
)
|
160
|
+
|
161
|
+
(pan
|
94
162
|
(add
|
95
|
-
(
|
96
|
-
(
|
163
|
+
(hornb <%= s[Shnth::But_B].n %> <%= s[Shnth::But_B].d %> (slewb (majorb) <%= Slew_upp %> <%= Slew_donn %>))
|
164
|
+
(hornd <%= s[Shnth::But_D].n %> <%= s[Shnth::But_D].d %> (slewd (majord) <%= Slew_upp %> <%= Slew_donn %>))
|
165
|
+
(hornf <%= s[Shnth::But_c].n %> <%= s[Shnth::But_c].d %> (slewf (minorc) <%= Slew_upp %> <%= Slew_donn %>))
|
166
|
+
(hornh <%= s[Shnth::But_a].n %> <%= s[Shnth::But_a].d %> (slewh (minora) <%= Slew_upp %> <%= Slew_donn %>))
|
97
167
|
)
|
98
|
-
|
99
|
-
(corpb 10 60)
|
168
|
+
144
|
100
169
|
)
|
170
|
+
|
101
171
|
)
|
172
|
+
}
|
102
173
|
|
174
|
+
<% s = Scales::Gann_Ghost.mul(127) %>
|
175
|
+
; <%= s.canonical %>
|
176
|
+
{
|
177
|
+
<%= Shnth::situ(6) %>
|
178
|
+
|
179
|
+
; 60Hz-ish
|
180
|
+
(srate (short 36 79))
|
181
|
+
|
182
|
+
(arab
|
183
|
+
|
184
|
+
(pan
|
185
|
+
(add
|
186
|
+
(horna <%= s[Shnth::But_A].n %> <%= s[Shnth::But_A].d %> (slewa (majora) <%= Slew_upp %> <%= Slew_donn %>))
|
187
|
+
(hornc <%= s[Shnth::But_C].n %> <%= s[Shnth::But_C].d %> (slewc (majorc) <%= Slew_upp %> <%= Slew_donn %>))
|
188
|
+
(horne <%= s[Shnth::But_d].n %> <%= s[Shnth::But_d].d %> (slewe (minord) <%= Slew_upp %> <%= Slew_donn %>))
|
189
|
+
(horng <%= s[Shnth::But_b].n %> <%= s[Shnth::But_b].d %> (slewg (minorb) <%= Slew_upp %> <%= Slew_donn %>))
|
190
|
+
)
|
191
|
+
80
|
192
|
+
)
|
193
|
+
|
194
|
+
(pan
|
195
|
+
(add
|
196
|
+
(hornb <%= s[Shnth::But_B].n %> <%= s[Shnth::But_B].d %> (slewb (majorb) <%= Slew_upp %> <%= Slew_donn %>))
|
197
|
+
(hornd <%= s[Shnth::But_D].n %> <%= s[Shnth::But_D].d %> (slewd (majord) <%= Slew_upp %> <%= Slew_donn %>))
|
198
|
+
(hornf <%= s[Shnth::But_c].n %> <%= s[Shnth::But_c].d %> (slewf (minorc) <%= Slew_upp %> <%= Slew_donn %>))
|
199
|
+
(hornh <%= s[Shnth::But_a].n %> <%= s[Shnth::But_a].d %> (slewh (minora) <%= Slew_upp %> <%= Slew_donn %>))
|
200
|
+
)
|
201
|
+
144
|
202
|
+
)
|
203
|
+
|
204
|
+
)
|
103
205
|
}
|
@@ -14,18 +14,18 @@
|
|
14
14
|
|
15
15
|
(pan
|
16
16
|
(add
|
17
|
-
(modo (horna <%= s1[Shnth::
|
18
|
-
(modo (hornc <%= s1[Shnth::
|
19
|
-
(modo (horne <%= s1[Shnth::
|
17
|
+
(modo (horna <%= s1[Shnth::But_A].n %> <%= s1[Shnth::But_A].d %> (slewa (majora) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
18
|
+
(modo (hornc <%= s1[Shnth::But_C].n %> <%= s1[Shnth::But_C].d %> (slewc (majorc) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
19
|
+
(modo (horne <%= s1[Shnth::But_d].n %> <%= s1[Shnth::But_d].d %> (slewe (minord) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
20
20
|
)
|
21
21
|
144
|
22
22
|
)
|
23
23
|
|
24
24
|
(pan
|
25
25
|
(add
|
26
|
-
(modo (hornb <%= s1[Shnth::
|
27
|
-
(modo (hornd <%= s1[Shnth::
|
28
|
-
(modo (hornf <%= s1[Shnth::
|
26
|
+
(modo (hornb <%= s1[Shnth::But_B].n %> <%= s1[Shnth::But_B].d %> (slewb (majorb) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
27
|
+
(modo (hornd <%= s1[Shnth::But_D].n %> <%= s1[Shnth::But_D].d %> (slewd (majord) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
28
|
+
(modo (hornf <%= s1[Shnth::But_c].n %> <%= s1[Shnth::But_c].d %> (slewf (minorc) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
29
29
|
)
|
30
30
|
80
|
31
31
|
)
|
@@ -43,18 +43,18 @@
|
|
43
43
|
|
44
44
|
(pan
|
45
45
|
(add
|
46
|
-
(modo (horna <%= s2[Shnth::
|
47
|
-
(modo (hornc <%= s2[Shnth::
|
48
|
-
(modo (horne <%= s2[Shnth::
|
46
|
+
(modo (horna <%= s2[Shnth::But_A].n %> <%= s2[Shnth::But_A].d %> (slewa (majora) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
47
|
+
(modo (hornc <%= s2[Shnth::But_C].n %> <%= s2[Shnth::But_C].d %> (slewc (majorc) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
48
|
+
(modo (horne <%= s2[Shnth::But_d].n %> <%= s2[Shnth::But_d].d %> (slewe (minord) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
49
49
|
)
|
50
50
|
144
|
51
51
|
)
|
52
52
|
|
53
53
|
(pan
|
54
54
|
(add
|
55
|
-
(modo (hornb <%= s2[Shnth::
|
56
|
-
(modo (hornd <%= s2[Shnth::
|
57
|
-
(modo (hornf <%= s2[Shnth::
|
55
|
+
(modo (hornb <%= s2[Shnth::But_B].n %> <%= s2[Shnth::But_B].d %> (slewb (majorb) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
56
|
+
(modo (hornd <%= s2[Shnth::But_D].n %> <%= s2[Shnth::But_D].d %> (slewd (majord) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
57
|
+
(modo (hornf <%= s2[Shnth::But_c].n %> <%= s2[Shnth::But_c].d %> (slewf (minorc) <%= Slew_mul %> <%= Slew_add %>)) <%= Modo_mul %>)
|
58
58
|
)
|
59
59
|
80
|
60
60
|
)
|
data/lib/shlisp_tools/ratio.rb
CHANGED
@@ -13,6 +13,21 @@ module ShlispTools
|
|
13
13
|
# rational form
|
14
14
|
attr_reader :rat
|
15
15
|
|
16
|
+
def self.parse_ratio(txt)
|
17
|
+
parsed = {}
|
18
|
+
matches = /(\d+)[\/\:](\d+)/.match(txt)
|
19
|
+
if matches && matches.captures.length >= 2
|
20
|
+
parsed[:nume] = matches[1].to_i
|
21
|
+
parsed[:deno] = matches[2].to_i
|
22
|
+
end
|
23
|
+
parsed
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.parse_new(txt)
|
27
|
+
r = parse_ratio(txt)
|
28
|
+
Ratio.new(r[:nume], r[:deno])
|
29
|
+
end
|
30
|
+
|
16
31
|
def initialize(nume, deno, _mul=nil)
|
17
32
|
@nume = nume
|
18
33
|
@deno = deno
|
data/lib/shlisp_tools/scale.rb
CHANGED
@@ -13,7 +13,11 @@ module ShlispTools
|
|
13
13
|
def initialize(degrees=nil)
|
14
14
|
@degrees = []
|
15
15
|
if degrees && !degrees.empty?
|
16
|
-
degrees.each
|
16
|
+
degrees.each do |n|
|
17
|
+
n = Ratio::parse_new(n) if n.is_a?(String)
|
18
|
+
raise "Bad scale degree: #{n.inspect}" unless n.is_a?(Ratio)
|
19
|
+
@degrees << n
|
20
|
+
end
|
17
21
|
_sort
|
18
22
|
end
|
19
23
|
end
|
data/lib/shlisp_tools/scales.rb
CHANGED
@@ -7,47 +7,20 @@ module ShlispTools
|
|
7
7
|
|
8
8
|
# 1-3-5-7 hexany, utonal stellated
|
9
9
|
# second degree (49/48) and 2/1 removed to fit eight buttons
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
])
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Ratio.new( 1, 1),
|
25
|
-
Ratio.new(37, 32),
|
26
|
-
Ratio.new(21, 16),
|
27
|
-
Ratio.new(49, 32),
|
28
|
-
Ratio.new( 7, 4),
|
29
|
-
Ratio.new( 2, 1)
|
30
|
-
])
|
31
|
-
|
32
|
-
# 1/1 9/8 151/128 3/2 25/16 2/1
|
33
|
-
MetaSlendro_2 = Scale.new([
|
34
|
-
Ratio.new( 1, 1),
|
35
|
-
Ratio.new( 9, 8),
|
36
|
-
Ratio.new(151, 128),
|
37
|
-
Ratio.new( 3, 2),
|
38
|
-
Ratio.new( 25, 16),
|
39
|
-
Ratio.new( 2, 1)
|
40
|
-
])
|
41
|
-
|
42
|
-
# 1/1 21/20 7/6 3/2 14/9 2/1
|
43
|
-
CentaurPelog = Scale.new([
|
44
|
-
Ratio.new( 1, 1),
|
45
|
-
Ratio.new(21, 20),
|
46
|
-
Ratio.new( 7, 6),
|
47
|
-
Ratio.new( 3, 2),
|
48
|
-
Ratio.new(14, 9),
|
49
|
-
Ratio.new( 2, 1)
|
50
|
-
])
|
10
|
+
Hexany1357 = Scale.new(%w[ 1/1 25/24 7/6 5/4 35/24 3/2 5/3 7/4 ])
|
11
|
+
|
12
|
+
MetaSlendro_1 = Scale.new(%w[ 1/1 37/32 21/16 49/32 7/4 2/1 ])
|
13
|
+
MetaSlendro_2 = Scale.new(%w[ 1/1 9/8 151/128 3/2 25/16 2/1 ])
|
14
|
+
|
15
|
+
# subset of Grady 12-note Centaur
|
16
|
+
CentaurPelog = Scale.new(%w[ 1/1 21/20 7/6 3/2 14/9 2/1 ])
|
17
|
+
|
18
|
+
# from the Scala archives
|
19
|
+
Tenney_8 = Scale.new(%w[ 1/1 17/16 19/16 5/4 11/8 3/2 13/8 7/4 ])
|
20
|
+
Harrison_8 = Scale.new(%w[ 1/1 16/15 6/5 5/4 45/32 3/2 5/3 16/9 ])
|
21
|
+
Bohlen_8 = Scale.new(%w[ 1/1 10/9 6/5 9/7 7/5 14/9 5/3 9/5 ])
|
22
|
+
Fibo_9 = Scale.new(%w[ 1/1 17/16 5/4 21/16 89/64 3/2 13/8 55/32 ])
|
23
|
+
Gann_Ghost = Scale.new(%w[ 1/1 9/8 7/6 21/16 4/3 3/2 14/9 7/4 ])
|
51
24
|
|
52
25
|
end
|
53
26
|
|
data/lib/shlisp_tools/shnth.rb
CHANGED
@@ -11,22 +11,22 @@ to show which situation is running:
|
|
11
11
|
- <tt>\<%= Situation_2 %></tt> emits <tt>(jump (tar 1)) (lights 4)</tt>
|
12
12
|
- etc.
|
13
13
|
|
14
|
-
*
|
15
|
-
- <tt>
|
16
|
-
- <tt>
|
14
|
+
*But_\**: scale indexes by bar (Uppercase=major, lowercase=minor), using stevek's arrangement:
|
15
|
+
- <tt>But_A = 0</tt>
|
16
|
+
- <tt>But_B = 1</tt>
|
17
17
|
- etc.
|
18
18
|
=end
|
19
|
-
|
19
|
+
|
20
20
|
module Shnth
|
21
21
|
|
22
22
|
Light_1 = 1
|
23
|
-
Light_2 = Light_1 *
|
24
|
-
Light_3 = Light_2 *
|
25
|
-
Light_4 = Light_3 *
|
26
|
-
Light_5 = Light_4 *
|
27
|
-
Light_6 = Light_5 *
|
28
|
-
Light_7 = Light_6 *
|
29
|
-
Light_8 = Light_7 *
|
23
|
+
Light_2 = Light_1 * 2
|
24
|
+
Light_3 = Light_2 * 2
|
25
|
+
Light_4 = Light_3 * 2
|
26
|
+
Light_5 = Light_4 * 2
|
27
|
+
Light_6 = Light_5 * 2
|
28
|
+
Light_7 = Light_6 * 2
|
29
|
+
Light_8 = Light_7 * 2
|
30
30
|
|
31
31
|
Situation_1 = "(jump (tar 1)) (lights #{Light_1})"
|
32
32
|
Situation_2 = "(jump (tar 1)) (lights #{Light_2})"
|
@@ -36,15 +36,36 @@ to show which situation is running:
|
|
36
36
|
Situation_6 = "(jump (tar 1)) (lights #{Light_6})"
|
37
37
|
Situation_7 = "(jump (tar 1)) (lights #{Light_7})"
|
38
38
|
Situation_8 = "(jump (tar 1)) (lights #{Light_8})"
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
|
40
|
+
But_A = 0
|
41
|
+
But_B = 1
|
42
|
+
But_C = 2
|
43
|
+
But_D = 3
|
44
|
+
But_d = 4
|
45
|
+
But_c = 5
|
46
|
+
But_b = 6
|
47
|
+
But_a = 7
|
48
|
+
|
49
|
+
def self.light(position)
|
50
|
+
2**(position-1)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.situ(position, method=:tar)
|
54
|
+
case method
|
55
|
+
when :tar
|
56
|
+
jump = "(jump (tar 1))"
|
57
|
+
when :minor_ab
|
58
|
+
jump = "(jump (minorb 1 (minora -1)))"
|
59
|
+
else
|
60
|
+
;
|
61
|
+
end
|
62
|
+
|
63
|
+
"#{jump} (lights #{light(position)})"
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.join(*stuff)
|
67
|
+
stuff.join(' ').squeeze(' ')
|
68
|
+
end
|
48
69
|
|
49
70
|
end
|
50
71
|
|
data/lib/shlisp_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shlisp_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|