smml 0.1.3 → 0.1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a729ae19582944c975ae13ebf91da26892d6a45d
4
- data.tar.gz: c0c49b883cd80909160385613ec563c86d181c74
3
+ metadata.gz: 3f60c5da7faf59812d18845c1ae2a5454bc9444f
4
+ data.tar.gz: 832b1493ec1af0deb3f22df0e9348db0f47ef257
5
5
  SHA512:
6
- metadata.gz: b3a68fe184996d7995a6dd5146efdca24237e62061f432713b7ed3a602df484d662a1b37bac4dd7421b485554f9c50a7fb5b7eca0d75a07f8b35d6d32bd2b871
7
- data.tar.gz: 9519e4fa0758a35d23ffc80a1f556b80989ad04e9b504e5dbd797dab1cbe094c4c0afd49fc24471054c9d48d72d7afe1883f088a8f1c626d7816f115ee0f6dd3
6
+ metadata.gz: 6b792328cd68182ac47d0bce2c98aa725e2b9b58389525dc7226c667e8f473efdc76a6f091122bda92610e68eec4e4bf4e15ed1d4828e441c343f73ca16da4cc
7
+ data.tar.gz: 29caddd563afe13f38f6616a21dd64658c7d7fab6b34b6ddcd8d5d75c5f31566ee3a00aa39aca84a49888bbac8b06d3d71925a3617e8de58a3ac82d4665a0bd8
data/bin/mmlsmml CHANGED
@@ -49,9 +49,9 @@ end
49
49
  m=Smml.new
50
50
  puts
51
51
  data=data.size>0 ? data.split(';')*"\n" : (File.read(infile) rescue (help;exit))
52
- p data
52
+ STDERR.puts data if $DEBUG
53
53
  data=data.split("\n").map{|i|i.commentoff("\n",'#')}*"\n"
54
- p data
54
+ STDERR.puts data if $DEBUG
55
55
  smml=Mml.tosmml(data)
56
56
  puts smml if $smmlshow || $DEBUG || outfile==""
57
57
  exit if outfile==""
data/lib/smml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Smml
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.3.1"
3
3
  end
data/smml.gemspec CHANGED
@@ -13,10 +13,10 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/tabasano/wavseq"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = Dir.glob("lib/*")+Dir.glob("lib/smml/*")+Dir.glob("bin/*")+["Gemfile","Rakefile","LICENSE.txt","smml.gemspec","README_smml.md"]+["sample/midi-preModifier.txt","sample/midi-test.mml"]
16
+ spec.files = Dir.glob("lib/*")+Dir.glob("lib/smml/*")+Dir.glob("bin/*")+["Gemfile","Rakefile","LICENSE.txt","smml.gemspec","README_smml.md","tutorial_smml.md"]+["sample/midi-preModifier.txt","sample/midi-test.mml"]
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.extra_rdoc_files =%w[README_smml.md LICENSE.txt]
19
+ spec.extra_rdoc_files =%w[README_smml.md LICENSE.txt tutorial_smml.md]
20
20
  spec.require_paths = ["lib"]
21
21
  spec.required_ruby_version = '>= 1.8.7'
22
22
  spec.add_development_dependency "bundler", "~> 1.6"
data/tutorial_smml.md ADDED
@@ -0,0 +1,473 @@
1
+ ## note
2
+ ;; note 'c', at first.
3
+
4
+ ```
5
+ c
6
+ ```
7
+
8
+ ;; depending on a midi player, before and after sounds, it is better to set some rest time to listen.
9
+ ;; 'r' means rest. small letters are note names. blanks can be used anywhere and will be ignored.
10
+
11
+ ```
12
+ c d e d c3 r
13
+ ```
14
+ ;; capital letters are notes with sharps
15
+
16
+ ```
17
+ e D e f F g g2
18
+ ```
19
+
20
+ ## octave
21
+ ;; change octave hight by '-', '+' or '(octave:3)' etc.
22
+
23
+ ```
24
+ c d e2
25
+ + c d e2
26
+ - e d c2
27
+ ```
28
+
29
+ ;; >< tempo up down.
30
+
31
+ ```
32
+ f r > f r > f r > f r <<< fr fr fr fr
33
+ ```
34
+ ## note length
35
+ ;; use note length. set it after note charactors. no length means 1.
36
+ ```
37
+ c d2 e3 f4
38
+ ```
39
+ ;; float numbers as length too.
40
+ ```
41
+ c d0.5 d0.5 e0.25 e0.25 e0.25 e0.25
42
+ ```
43
+ ;; ( thus, length expression is far from standard MML. usualy it is similiar to musical note name. )
44
+
45
+ ## gate time
46
+ ;; real tone length is important sometimes. gate time command is a percentage of tone length. (staccato etc.)
47
+ ```
48
+ (g:100) a b c
49
+ (g:70) a b c
50
+ ```
51
+ first line is played like with a slar. second one will be played by more shorter sounds.
52
+ ## multiplet
53
+ ;; but above is similiar to bellow
54
+ ```
55
+ c /: dd / /: eeee /
56
+ ```
57
+ ;; because for example '/3: dd /' means that two 'd' notes are set inside '3' beats.
58
+ ```
59
+ /3: dd / /3: ddd / /3: dddddd / /3: dddddddddddd /
60
+ ```
61
+ ;; set velocity. max is 127.
62
+ ```
63
+ (v:70) c (v:40) c (v:20) c (v:70) c (v:90) c
64
+ ```
65
+ ;; set panpot. value is between 0 and 127. when using '><', right or left value (from 0 to 63).
66
+ ```
67
+ (pan:>30) c d e
68
+ ```
69
+
70
+ ## repeat phraze
71
+ ;; repeat 3 times
72
+ ```
73
+ [ c d e f ]3
74
+ ```
75
+ ;; a melody goes near up/down side note without octave commands as default.
76
+ ```
77
+ [ cdefgab ] 4
78
+ ```
79
+ ;; if you don't want do so, use octave command '-'. '--' is same to '-2'
80
+ ```
81
+ [ cdefgab - ] 4
82
+ [ cdefgab cdefgab -- ] 4
83
+ ```
84
+ ;; to make long tones easy to read, '~' is used. 'c3' is same to 'c~~'. it can be set whereever notes can be set.
85
+ ```
86
+ c d e ~ e d c ~
87
+ c /:~de/ d ~
88
+ ```
89
+ ;; same note is '='.
90
+ ```
91
+ c = = = d = = =
92
+ ```
93
+
94
+ ## chord
95
+ ;; multi notes with length 2.
96
+ ```
97
+ {c,e,g}2
98
+ ```
99
+
100
+ ;; chord name. used as same way as note commands. currently ',' is not be able to omitted as a part of chord name.
101
+ ```
102
+ :cmaj7, = = = :G7, = = =
103
+ ```
104
+ ;; most commands except note type ones, are inside parenthesis. set the tempo 120 bpm.
105
+ ```
106
+ (tempo:120)
107
+ ```
108
+ ;; stroke. after it, multi notes are played shifted note by note.
109
+ ```
110
+ (stroke:4)
111
+ ```
112
+
113
+ ## sharp, flat
114
+ ;; note name etc. is case sencitive, so each of 12 notes in one octave can be expressed by one charactor.
115
+ ;; but in other cases,
116
+ ;; sharp,flat and natural note command can be used. set before the note.
117
+ ```
118
+ (+)a (-)b (0)c
119
+ ```
120
+ strange ways can be affective currently. '(+4)a' etc.
121
+ ;; instead of 'd' etc., note numbers can be used if you want.
122
+ ;; MIDI note value is from 0 to 127. it's over Piano's 88. but too high/low note may not be played and heard.
123
+ ```
124
+ {64}
125
+ {50,54,58}
126
+ ```
127
+
128
+ ## instrument; program change
129
+ ;; drum sound can be used anywhere. but this is not MIDI way. use instrument name.
130
+ ```
131
+ _snare! = = =
132
+ ```
133
+ ;; set instrument. automaticaly searched by even not exact name. (MIDI program change command)
134
+ ```
135
+ (p:piano) c d e f (p:guitar) f e d c
136
+ ```
137
+ ;; set drum channel. after it is set, note numbers also can be used as same as '_snare!' etc.
138
+ ```
139
+ (ch:drum) {34} = = = {35} = = =
140
+ ```
141
+
142
+ ## track
143
+ ;; in SMF, MIDI channel is 1 - 16, and drum is in 10 channel. but currently, these are automaticaly set.
144
+ ;; you don't need to think about it. simply seperate tracks with a command '|||'.
145
+ ;; in the future, track names may be used.
146
+ ```
147
+ (p:piano) c d e f ||| (p:organ) e f g a ||| (p:guitar) g a b c
148
+ ```
149
+ ;; for visibility, the same
150
+ ```
151
+ (p:piano) c d e f
152
+ ||| (p:organ) e f g a
153
+ ||| (p:guitar) g a b c
154
+ ```
155
+ ## page
156
+ ;; then seperate pages by three or longer one line '/'.
157
+ ;; but this command do not adjust time potisions. it simply resets track number increment.
158
+ ```
159
+ cdef|||efga|||gabc
160
+ ////////////////////
161
+ cdef|||efga|||gabc
162
+ ///////////////////
163
+ cdef|||efga|||gabc
164
+ ```
165
+ ;; the same to below.
166
+ ```
167
+ cdef cdef cdef ||| efga efga efga ||| gabc gabc gabc
168
+ ```
169
+ ;; if you want to adjust tracks, use a blank page. the last three 'c' will be played adjusted.
170
+ ```
171
+ cd ||| e ||| abcde
172
+ ////////////////////
173
+ ////////////////////
174
+ c|||c|||c
175
+ ```
176
+ ## position mark
177
+ ;; or use a position mark command.
178
+ ```
179
+ cd ||| e ||| abcde
180
+ ////////////////////
181
+ (mark:positionName) c
182
+ ||| (mark:positionName) c
183
+ ||| (mark:positionName) c
184
+ ```
185
+ ;; marks are not needed for all tracks. positions will be adjusted automaticaly to the preceeding track while the same marks exist.
186
+ ;; like this, most commands except tempo, a command effects its belonging track only.
187
+
188
+ ## instrument map
189
+ ;; a MIDI Program Change event sets the instrument on a channel.
190
+ if channel is 10, a note number means each drum instrument.
191
+ these are decreared in map files;
192
+ > midi-programChange-list.txt
193
+
194
+
195
+ > midi-percussion-map.txt
196
+
197
+
198
+ when there are same name files on the current directory, these are used. if not, default files in the gem will be set.
199
+ data in these map text must start with instrument number.
200
+ without it, the line text is used for section name. if the word 'Guitar' appears, it is included for searching keyword until the next section name line appears.
201
+ ```
202
+
203
+ Piano Section
204
+ 1 hoge piano
205
+ 2 foo
206
+ 3 bar
207
+
208
+ Guitar Section
209
+ 4 one
210
+ 5 two
211
+
212
+ ```
213
+ so in this list, instrument number 1,2 and 3 match the keyword 'piano'.
214
+ So '(p:guitar,2)' selects an instrument line '5 two' as the 2nd result of searching 'guitar' and will be used instead of no word 'guitar' on it.
215
+
216
+ ## hex data
217
+ ;; until smml syntax is completed, raw hex parts can be used for complex data and things you don't know how to inprement in data.
218
+ search MIDI format and set hex data.
219
+ ```
220
+ &(00 00 00)
221
+ ```
222
+ ;; currently hex only can be used. oct/decimal may be able to use someday.
223
+ all in SMF track data, unique formated prefix delta tick time data is needed. so if want, you can use '$delta(240)' for 240 ticks.
224
+ the tick means a minimum time span in SMF , one beat equals to 480 ticks as default. in this case, delta time is set to half beat.
225
+ also '$se(F0 41 ..)' can be used for system exclusive message data.
226
+ currently, nest data of parenthesis is not implemented except very limited cases.
227
+
228
+ ## macro define
229
+ ;; for repeating phraze, macro can be used. use prefix '$' for refering.
230
+ ```
231
+ Macr:=cde
232
+ macro W:=abc
233
+
234
+ ggg $Macr fff $W
235
+ ```
236
+ the 4th line will be subsituted by
237
+ ```
238
+ ggg cde fff abc.
239
+ ```
240
+ the keyword 'macro' is used just for reading and will simply be ignored.
241
+
242
+
243
+ ;; macro with args
244
+ ```
245
+ fn(x):=ab$x
246
+ ```
247
+ ;; in this case, '$fn(10)' is substituded by 'ab10'. similarly,
248
+ ```
249
+ $fn(:5,6,7)
250
+ $fn(4:10,20,30)
251
+ ```
252
+ will be
253
+ ```
254
+ ab5 ab6 ab7
255
+ ab10 (wait:4) ab20 (wait:4) ab30
256
+ ```
257
+ '(wait:4)' was inserted by '4' in first place before args. it means 4 beats of rest (exact mean of '(wait:..)' is 'do nothing and wait for the next command' ).
258
+
259
+
260
+ multiline macro definition
261
+ ```
262
+ EFF:=(
263
+ F0,43,10,4C,02,01,00,01,01,F7
264
+ F0,43,10,4C,02,01,02,40,F7
265
+ F0,43,10,4C,02,01,0B,77,F7
266
+ F0,43,10,4C,02,01,14,70,F7
267
+ )
268
+ ```
269
+ but now, this is for easy way of writing only, and may not be so useful. to use it, each line must be seperated.
270
+ ```
271
+ $EFF[1] $EFF[2] $EFF[3] $EFF[4]
272
+ ```
273
+
274
+ ## comment
275
+ ;; ignored after ';;' of each line. write comments there.
276
+ multi line comments start with longer ';'.
277
+ end mark is same or longer mark of ';' than start mark. these must start from the top of the line.
278
+ ```
279
+ ;; comment
280
+ ;;;;;;;;;;;;;;;;;;;;;;;;
281
+ comm
282
+ ent
283
+ lines
284
+ ;;;;;;;;;;;;;;;;;;;;;;;;;
285
+ abc ;; real sound
286
+
287
+ ;;;;;;;;;;;;;;;;;;;;
288
+ ;
289
+ ; data ended ...
290
+ ;
291
+ a b c d e f g
292
+ ;;;;;;;;;;;;;;;;;;;;
293
+ ```
294
+ in this case, active sound commands are 'abc' only.
295
+
296
+ ## sound elements
297
+ use parts split note hight, length, velocity, gate time, pre modifier; sound elements.
298
+ ```
299
+ (L: ...)
300
+ (V: ...)
301
+ (G: ...)
302
+ (B: ...)
303
+ a b c d e
304
+ ```
305
+ the first value of each part will used for the first note 'a'. and so on.
306
+ inside parts, position is seperated by ',' or use dummy value 'o'.
307
+ '(V:,,,60,,)' is '(V:ooo 60 oo)'. last dummy values can be omitted. in this case, 4th note 'd' velocity is set to 60.
308
+ if 6th note don't exist, pre modifier element values are simply ignored.
309
+
310
+
311
+ in the same way,
312
+ ```
313
+ (N: a b c d e )
314
+ (L: ...)
315
+ (V: ...)
316
+ (G: ...)
317
+ (B: ...)
318
+ o o o o o
319
+ ```
320
+ is same mean to above. 'o' is dummy note. note hights are substituted by '(N:..)' values.
321
+
322
+
323
+ ## dummy note
324
+ 'o' is dummy. '?' is for random note etc.
325
+ ```
326
+ ? /2: ???? /
327
+ ```
328
+ will be
329
+ ```
330
+ c /2: defg /
331
+ ```
332
+ or maybe
333
+ ```
334
+ e /2: cagb /
335
+ ```
336
+ etc.
337
+
338
+ ## transpose
339
+ ```
340
+ (key:-4)
341
+ ```
342
+ ;; transpose -4 of half tone except drum instrument name like '_snare!'.
343
+ this does not have relation with the tonality. simply transpose all notes tempolary.
344
+ major key, minor key ,modulation of keys have not been implimented yet.
345
+ ## Control Change
346
+ ```
347
+ (cc:10,64)
348
+ ```
349
+ controlChange number 10 value 64. see SMF format.
350
+
351
+ ## General MIDI etc.
352
+ ```
353
+ (gm:on)
354
+ (gs:reset)
355
+ (xg:on)
356
+ ```
357
+ after these commands, it need some time over 50 mili sec. or so for running.
358
+ implementation of it is not fixed, so for adjusting, please set marks on all tracks. for example '(mark:start)'.
359
+
360
+ ## compile order
361
+ now compiling order is : page,track seperate => macro set and replace => repeat check => sound data make.
362
+ if there are bugs, error can appear by macro definitions appear in the last step 'sound data make' for example.
363
+
364
+ ## D.S. al fine
365
+ musical repeats system marks :
366
+ ```
367
+ .DC .DS .toCODA .CODA .FINE
368
+ ```
369
+ ```
370
+ .SKIP
371
+ ```
372
+ ;; skip on second time.
373
+ ```
374
+ .$
375
+ ```
376
+ dal segno jump mark.
377
+
378
+ ```
379
+ [ a b c ]
380
+ ```
381
+ if there is no followed number, 'abc' is repeated 2 times.
382
+
383
+ ## seperater
384
+ ;; ';' can be used for one line data as line seperater.
385
+ ```
386
+ $ smml -d "abc;def|||mc:=ggg;ccc$mc ddd" -o out.mid
387
+ ```
388
+ in this case, macro definition ends by ';', so $mc means 'ggg'.
389
+ ## and so on
390
+ for more details if you want to understand, see MIDI format.
391
+ basicaly, a MIDI envent is constructed by preceding time data and event data.
392
+ so series of event preceding each zero time data mean many event on the same time.
393
+ but it may not be played as you expect. to fix it, set some delta time for MIDI players.
394
+ ```
395
+ (on:a)
396
+ ```
397
+ note 'a' sound on only. it takes zero tick.
398
+ ```
399
+ (off:a)
400
+ ```
401
+ note 'a' sound off only.
402
+ ```
403
+ (wait:3)
404
+ ```
405
+ it reserves 3 beats for the next note event.
406
+ so,
407
+ the note event 'a' is the same as '(on:a)(wait:1)(off:a)'.
408
+ '(on:a)(on:b)(on:c)(wait:2)(off:a)(off:b)(off:c)' is '{a,b,c}2'
409
+
410
+
411
+
412
+ ```
413
+ (ch:1)
414
+ ```
415
+ ;; set this track's channel 1. when several tracks use same channel, for example it will behave as the same instrument.
416
+ ```
417
+ (bend:100)
418
+ ```
419
+ pitch bend 100
420
+ ```
421
+ (bendRange:12)
422
+ ```
423
+ set bend range 12. default is normaly 2.
424
+ ```
425
+ (bendCent:on)
426
+ ```
427
+ set bend value unit cent (half tone eqauls 100 cents). defaultly this is 'off' and value is between -8192 and +8192.
428
+ so, these are same
429
+ ```
430
+ (bendCent:off)(bend:8192)
431
+ (bendCent:on)(bend:100)
432
+ ```
433
+ ```
434
+ (V:o,o,110)
435
+ ```
436
+ preceding modifier velocities. if next notes are 'abc' ,3rd tone 'c' is with velocity 110. a blank or 'o' mean default value.
437
+ ```
438
+ (G:,,-)
439
+ ```
440
+ preceding modifier gate rates. if next notes are 'abc' ,3rd tone 'c' is with a gate rate shorter.
441
+ new preceding modifiers will cancel old rest preceding values if it remains.
442
+
443
+ ```
444
+ ^ ;; accent
445
+ ` ;; too fast note, play ahead
446
+ ' ;; too late note, lay back
447
+ ```
448
+ set these modifiers before note commands.
449
+ ```
450
+ (loadf:filename.mid,2)
451
+ ```
452
+ load the second track data of filename.mid. when using it, the track must be itself only. seperate by '|||'.
453
+ this command do not check about track data strictly. be careful.
454
+
455
+
456
+ ;; basicaly, one sound is a note type command with preceding modifiers followed by length number.
457
+ ```
458
+ ^`a2
459
+ ```
460
+
461
+ now, note type commands are :
462
+ ```
463
+ 'c' ;; single note
464
+ '(-)d' ;; single note with flat/sharp/natural modifiers
465
+ '{64}' ;; single note by absolute note number
466
+ '_snare!' ;; drum note by instrument name
467
+ '{d,g,-b}' ;; multi note
468
+ ':cmaj7,' ;; chord name
469
+ '=' ;; copy of the latest note type command
470
+ ```
471
+
472
+ and other commands are with parentheses.
473
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tabasano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-25 00:00:00.000000000 Z
11
+ date: 2014-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -49,6 +49,7 @@ extensions: []
49
49
  extra_rdoc_files:
50
50
  - README_smml.md
51
51
  - LICENSE.txt
52
+ - tutorial_smml.md
52
53
  files:
53
54
  - lib/smml.rb
54
55
  - lib/smml/midi-percussion-map.txt
@@ -63,6 +64,7 @@ files:
63
64
  - LICENSE.txt
64
65
  - smml.gemspec
65
66
  - README_smml.md
67
+ - tutorial_smml.md
66
68
  - sample/midi-preModifier.txt
67
69
  - sample/midi-test.mml
68
70
  homepage: https://github.com/tabasano/wavseq