smml 0.1.2.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/smml +8 -4
  3. data/lib/smml/msm.rb +41 -13
  4. data/lib/smml/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f74a9766abd50fb796e9df2a78d248b23005f6e
4
- data.tar.gz: 0210dcb9aa9e45746f97c03b33d47da43d28065c
3
+ metadata.gz: a729ae19582944c975ae13ebf91da26892d6a45d
4
+ data.tar.gz: c0c49b883cd80909160385613ec563c86d181c74
5
5
  SHA512:
6
- metadata.gz: 2758b65b3eed4fc493e623d5e6ccbb0650b4a0ce408d767e29ff7dd47a5427c16cc7870a97bc63aee1eee6a1f8176b30418341eece1db314a7864d38325a2aae
7
- data.tar.gz: 92efb48db8b72f629556a4bd6c633d45b8d3beb528150760ace8dad285a7426f76d9ca84a846e08bdfb642c2e3f382da3c40a10afcd63049c318703610740197
6
+ metadata.gz: b3a68fe184996d7995a6dd5146efdca24237e62061f432713b7ed3a602df484d662a1b37bac4dd7421b485554f9c50a7fb5b7eca0d75a07f8b35d6d32bd2b871
7
+ data.tar.gz: 9519e4fa0758a35d23ffc80a1f556b80989ad04e9b504e5dbd797dab1cbe094c4c0afd49fc24471054c9d48d72d7afe1883f088a8f1c626d7816f115ee0f6dd3
data/bin/smml CHANGED
@@ -15,6 +15,7 @@ outfile=false
15
15
  expfile=false
16
16
  vfuzzy=2
17
17
  autopan=true
18
+ strictmode=false
18
19
  velocity=0x40
19
20
  $debuglevel=1
20
21
  data=""
@@ -45,8 +46,7 @@ opt.on('-p pspl',"page split chars") {|v| pspl=v }
45
46
  opt.on('-F i',"fuzzy shift mode") {|v| $fuzzy=v.to_i }
46
47
  opt.on('-v i',"velocity fuzzy value [default 2]") {|v| vfuzzy=v.to_i }
47
48
  opt.on('-V',"dont use all fuzzy or auto feature") {|v|
48
- vfuzzy=0
49
- autopan=false
49
+ strictmode=true
50
50
  }
51
51
  opt.on('-O',"octave legacy mode") {|v| octaveMode=:far }
52
52
  opt.on('-I',"ignore roland check sum") {|v| $ignoreChecksum=v }
@@ -62,7 +62,11 @@ m.data=data
62
62
  m.velocity=velocity
63
63
  m.bpm=bpm
64
64
  m.octave=octaveMode
65
- m.vfuzzy=vfuzzy
66
- m.autopan=autopan
65
+ if strictmode
66
+ m.strict if strictmode
67
+ else
68
+ m.vfuzzy=vfuzzy
69
+ m.autopan=autopan
70
+ end
67
71
  m.make($test,$fuzzy)
68
72
  m.save if not $testonly
data/lib/smml/msm.rb CHANGED
@@ -823,9 +823,11 @@ def guitarTuning
823
823
  end
824
824
  module MidiHex
825
825
  # 設定のため最初に呼ばなければならない
826
- def self.prepare bpm=120,tbase=480,vel=0x40,oct=:near,vfuzzy=2
826
+ def self.prepare bpm=120,tbase=480,vel=0x40,oct=:near,vfuzzy=2,strict=false
827
827
  @ready=true
828
- @autopan=true
828
+ @strictmode=strict
829
+ @autopan= strict ? false : true
830
+ @strokefaster= strict ? 1 : 3
829
831
  @startBpm=bpm
830
832
  @midiname=false
831
833
  @cmark="#"
@@ -925,6 +927,7 @@ module MidiHex
925
927
  def self.trackPrepare tc=0
926
928
  @tbase,@ch,@velocity,@velocityFuzzy,@basekey,@gateRate,@bendrange,@bendCent,@scalenotes,@gtune=@prepareSet
927
929
  @strokespeed=0
930
+ @strokeUpDown=1
928
931
  @preGate=[]
929
932
  @preVelocity=[]
930
933
  @preNote=[]
@@ -1198,9 +1201,9 @@ module MidiHex
1198
1201
  def self.chord c,l=false,accent=false,sharp=0
1199
1202
  r=[]
1200
1203
  sspeed=@strokespeed
1201
- (c=c.reverse;sspeed=-sspeed) if sspeed<0
1204
+ c=c.reverse if @strokeUpDown<0
1202
1205
  span=c.size
1203
- sspeed=l/span if span*sspeed>l
1206
+ sspeed=l/span/@strokefaster if span*sspeed>l/@strokefaster
1204
1207
  c.each{|i|
1205
1208
  r+=self.soundOn(i,@velocity,@ch,sharp)
1206
1209
  @waitingtime+=sspeed
@@ -1210,9 +1213,13 @@ module MidiHex
1210
1213
  c.each{|i|
1211
1214
  r+=self.soundOff(i,@ch,sharp)
1212
1215
  }
1216
+ self.strokeUpDownReset
1213
1217
  r+=self.rest(rest) if rest>0
1214
1218
  r
1215
1219
  end
1220
+ def self.strokeUpDownReset
1221
+ @strokeUpDown=1
1222
+ end
1216
1223
  def self.rest len=@tbase,ch=@ch
1217
1224
  chx=format("%01x",ch)
1218
1225
  @nowtime+=len
@@ -1491,7 +1498,6 @@ module MidiHex
1491
1498
  end
1492
1499
  def self.gtuning s
1493
1500
  @gtune=s.split(",")
1494
- p @gtune
1495
1501
  end
1496
1502
  def self.preLength v
1497
1503
  @preLength=v.map{|i|
@@ -1575,8 +1581,16 @@ p @gtune
1575
1581
  end
1576
1582
  end
1577
1583
  def self.strokeSpeed s
1578
- s=s.to_i
1579
- @strokespeed=s
1584
+ case s
1585
+ when "-"
1586
+ @strokeUpDown=-1
1587
+ when "+"
1588
+ @strokeUpDown=1
1589
+ else
1590
+ s=s.to_i
1591
+ @strokeUpDown= s<0 ? -1 : 1
1592
+ @strokespeed=s.abs
1593
+ end
1580
1594
  end
1581
1595
  def self.setmark m
1582
1596
  n=@marktrack.getcount(m,@tracknum)
@@ -1897,7 +1911,7 @@ p @gtune
1897
1911
  end
1898
1912
  @bpm=@bpm*rate
1899
1913
  @h<<[:tempo,@bpm]
1900
- when /([-+])([[:digit:]]+)?/
1914
+ when /^([-+])([[:digit:]]+)?/
1901
1915
  plus=$1
1902
1916
  num=$2 ? $2.to_i : 1
1903
1917
  @h<<[:call,:basekeySet,plus,num]
@@ -2080,7 +2094,7 @@ def multiplet d,tbase
2080
2094
  else
2081
2095
  total=tbase*rate
2082
2096
  end
2083
- r=i.scan(/=|\(\?:[^\]]+\)|\(x:[^\]]+\)|\(chord:[^)]+\)|\(C:[^)]+\)|:[^\(,]+\([^\)]+\),|:[^,]+,|[[:digit:]\.]+|_[^!]+!|~|\([-+]*[[:digit:]]?\)|[-+]+[[:digit:]]*|[\^`'<>]|./)
2097
+ r=i.scan(/=|\(\?:[^\]]+\)|\(x:[^\]]+\)|\(chord:[^)]+\)|\(C:[^)]+\)|:[^\(,]+\([^\)]+\),|:[^,]+,|[[:digit:]\.]+|_[^!]+!|~|\([-+]*[[:digit:]]?\)|[-+]+[[:digit:]]*|[\^`'<>]|\([^\)]*\)|./)
2084
2098
  lengths=[]
2085
2099
  notes=[]
2086
2100
  mod=[]
@@ -2098,6 +2112,8 @@ def multiplet d,tbase
2098
2112
  when /^[[:digit:]]+/
2099
2113
  lengths[-1]*=i.to_f
2100
2114
  when " "
2115
+ when /^\([^\)]*\)/
2116
+ mod<<i
2101
2117
  else
2102
2118
  lengths<<1
2103
2119
  notes<<"#{mod*""}#{i}"
@@ -2269,6 +2285,7 @@ def tie d,tbase
2269
2285
  line
2270
2286
  end
2271
2287
  # repeat block analysis: no relation with MIDI format
2288
+ # '(:..)' => '(lastcmd:..)'
2272
2289
  def repCalc line,macro,tbase
2273
2290
  rpt=/\[([^\[\]]*)\] *([[:digit:]]+)/
2274
2291
  line.gsub!(rpt){$1*$2.to_i} while line=~rpt
@@ -2284,17 +2301,18 @@ def repCalc line,macro,tbase
2284
2301
  r ? r : b
2285
2302
  end
2286
2303
  }*""
2287
- a=line.scan(/\/[^\/]+\/|\[|\]|\.FINE|\.DS|\.DC|\.\$|\.toCODA|\.CODA|\.SKIP|\$\{[^ \{\}]+\}|\$[^ ;\$_*^,\)\(`'\/+-]+|\([^\)]*:|\)|./)
2304
+ regex=/\/[^\/]+\/|\[|\]|\.FINE|\.DS|\.DC|\.\$|\.toCODA|\.CODA|\.SKIP|\$\{[^ \{\}]+\}|\$[^ ;\$_*^,\)\(`'\/+-]+|\([^\)]*:|\)|./
2305
+ a=line.scan(regex)
2288
2306
  a=a.map{|i|
2289
2307
  if i=~/^\/[^\/]+\//
2290
2308
  if i=~/\$/
2291
2309
  i=i.gsub(/\$\{([^ ;\$_*^,\)\(`'\/+-]+)\}/){macro[$1]}.gsub(/\$([^ ;\$_*^,\)\(`'\/+-]+)/){macro[$1]}
2292
2310
  end
2293
- multiplet(i,tbase)
2311
+ multiplet(i,tbase).scan(regex)
2294
2312
  else
2295
2313
  i
2296
2314
  end
2297
- }
2315
+ }.flatten
2298
2316
  hs={}
2299
2317
  a.each_with_index{|d,i|hs[i]=d}
2300
2318
  hs=hs.invert
@@ -2351,6 +2369,10 @@ def repCalc line,macro,tbase
2351
2369
  pointDS=countertmp
2352
2370
  when ";"
2353
2371
  current=""
2372
+ when /^\(([^\)]+):$/
2373
+ lastcmd=$1 if $1 != "C"
2374
+ when "(:"
2375
+ current="(#{lastcmd}:"
2354
2376
  else
2355
2377
  current
2356
2378
  end
@@ -2426,6 +2448,12 @@ class Smml
2426
2448
  @octave=:near
2427
2449
  @vfuzzy=2
2428
2450
  @autopan=true
2451
+ @strictmode=false
2452
+ end
2453
+ def strict
2454
+ @autopan=false
2455
+ @vfuzzy=0
2456
+ @strictmode=true
2429
2457
  end
2430
2458
  def self.syntax
2431
2459
  hintminimum
@@ -2443,7 +2471,7 @@ class Smml
2443
2471
  puts @mx.percussionList.select{|i|i=~/#{k}/i}
2444
2472
  end
2445
2473
  def init test,fz
2446
- @mx.prepare(@bpm,@tbase,@velocity,@octave,@vfuzzy)
2474
+ @mx.prepare(@bpm,@tbase,@velocity,@octave,@vfuzzy,@strictmode)
2447
2475
  @mx.setfile(@infile)
2448
2476
  @mx.setmidiname(@outfile) if @outfile
2449
2477
  @mx.setdata(@data) if ! @mx.getdata
data/lib/smml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Smml
2
- VERSION = "0.1.2.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tabasano