smml 0.1.11.5 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smml/msm.rb +192 -96
- data/lib/smml/version.rb +1 -1
- data/tutorial_smml.md +83 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06bb5368c7eb0544ede87c56f49c7808730e974d
|
4
|
+
data.tar.gz: 35e8347b78ef6bc939822f70df30c3c6f9980fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a266b303a40de9ce2a99da0cfaeb25ee24f03d09c3426050b09e14455d879ea8568924a3c42242d7c72808ee5495aabf37caa7af2a4c9d3934383d6582d11054
|
7
|
+
data.tar.gz: 00c2c5d0aaa44000728c44222c1f070a054957af00699898b2c9d11816f349acf3a879b7572fa8daaec012e8afa8b6d0bddb012ec55b6514b88172d4cc512090
|
data/lib/smml/msm.rb
CHANGED
@@ -89,7 +89,7 @@ syntax: ...( will be changed time after time)
|
|
89
89
|
(syswait:) =when using '(gm:on)' etc., this command is needed for all other tracks to adjust wait-time.
|
90
90
|
||| = track separater
|
91
91
|
/// = page separater
|
92
|
-
series of page
|
92
|
+
series of page separaters insert unique '(mark:all track mark)' to allready running tracks automaticaly.
|
93
93
|
(mark:posname) =position name for adjustment of tracks after long rest etc.
|
94
94
|
.DC .DS .toCODA .CODA .FINE =coda mark etc.
|
95
95
|
.SKIP =skip mark on over second time
|
@@ -97,14 +97,14 @@ syntax: ...( will be changed time after time)
|
|
97
97
|
_snare! =percussion sound ( search word like 'snare' (can use tone number) from percussion list if exist )
|
98
98
|
similarly, _s!=snare, k:bassKick, o:openHighHat, c:closedHighHat, cc:CrachCymbal, h:highTom, l:lowTom as default.
|
99
99
|
map text personaly you set must start with tone number.
|
100
|
-
(loadf:filename.mid,2) =load filename.mid, track 2. Track must be this only and
|
100
|
+
(loadf:filename.mid,2) =load filename.mid, track 2. Track must be this only and separated by '|||'.
|
101
101
|
W:=abc =macro definition. One Charactor macro can be used. use prefix '$' for refering.
|
102
102
|
macro W:=abc =macro definition.
|
103
103
|
fn(x):=ab$x =macro with args. in this case, '$fn(10)' is substituded by 'ab10'. similarly,
|
104
104
|
'$fn(:10,20,30)' = 'ab10ab20ab30'.
|
105
105
|
'$fn(4:10,20,30)' = 'ab10(wait:4)ab20(wait:4)ab30'.
|
106
|
-
compile order is : page,track
|
107
|
-
; =
|
106
|
+
compile order is : page,track separate => macro set and replace => repeat check => sound data make
|
107
|
+
; =separater. same to a new line
|
108
108
|
blank =ignored
|
109
109
|
;; comment =ignored after ';;' of each line
|
110
110
|
;;;;;; =start mark of multi-line comment. end mark is same or longer mark of ';;'. these must start from the top of line.
|
@@ -151,7 +151,7 @@ end
|
|
151
151
|
# num and fixed mark word, for swing rythm
|
152
152
|
class MyLength < Numeric
|
153
153
|
def initialize *a
|
154
|
-
p [:in,a,a.size] if $DEBUG
|
154
|
+
p [:in,a,a.size] if $DEBUG && $debuglevel>4
|
155
155
|
a=a[0] if a.size==1
|
156
156
|
r=[]
|
157
157
|
case a
|
@@ -168,7 +168,7 @@ class MyLength < Numeric
|
|
168
168
|
end
|
169
169
|
@s=Float(r[0])
|
170
170
|
@j=([r[1]]-[nil]).flatten||[]
|
171
|
-
p [:i,@s,@j,r,a] if $DEBUG
|
171
|
+
p [:i,@s,@j,r,a] if $DEBUG && $debuglevel>4
|
172
172
|
end
|
173
173
|
def s
|
174
174
|
@s
|
@@ -289,10 +289,10 @@ module MmlReg
|
|
289
289
|
self.r(key,sort,pre)
|
290
290
|
end
|
291
291
|
def self.trackr
|
292
|
-
self.r([:hexraw,:sharp,:chord,:word,:sound,:tieNote,:register,:modifier,:velocity,:tempo,:num,:octave,:note2,:note,:mod,:note?,:sound?])
|
292
|
+
self.r([:hexraw,:sharp,:chord,:sword,:word,:sound,:tieNote,:register,:modifier,:velocity,:tempo,:num,:octave,:note2,:note,:mod,:note?,:sound?])
|
293
293
|
end
|
294
294
|
def self.multipletr
|
295
|
-
self.r([:note2,:word,:note,:sound,:tieNote,:register,:chord,:numswing,:num,:sharp,:octave,:mod])
|
295
|
+
self.r([:note2,:sword,:word,:note,:sound,:tieNote,:register,:chord,:numswing,:num,:sharp,:octave,:mod])
|
296
296
|
end
|
297
297
|
def self.macroDefr
|
298
298
|
self::MacroDef
|
@@ -319,6 +319,7 @@ module MmlReg
|
|
319
319
|
:repStart,
|
320
320
|
:repEnd,
|
321
321
|
:note2,
|
322
|
+
:sword,
|
322
323
|
:word,
|
323
324
|
:modifier,
|
324
325
|
:sharp,
|
@@ -355,15 +356,16 @@ module MmlReg
|
|
355
356
|
@@h[:repmark]="\\.FINE|\\.DS|\\.DC|\\.\\$|\\.toCODA|\\.CODA|\\.SKIP"
|
356
357
|
@@h[:comment]="\\( *comment[^\(\)]*\\)"
|
357
358
|
@@h[:note2]="\\( *tne *:[^\(\)]*\\)|\\( *[[:alpha:]\\-\\+]+,[^,]*\\)"
|
359
|
+
@@h[:sword]="\\([^\(\):,]*:[^\(\),]+\\([^\(\)]+\\)\\)"
|
358
360
|
@@h[:word]="\\([^\(\):,]*:[^\(\)]*\\)"
|
359
361
|
@@h[:wordStart]="\\([^\(\):]*:"
|
360
362
|
@@h[:sharp]="\\([+-]*[[:digit:]\\.]*\\)"
|
361
363
|
@@h[:word?]="\\([^\(\)]*\\)"
|
362
|
-
@@h[:chord]="\\{[^\{\}]+,[^\{\},]+\\}|:[[:alpha:]][[:alnum:]]*,"
|
364
|
+
@@h[:chord]="\\{[^\{\}]+,[^\{\},]+\\}|:[[:alpha:]][[:alnum:]]*\\([-+,:[:digit:]]+\\),|:[[:alpha:]][[:alnum:]]*,"
|
363
365
|
@@h[:velocity]="v[[:digit:]]+"
|
364
366
|
@@h[:note]="[abcdefgACDFGr]|\\{[[:digit:]]+\\}"
|
365
367
|
@@h[:note?]="[BE]"
|
366
|
-
@@h[:dummyNote]="o"
|
368
|
+
@@h[:dummyNote]="o|m|O|M"
|
367
369
|
@@h[:randNote]="\\?"
|
368
370
|
@@h[:sound]="_[^!]+!|="
|
369
371
|
@@h[:tieNote]="~|w"
|
@@ -407,6 +409,7 @@ module MmlReg
|
|
407
409
|
self.r([:macrodefAStart,:macrodefStart,:macrodefA,:macrodef])
|
408
410
|
RepStrArray=["[","]",".CODA",".DS",".DC",".FINE",".toCODA",".$",".SKIP"]
|
409
411
|
ArgIsOne=%w[ bendCent mark p gm gs xg loadf text ]
|
412
|
+
ArgIsName=%w[ p dumpVar ]
|
410
413
|
def self.event m,rest=[]
|
411
414
|
((@@keys-rest).map{|k|m=~/\A#{@@h[k]}\z/ ? k : nil}-[nil])[0]
|
412
415
|
end
|
@@ -521,6 +524,77 @@ def mergeValues a,b
|
|
521
524
|
}
|
522
525
|
r
|
523
526
|
end
|
527
|
+
class Chord
|
528
|
+
def self.notes type,subtype
|
529
|
+
ten=[0]
|
530
|
+
case type
|
531
|
+
when "power"
|
532
|
+
ten+=[7]
|
533
|
+
when "7"
|
534
|
+
ten+=[4,7,10]
|
535
|
+
when "m7"
|
536
|
+
ten+=[3,7,10]
|
537
|
+
when "maj7"
|
538
|
+
ten+=[4,7,11]
|
539
|
+
when "mmaj7"
|
540
|
+
ten+=[3,7,11]
|
541
|
+
when "maj" # no need
|
542
|
+
ten+=[4,7]
|
543
|
+
when "m"
|
544
|
+
ten+=[3,7]
|
545
|
+
when "6"
|
546
|
+
ten+=[4,7,9]
|
547
|
+
when "m6"
|
548
|
+
ten+=[3,7,9]
|
549
|
+
when "sus4"
|
550
|
+
ten+=[5,7]
|
551
|
+
when "aug", "+"
|
552
|
+
ten+=[4,8]
|
553
|
+
when "dim"
|
554
|
+
ten+=[3,6]
|
555
|
+
when "dim7"
|
556
|
+
ten+=[3,6,9]
|
557
|
+
when ""
|
558
|
+
ten+=[4,7]
|
559
|
+
else
|
560
|
+
STDERR.puts "unknown chord type? #{type}"
|
561
|
+
end
|
562
|
+
if subtype
|
563
|
+
tention=subtype.split(',')
|
564
|
+
tention.each{|i|
|
565
|
+
case i
|
566
|
+
when "+5"
|
567
|
+
ten=ten-[7]+[8]
|
568
|
+
when "-5"
|
569
|
+
ten=ten-[7]+[6]
|
570
|
+
when "9"||"add9"
|
571
|
+
ten=ten+[14]
|
572
|
+
when "+9"
|
573
|
+
ten=ten+[15]
|
574
|
+
when "-9"
|
575
|
+
ten=ten+[13]
|
576
|
+
when "+11"
|
577
|
+
ten=ten+[6]
|
578
|
+
when "13"
|
579
|
+
ten=ten+[9]
|
580
|
+
when "-13"
|
581
|
+
ten=ten+[8]
|
582
|
+
when /^:/
|
583
|
+
t=$'.to_i
|
584
|
+
ten=ten+[t]
|
585
|
+
else
|
586
|
+
STDERR.puts "unknown chord sub type? #{subtype}"
|
587
|
+
end
|
588
|
+
}
|
589
|
+
end
|
590
|
+
ten=ten.sort
|
591
|
+
ten
|
592
|
+
end
|
593
|
+
def self.type c
|
594
|
+
c=~/([^(]*)(\((.*)\))?/
|
595
|
+
self.notes($1,$3)
|
596
|
+
end
|
597
|
+
end
|
524
598
|
class Notes < Hash
|
525
599
|
@@rythmChannel=9
|
526
600
|
@@notes={
|
@@ -547,6 +621,15 @@ class Notes < Hash
|
|
547
621
|
def initialize
|
548
622
|
@@notes.each{|k,v|self[k]=v}
|
549
623
|
end
|
624
|
+
def self.n2note num
|
625
|
+
@@invert[num%@@octave]
|
626
|
+
end
|
627
|
+
def self.n2octave num
|
628
|
+
num/@@octave-1
|
629
|
+
end
|
630
|
+
def self.nDisplay n
|
631
|
+
"#{n}[#{self.n2octave(n)}#{self.n2note(n)}]"
|
632
|
+
end
|
550
633
|
def self.get last,dist=0
|
551
634
|
last=~/(\-*)(\+*)([[:alpha:]])/
|
552
635
|
oct=$1.size*(-1)+$2.size
|
@@ -580,6 +663,9 @@ class ScaleNotes < Array
|
|
580
663
|
@@mode[s[i+1]]=tmp
|
581
664
|
}
|
582
665
|
end
|
666
|
+
def move s
|
667
|
+
initialize(self.map{|i|Notes.get(i,s)})
|
668
|
+
end
|
583
669
|
def keys
|
584
670
|
@@mode.keys
|
585
671
|
end
|
@@ -1318,6 +1404,8 @@ module MidiHex
|
|
1318
1404
|
# track initialize
|
1319
1405
|
def self.trackPrepare tc=0
|
1320
1406
|
self.getDefault
|
1407
|
+
@dummyNoteOrg=["o","O"]
|
1408
|
+
@multidummySize=3
|
1321
1409
|
@basekeybend=0
|
1322
1410
|
@theremin=false
|
1323
1411
|
@strokespeed=0
|
@@ -1381,7 +1469,7 @@ module MidiHex
|
|
1381
1469
|
@waitingtime=0
|
1382
1470
|
@nowtime+=start
|
1383
1471
|
r=[Event.new(:on)]
|
1384
|
-
r<<Event.new(:e,start," 9#{ch} #{key} #{vel} # #{start} later, sound on only , note #{@key} velocity #{velocity}\n")
|
1472
|
+
r<<Event.new(:e,start," 9#{ch} #{key} #{vel} # #{start} later, sound on only , note #{Notes.nDisplay(@key)} velocity #{velocity}\n")
|
1385
1473
|
r
|
1386
1474
|
end
|
1387
1475
|
def self.soundOff key=@basekey,ch=@ch,sharp=0
|
@@ -1420,6 +1508,7 @@ module MidiHex
|
|
1420
1508
|
len+=len*self.getswing(swing)
|
1421
1509
|
bendStart=@bendNow
|
1422
1510
|
ch=[ch,0x0f].min
|
1511
|
+
key=self.rndNote if @dummyNoteOrg.member?(key)
|
1423
1512
|
key+=sharp
|
1424
1513
|
@key=[[key,0x7f].min,0].max
|
1425
1514
|
return self.thereminNote(len,key,velocity,ch) if @theremin
|
@@ -1440,7 +1529,7 @@ module MidiHex
|
|
1440
1529
|
@lenForGate=false
|
1441
1530
|
@nowtime+=start
|
1442
1531
|
r=[]
|
1443
|
-
r<<Event.new(:e,start," 9#{ch} #{key} #{vel} # #{start} later, sound on note #{@key} velocity #{velocity}\n")
|
1532
|
+
r<<Event.new(:e,start," 9#{ch} #{key} #{vel} # #{start} later, sound on note #{Notes.nDisplay(@key)} velocity #{velocity}\n")
|
1444
1533
|
b=@preAfter.shift
|
1445
1534
|
bends=expre=false
|
1446
1535
|
if b
|
@@ -1471,13 +1560,29 @@ module MidiHex
|
|
1471
1560
|
end
|
1472
1561
|
r
|
1473
1562
|
end
|
1563
|
+
def self.resetRand
|
1564
|
+
@lastRandNote=false
|
1565
|
+
end
|
1566
|
+
def self.rndNote useScale=true
|
1567
|
+
key=rand(0x7f)
|
1568
|
+
key=self.note2key(@scalenotes.sample) if @scalenotes.size>0 && useScale
|
1569
|
+
if @downRandDummy && @lastRandNote
|
1570
|
+
key-=12 while key>@lastRandNote && key>12
|
1571
|
+
elsif ! @downRandDummy && @lastRandNote
|
1572
|
+
key+=12 while key<@lastRandNote && key<127-12
|
1573
|
+
end
|
1574
|
+
@lastRandNote=key
|
1575
|
+
key
|
1576
|
+
end
|
1474
1577
|
def self.dummyNote key,len,accent=false,sharp=0,swing=false
|
1475
1578
|
len+=len*self.getswing(swing)
|
1476
|
-
vel=@
|
1579
|
+
vel=@velocity
|
1477
1580
|
vel+=@accentPlus
|
1581
|
+
@downRandDummy=false
|
1478
1582
|
if key=="?"
|
1479
|
-
key=
|
1480
|
-
|
1583
|
+
key=rndNote
|
1584
|
+
elsif key=="O"
|
1585
|
+
@downRandDummy=true
|
1481
1586
|
end
|
1482
1587
|
key=@preNote.shift if @preNote.size>0
|
1483
1588
|
len=@preLength.shift if @preLength.size>0
|
@@ -1559,10 +1664,6 @@ module MidiHex
|
|
1559
1664
|
end
|
1560
1665
|
def self.chordName c,l=false,accent=false,sharp=0,swing=false
|
1561
1666
|
l+=l*self.getswing(swing)
|
1562
|
-
c=~/(.)([^(]*)(\((.*)\))?/
|
1563
|
-
root=$1
|
1564
|
-
type=$2
|
1565
|
-
subtype=$4
|
1566
1667
|
same=false
|
1567
1668
|
same=(@lastchordName==c) if @lastchordName
|
1568
1669
|
if same
|
@@ -1573,64 +1674,12 @@ module MidiHex
|
|
1573
1674
|
end
|
1574
1675
|
else
|
1575
1676
|
@lastchordName=c
|
1677
|
+
c=~/(.)([^(]*)(\((.*)\))?/
|
1678
|
+
root=$1
|
1679
|
+
type=$2
|
1680
|
+
subtype=$4
|
1576
1681
|
base=self.note2key(root)+sharp
|
1577
|
-
ten=
|
1578
|
-
case type
|
1579
|
-
when "power"
|
1580
|
-
ten+=[7]
|
1581
|
-
when "7"
|
1582
|
-
ten+=[4,7,10]
|
1583
|
-
when "m7"
|
1584
|
-
ten+=[3,7,10]
|
1585
|
-
when "maj7"
|
1586
|
-
ten+=[4,7,11]
|
1587
|
-
when "mmaj7"
|
1588
|
-
ten+=[3,7,11]
|
1589
|
-
when "maj" # no need
|
1590
|
-
ten+=[4,7]
|
1591
|
-
when "m"
|
1592
|
-
ten+=[3,7]
|
1593
|
-
when "6"
|
1594
|
-
ten+=[4,7,9]
|
1595
|
-
when "m6"
|
1596
|
-
ten+=[3,7,9]
|
1597
|
-
when "sus4"
|
1598
|
-
ten+=[5,7]
|
1599
|
-
when "aug" || "+"
|
1600
|
-
ten+=[4,8]
|
1601
|
-
when "dim"
|
1602
|
-
ten+=[3,6]
|
1603
|
-
when "dim7"
|
1604
|
-
ten+=[3,6,9]
|
1605
|
-
when ""
|
1606
|
-
ten+=[4,7]
|
1607
|
-
else
|
1608
|
-
STDERR.puts "unknown chord type? #{type}"
|
1609
|
-
end
|
1610
|
-
if subtype
|
1611
|
-
tention=subtype.split(',')
|
1612
|
-
tention.each{|i|
|
1613
|
-
case i
|
1614
|
-
when "+5"
|
1615
|
-
ten=ten-[7]+[8]
|
1616
|
-
when "-5"
|
1617
|
-
ten=ten-[7]+[6]
|
1618
|
-
when "9"||"add9"
|
1619
|
-
ten=ten+[14]
|
1620
|
-
when "+9"
|
1621
|
-
ten=ten+[15]
|
1622
|
-
when "-9"
|
1623
|
-
ten=ten+[13]
|
1624
|
-
when "+11"
|
1625
|
-
ten=ten+[6]
|
1626
|
-
when "13"
|
1627
|
-
ten=ten+[9]
|
1628
|
-
when "-13"
|
1629
|
-
ten=ten+[8]
|
1630
|
-
end
|
1631
|
-
}
|
1632
|
-
end
|
1633
|
-
ten=ten.sort
|
1682
|
+
ten=Chord.notes(type,subtype)
|
1634
1683
|
p "#{root} #{ten*','}" if $DEBUG
|
1635
1684
|
chord=ten.sort.map{|i|base+i}
|
1636
1685
|
chord=self.invert(@lastchord,chord)
|
@@ -1664,17 +1713,30 @@ module MidiHex
|
|
1664
1713
|
def self.chord c,l=false,accent=false,sharp=0,swing=false
|
1665
1714
|
l+=l*self.getswing(swing)
|
1666
1715
|
r=[]
|
1716
|
+
c=c.map{|i|i =~/^\?/ ? ["?"]*@multidummySize : i }.flatten
|
1667
1717
|
sspeed=@strokespeed
|
1668
1718
|
c=c.reverse if @strokeUpDown<0
|
1669
1719
|
span=c.size
|
1670
1720
|
sspeed=l/span/@strokefaster if span*sspeed>l/@strokefaster
|
1671
|
-
|
1721
|
+
tmp=[]
|
1722
|
+
ns=c.map{|i|
|
1723
|
+
case i
|
1724
|
+
when "?"
|
1725
|
+
i=self.rndNote
|
1726
|
+
i+=12 if tmp.member?(i)
|
1727
|
+
tmp<<i
|
1728
|
+
i
|
1729
|
+
else
|
1730
|
+
i
|
1731
|
+
end
|
1732
|
+
}
|
1733
|
+
ns.each{|i|
|
1672
1734
|
r+=self.soundOn(i,@velocity,@ch,sharp)
|
1673
1735
|
@waitingtime+=sspeed
|
1674
1736
|
}
|
1675
1737
|
l-=sspeed*(span-1)
|
1676
1738
|
@waitingtime,rest=self.byGate(l)
|
1677
|
-
|
1739
|
+
ns.each{|i|
|
1678
1740
|
r+=self.soundOff(i,@ch,sharp)
|
1679
1741
|
}
|
1680
1742
|
self.strokeUpDownReset
|
@@ -2017,13 +2079,28 @@ module MidiHex
|
|
2017
2079
|
end
|
2018
2080
|
# todo: use scale name
|
2019
2081
|
def self.scale s
|
2020
|
-
@scalenotes.reset
|
2021
2082
|
s=s.split(",")
|
2022
2083
|
first=s.first
|
2023
2084
|
mode=s[1]
|
2024
|
-
if
|
2085
|
+
if s.size==1
|
2086
|
+
case first
|
2087
|
+
when /^[-+]/
|
2088
|
+
shift=first.to_i
|
2089
|
+
@scalenotes=@scalenotes.move(shift)
|
2090
|
+
when /^:?(.)(.*)/
|
2091
|
+
@scalenotes.reset
|
2092
|
+
base=$1
|
2093
|
+
ten=Chord.type($2)
|
2094
|
+
ten.each{|i|
|
2095
|
+
note=Notes.get(base,i) # if i=~/^[-+]+[[:digit:]]+$/
|
2096
|
+
@scalenotes<<note
|
2097
|
+
}
|
2098
|
+
end
|
2099
|
+
elsif @scalenotes.keys.member?(:"#{mode}")
|
2100
|
+
@scalenotes.reset
|
2025
2101
|
@scalenotes.setmode(first,:"#{mode}")
|
2026
2102
|
else
|
2103
|
+
@scalenotes.reset
|
2027
2104
|
s.each{|i|
|
2028
2105
|
note=i
|
2029
2106
|
note=Notes.get(first,i) if i=~/^[-+]+[[:digit:]]+$/
|
@@ -2143,9 +2220,10 @@ module MidiHex
|
|
2143
2220
|
when "+"
|
2144
2221
|
@strokeUpDown=1
|
2145
2222
|
else
|
2146
|
-
s=s.to_i
|
2223
|
+
s=(s=~/\./ ? s.to_f : s.to_i)
|
2147
2224
|
@strokeUpDown= s<0 ? -1 : 1
|
2148
2225
|
@strokespeed=s.abs
|
2226
|
+
@strokespeed=(s.abs*@tbase).to_i if s.class==Float
|
2149
2227
|
end
|
2150
2228
|
end
|
2151
2229
|
def self.setTheremin flag
|
@@ -2264,8 +2342,16 @@ module MidiHex
|
|
2264
2342
|
STDERR.puts "register: no data"
|
2265
2343
|
end
|
2266
2344
|
end
|
2267
|
-
def self.setSwing k,v
|
2268
|
-
|
2345
|
+
def self.setSwing k,v,hs=@swingHash
|
2346
|
+
v=v.to_f
|
2347
|
+
k=~/of/
|
2348
|
+
if $&
|
2349
|
+
k,all=$`.to_i,$'.to_i
|
2350
|
+
hs[k]=v
|
2351
|
+
hs[all-k]=all-v
|
2352
|
+
else
|
2353
|
+
hs[k.to_i]=v
|
2354
|
+
end
|
2269
2355
|
end
|
2270
2356
|
def self.setRegister k,v
|
2271
2357
|
@registerHash[k.to_i]=v
|
@@ -2276,14 +2362,18 @@ module MidiHex
|
|
2276
2362
|
@basekeyCenter=@basekey
|
2277
2363
|
end
|
2278
2364
|
def self.dumpVar v
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2365
|
+
vars=self.instance_variables.map{|i|i.to_s[1..-1]}.sort
|
2366
|
+
s=v.split(',')
|
2367
|
+
s.each{|v|
|
2368
|
+
v=~/\A[[:alnum:]]+\z/
|
2369
|
+
if $& && vars.member?(v)
|
2370
|
+
puts "@#{v} #{eval("@#{v}")}"
|
2371
|
+
elsif v=="?"
|
2372
|
+
puts vars*", "
|
2373
|
+
else
|
2374
|
+
puts "bad name '#{v}'"
|
2375
|
+
end
|
2376
|
+
}
|
2287
2377
|
end
|
2288
2378
|
def self.key2bend k
|
2289
2379
|
v=k.class==Float ? @bendCent*(k-k.to_i) : 0
|
@@ -2406,7 +2496,7 @@ module MidiHex
|
|
2406
2496
|
case i
|
2407
2497
|
when /^\(setSwing:(.*)\)/
|
2408
2498
|
k,v=$1.split(',')
|
2409
|
-
|
2499
|
+
self.setSwing(k,v,swingHash)
|
2410
2500
|
res<<[:modifier,i]
|
2411
2501
|
when /^(\*)?([[:digit:].]+)(_([[:digit:]]+)j,)?/
|
2412
2502
|
tick=$1? $2.to_f : $2.to_f*tbase
|
@@ -2720,8 +2810,8 @@ module MidiHex
|
|
2720
2810
|
@h<<[:soundOn,i]
|
2721
2811
|
when /^\(off:(.*)\)/
|
2722
2812
|
@h<<[:soundOff,$1]
|
2723
|
-
when /^\(
|
2724
|
-
@h<<[:call,:scale,$
|
2813
|
+
when /^\(s(cale)?:(.*)\)/
|
2814
|
+
@h<<[:call,:scale,$2]
|
2725
2815
|
when /^\(gtune:(.*)\)/
|
2726
2816
|
@h<<[:call,:gtuning,$1]
|
2727
2817
|
when /^\(chordcenter:(.*)\)/
|
@@ -2793,11 +2883,17 @@ module MidiHex
|
|
2793
2883
|
end
|
2794
2884
|
when "r"
|
2795
2885
|
wait<<[:rest,i]
|
2796
|
-
when "o"
|
2886
|
+
when "o","O"
|
2797
2887
|
wait<<[:dummyNote,i]
|
2798
2888
|
when " "
|
2799
2889
|
when "?"
|
2800
2890
|
wait<<[:dummyNote,"?"]
|
2891
|
+
when "m"
|
2892
|
+
@h<<[:call,:resetRand]
|
2893
|
+
wait<<[:chord,["??"]]
|
2894
|
+
when "M"
|
2895
|
+
@h<<[:call,:resetRand]
|
2896
|
+
wait<<[:chord,["?O"]]
|
2801
2897
|
else
|
2802
2898
|
if @notes.keys.member?(i)
|
2803
2899
|
wait<<[:sound,i]
|
@@ -3047,7 +3143,7 @@ def funcApply m,name,x
|
|
3047
3143
|
r<<fbody
|
3048
3144
|
}
|
3049
3145
|
sep=""
|
3050
|
-
sep="(wait:#{interval})" if interval
|
3146
|
+
sep="(wait:#{interval})" if interval && interval.size>0
|
3051
3147
|
r*sep
|
3052
3148
|
end
|
3053
3149
|
def macroDef data
|
data/lib/smml/version.rb
CHANGED
data/tutorial_smml.md
CHANGED
@@ -173,7 +173,7 @@ cdim7
|
|
173
173
|
cpower
|
174
174
|
```
|
175
175
|
|
176
|
-
followed by
|
176
|
+
followed by tentions comma separated.
|
177
177
|
|
178
178
|
```
|
179
179
|
(+5)
|
@@ -186,6 +186,38 @@ followed by
|
|
186
186
|
(-13)
|
187
187
|
```
|
188
188
|
|
189
|
+
direct tention order by pre ':' with a half note distance number from chord base note.
|
190
|
+
|
191
|
+
```
|
192
|
+
(:1,:2,:3,+5)
|
193
|
+
```
|
194
|
+
|
195
|
+
in chord name, generally numbers don't mean chromatic distance. don't confuse.
|
196
|
+
easy way of counting distance number in chord is to count only white key ignoring black on a piano.
|
197
|
+
+5 means a sharp of 5th. if there is perfect 5th in the chord, 5th note will be deleted by '(+5)' because they don't appear together generally.
|
198
|
+
when you want to use abnormal tentions like conbination of these, direct order can be used like 'c7(:8)' on your own risk.
|
199
|
+
:8 expresses a note sharp of 5th by a half note expression. count all of the white and black key between c and g sharp on a piano.
|
200
|
+
|
201
|
+
|
202
|
+
for example,
|
203
|
+
list of chromatic scale expression is here, (when base note is 'c')
|
204
|
+
|
205
|
+
```
|
206
|
+
:0 c
|
207
|
+
:1 C
|
208
|
+
:2 d
|
209
|
+
:3 D
|
210
|
+
:4 e
|
211
|
+
:5 f
|
212
|
+
:6 F
|
213
|
+
:7 g
|
214
|
+
:8 G
|
215
|
+
:9 a
|
216
|
+
:10 A
|
217
|
+
:11 b
|
218
|
+
:12 c (next octave)
|
219
|
+
```
|
220
|
+
|
189
221
|
|
190
222
|
## tempo
|
191
223
|
;; most commands except note type ones, are inside parenthesis. set the tempo 120 bpm.
|
@@ -303,7 +335,7 @@ So '(p:guitar,2)' selects an instrument line '5 two' as the 2nd result of search
|
|
303
335
|
|
304
336
|
## track
|
305
337
|
;; in SMF, MIDI channel is 1 - 16, and drum is in 10 channel. but currently, these are automaticaly set.
|
306
|
-
;; you don't need to think about it. simply
|
338
|
+
;; you don't need to think about it. simply separate tracks with a command '|||'.
|
307
339
|
|
308
340
|
```
|
309
341
|
(p:piano) c d e f ||| (p:organ) e f g a ||| (p:guitar) g a b c
|
@@ -319,7 +351,7 @@ So '(p:guitar,2)' selects an instrument line '5 two' as the 2nd result of search
|
|
319
351
|
|
320
352
|
|
321
353
|
currenly track names are not used as default, and tracks continue with apprearing order. so if there are no data in some tracks in mid parts of pages,
|
322
|
-
use blank tracks by track
|
354
|
+
use blank tracks by track separaters.
|
323
355
|
|
324
356
|
```
|
325
357
|
c ;; track 1
|
@@ -344,7 +376,7 @@ first two tracks are 'organ' sound by the same track names declared.
|
|
344
376
|
|
345
377
|
|
346
378
|
## page
|
347
|
-
;; then
|
379
|
+
;; then separate pages by three or longer one line '/'.
|
348
380
|
;; but this command do not adjust time potisions. it simply resets track number increment.
|
349
381
|
|
350
382
|
```
|
@@ -361,7 +393,7 @@ first two tracks are 'organ' sound by the same track names declared.
|
|
361
393
|
cdef c2d2e2f2 c3def ||| efga e2f2g2a2 e3fga ||| gabc g2a2b2c2 g3abc
|
362
394
|
```
|
363
395
|
|
364
|
-
;; if you want to adjust tracks, use a blank page by two lines of page
|
396
|
+
;; if you want to adjust tracks, use a blank page by two lines of page separaters. the last three 'c' will be played adjusted instead each preceding note lengths are different.
|
365
397
|
|
366
398
|
```
|
367
399
|
cd ||| e ||| abcde
|
@@ -398,7 +430,7 @@ these are played like this.
|
|
398
430
|
```
|
399
431
|
|
400
432
|
;; same mark names 'm' in repeated section or one track will be automaticaly substituded by 'm m@2 m@3'. to adjust, use it in other tracks.
|
401
|
-
or use a comma as a
|
433
|
+
or use a comma as a separater of a name and a counter; '(mark:hoge@3)' = '(mark:hoge,3)'.
|
402
434
|
|
403
435
|
```
|
404
436
|
a b c (mark:m) a b c (mark:m@2) a b c (mark:m@3)
|
@@ -410,9 +442,10 @@ search MIDI format and set valid hex data.
|
|
410
442
|
|
411
443
|
```
|
412
444
|
&(00 00 00)
|
445
|
+
&(00,00,00)
|
413
446
|
```
|
414
447
|
|
415
|
-
hex data must be ``` 00 01 02 ... FD FE FF ```. one byte is by two hex letters.
|
448
|
+
hex data must be ``` 00 01 02 ... FD FE FF ```. one byte is by two hex letters. separaters are a blank or comma.
|
416
449
|
;; currently hex only can be used. oct/decimal may be able to use someday.
|
417
450
|
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.
|
418
451
|
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.
|
@@ -477,7 +510,7 @@ EFF:=(
|
|
477
510
|
```
|
478
511
|
|
479
512
|
after parenthesis, don't set any letters without blanks.
|
480
|
-
but now, this is for easy way of writing only, and may not be so useful. to use this multi line values, each line must be
|
513
|
+
but now, this is for easy way of writing only, and may not be so useful. to use this multi line values, each line must be separated.
|
481
514
|
|
482
515
|
```
|
483
516
|
$EFF[1] $EFF[2] $EFF[3] $EFF[4]
|
@@ -531,7 +564,7 @@ use parts split note hight, length, velocity, gate time, pre modifier; sound ele
|
|
531
564
|
```
|
532
565
|
|
533
566
|
the first value of each part will used for the first note 'a'. and so on.
|
534
|
-
inside parts, position is
|
567
|
+
inside parts, position is separated by ',' or use dummy value 'o'.
|
535
568
|
'(V:,,,60,,)' is '(V:ooo 60 oo)'. last dummy values can be omitted. in this case, 4th note 'd' velocity is set to 60.
|
536
569
|
if 6th note don't exist, pre modifier element values are simply ignored.
|
537
570
|
|
@@ -573,10 +606,13 @@ etc.
|
|
573
606
|
if a scale has been defined as below, random notes will be selected from its scale notes.
|
574
607
|
|
575
608
|
```
|
576
|
-
(scale:a,b,c,d,e)
|
577
|
-
(scale:a,+2,+3,+5,+7,+9,+11)
|
609
|
+
(scale:a,b,c,d,e) ;; series of note names
|
610
|
+
(scale:a,+2,+3,+5,+7,+9,+11) ;; first note and plus values to add to first note
|
611
|
+
(scale:+5) ;; shift all values from preceding scale. after above scale, this will be '(scale:d, ...)'.
|
612
|
+
(scale: :g7, ) ;; by chord name
|
578
613
|
```
|
579
614
|
|
615
|
+
shift value etc. is by a half tone.
|
580
616
|
still incompleted to use.
|
581
617
|
|
582
618
|
|
@@ -626,7 +662,7 @@ or like this.
|
|
626
662
|
```
|
627
663
|
|
628
664
|
## compile order
|
629
|
-
now compiling order is : page,track
|
665
|
+
now compiling order is : page,track separate => macro set and replace => repeat check => sound data make.
|
630
666
|
if there are bugs, error can appear by macro definitions appear in the last step 'sound data make' for example.
|
631
667
|
|
632
668
|
## D.S. al fine
|
@@ -654,8 +690,8 @@ dal segno jump mark.
|
|
654
690
|
|
655
691
|
if there is no followed number, 'abc' is repeated 2 times.
|
656
692
|
|
657
|
-
##
|
658
|
-
;; ';' can be used for one line data as line
|
693
|
+
## separater
|
694
|
+
;; ';' can be used for one line data as line separater.
|
659
695
|
|
660
696
|
```
|
661
697
|
$ smml -d "abc;def|||mc:=ggg;ccc$mc ddd" -o out.mid
|
@@ -756,7 +792,7 @@ set these modifiers before note commands.
|
|
756
792
|
(loadf:filename.mid,2)
|
757
793
|
```
|
758
794
|
|
759
|
-
load the second track data of filename.mid. when using it, the track must be itself only.
|
795
|
+
load the second track data of filename.mid. when using it, the track must be itself only. separate by '|||'.
|
760
796
|
this command do not check about track data strictly. be careful.
|
761
797
|
|
762
798
|
|
@@ -769,7 +805,7 @@ this command do not check about track data strictly. be careful.
|
|
769
805
|
now, note type commands are :
|
770
806
|
|
771
807
|
```
|
772
|
-
c ;; single note
|
808
|
+
c ;; single note 'c'
|
773
809
|
C ;; c sharp
|
774
810
|
(-)d ;; single note with flat/sharp/natural modifiers
|
775
811
|
{64} ;; single note by absolute note number
|
@@ -778,11 +814,14 @@ now, note type commands are :
|
|
778
814
|
{47,:0} ;; multi note. second note is by 12 series half tone notation
|
779
815
|
:cmaj7, ;; chord name
|
780
816
|
= ;; copy of the latest note type command
|
817
|
+
? ;; random note
|
818
|
+
o ;; dummy note ; use a random note if there is no substitution command
|
819
|
+
m ;; multi dummy note ; similiar to '{?,?,?}'
|
781
820
|
```
|
782
821
|
|
783
822
|
and other commands are with parentheses.
|
784
823
|
|
785
|
-
```~```
|
824
|
+
```~``` and ```w``` seem like note type, but it is compressed to preceding note as calculated note length. most commands cannot be set inside of ```'c~~~'.```
|
786
825
|
|
787
826
|
;; theremin like sound,
|
788
827
|
|
@@ -841,11 +880,20 @@ easy way to express fuzzy swing rythm.
|
|
841
880
|
|
842
881
|
```
|
843
882
|
/:a2b1/
|
844
|
-
(setSwing:2,2.4)(setSwing:1,0.6)/:a2,b1,/
|
845
|
-
(setSwing:2,1.8)(setSwing:1,1.2)/:a2,b1,/
|
883
|
+
(setSwing: 2, 2.4)(setSwing: 1, 0.6) /:a2,b1,/
|
884
|
+
(setSwing: 2, 1.8)(setSwing: 1, 1.2) /:a2,b1,/
|
846
885
|
```
|
886
|
+
series of ```ab``` ,
|
887
|
+
just 2:1, first longer, first shorter. rythm will be broken if setting part is wrong.
|
847
888
|
|
848
|
-
|
889
|
+
```
|
890
|
+
(setSwing: 2of3, 2.4)/:a2,b1,/
|
891
|
+
```
|
892
|
+
|
893
|
+
same as the second line of above. key value must be integer, not float.
|
894
|
+
'2of3' and '1of5' can be used at once, but rythm will not be what you predict.
|
895
|
+
value for 1of3 , set by rest of 2of3, is overwitten by 1of5.
|
896
|
+
there is no way to help it.
|
849
897
|
|
850
898
|
;; register of modifiers
|
851
899
|
|
@@ -895,7 +943,7 @@ text implement to MIDI file.
|
|
895
943
|
but now blanks are removed. someday maybe fixed ?
|
896
944
|
|
897
945
|
|
898
|
-
## test, debug etc.
|
946
|
+
## test, debug etc. for developers
|
899
947
|
|
900
948
|
```
|
901
949
|
(setInt: varName,10)
|
@@ -905,3 +953,17 @@ but now blanks are removed. someday maybe fixed ?
|
|
905
953
|
|
906
954
|
directly set local MidiHex variable, dump while compiling if the varName and value are valid.
|
907
955
|
|
956
|
+
# syntax implement policy:
|
957
|
+
|
958
|
+
|
959
|
+
parenthesis command is buil with (name:value,value,...). names often used are shorter, or leave it as it is as possible.
|
960
|
+
|
961
|
+
|
962
|
+
sound is modifier + note + length word.
|
963
|
+
|
964
|
+
|
965
|
+
let it not too complicated in sound part for visibility.
|
966
|
+
especially, for other words not to hide note type words.
|
967
|
+
|
968
|
+
|
969
|
+
many values in MIDI are 0-127, so values are integers except pre -/+ values that mean differences.
|
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.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tabasano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|