smml 0.0.2.3 → 0.1.0

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: bcdb4cdf683202fd9ce136fe9bb0bd3b9dee193c
4
- data.tar.gz: 9a25de640dc26ec8f16939926de7cebaaeccdcf4
3
+ metadata.gz: e8aa416af4560085821e2b1a7ed3e57434639602
4
+ data.tar.gz: cb0b869acdc8c4b173cbab84b99487e41bd3cf92
5
5
  SHA512:
6
- metadata.gz: eefd12ba06b4d3b1070d8d81523b1d7d3dbb52926c05c6708d7045110927a8b1b8b280d411d60dc6ac914a91296470f769564ff0ce5c29a1d261edca7dc2cb08
7
- data.tar.gz: 7c034b35c71bf8965d5cb9dae4296206e8f1fe7f9ee3b2d91638c0cedf6acfe0ba74a90e83396d51708f3daa62cc32aaad086504082bf8a6988adbb4b7b8d999
6
+ metadata.gz: 82b264a3f12b49a27049d9eee0f43ce72a0d510ba61a95ee4fc00185c8e4279a37c876594358e6e47cc57c96d779f6ad18de0d9de5c7083c4262cc99dcb3b705
7
+ data.tar.gz: 496db22b2ff32c0ade3dc275cc93362b1ff6e4f35f28e04e910a8d4d8d716320266b5fa3038fe297d7baefc6262eff6f5013ad6625d777874c0f0c783cf592ba
data/bin/smml ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/ruby
2
+ # -*- encoding: utf-8 -*-
3
+ require 'kconv'
4
+ require 'optparse'
5
+
6
+ # gem
7
+ begin
8
+ require'./lib/smml/msm'
9
+ rescue LoadError
10
+ require'smml'
11
+ p Smml::VERSION
12
+ end
13
+
14
+ infile=false
15
+ outfile=false
16
+ expfile=false
17
+ vfuzzy=2
18
+ autopan=true
19
+ velocity=0x40
20
+ $debuglevel=1
21
+ data=""
22
+ pspl="///"
23
+ cmark=";;"
24
+ bpm=120
25
+ tbase=480 # division
26
+ octaveMode=:near
27
+
28
+ opt = OptionParser.new
29
+ opt.on('-i file',"input file") {|v| infile=v }
30
+ opt.on('-o file',"output file") {|v| outfile=v }
31
+ opt.on('-e file',"write down macro etc. expanded data") {|v| expfile=v }
32
+ opt.on('-d d',"input data string") {|v|
33
+ data=v
34
+ STDERR.puts data if $DEBUG
35
+ }
36
+ opt.on('-D',"debug") {|v| $DEBUG=v }
37
+ opt.on('-s',"show syntax") {|v|
38
+ hint
39
+ exit
40
+ }
41
+ opt.on('-t b',"bpm") {|v| bpm=v.to_f }
42
+ opt.on('-T w',"programChange test like instrument name '...'") {|v| $test=v }
43
+ opt.on('-c d',"cycle data for test mode") {|v| $testdata=v }
44
+ opt.on('-C d',"comment mark") {|v| cmark=v; puts "comment mark is '#{cmark}'" }
45
+ opt.on('-p pspl',"page split chars") {|v| pspl=v }
46
+ opt.on('-F i',"fuzzy shift mode") {|v| $fuzzy=v.to_i }
47
+ opt.on('-v i',"velocity fuzzy value [default 2]") {|v| vfuzzy=v.to_i }
48
+ opt.on('-V',"dont use all fuzzy or auto feature") {|v|
49
+ vfuzzy=0
50
+ autopan=false
51
+ }
52
+ opt.on('-O',"octave legacy mode") {|v| octaveMode=:far }
53
+ opt.on('-I',"ignore roland check sum") {|v| $ignoreChecksum=v }
54
+ opt.on('-M i',"debug level") {|v| $debuglevel=v.to_i }
55
+ opt.on('-m i',"mode of test/ 1:GM 2:XG 3:GS") {|v| $testmode=v.to_i }
56
+ opt.on('-n',"test only (dont write outfile)") {|v| $testonly=true }
57
+ opt.parse!(ARGV)
58
+
59
+ mtr=MmlTracks.new(tbase,pspl,expfile,cmark)
60
+ mtr.infile=infile
61
+ mtr.outfile=outfile
62
+ mtr.data=data
63
+ mtr.velocity=velocity
64
+ mtr.bpm=bpm
65
+ mtr.octave=octaveMode
66
+ mtr.vfuzzy=vfuzzy
67
+ mtr.autopan=autopan
68
+ mtr.make($test,$fuzzy)
69
+ mtr.save if not $testonly
data/bin/ssmml ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/ruby
2
+ # -*- encoding: utf-8 -*-
3
+ require 'kconv'
4
+ require 'optparse'
5
+
6
+ # gem
7
+ begin
8
+ require'./lib/smml/msm'
9
+ rescue LoadError
10
+ require'smml'
11
+ p Smml::VERSION
12
+ end
13
+
14
+ infile="infile.mml"
15
+ outfile="mml.mid"
16
+ data=""
17
+
18
+ opt = OptionParser.new
19
+ opt.on('-i file',"input file") {|v| infile=v }
20
+ opt.on('-o file',"output file") {|v| outfile=v }
21
+ opt.on('-d d',"input data string") {|v| data=v }
22
+ opt.parse!(ARGV)
23
+
24
+ mtr=MmlTracks.new
25
+ mtr.compile(infile,outfile,data)
data/lib/smml/msm.rb CHANGED
@@ -647,7 +647,8 @@ class MarkTrack
647
647
  end
648
648
  module MidiHex
649
649
  # 設定のため最初に呼ばなければならない
650
- def self.prepare bpm,tbase=480,vel=0x40,oct=:near,vfuzzy=2
650
+ def self.prepare bpm=120,tbase=480,vel=0x40,oct=:near,vfuzzy=2
651
+ @ready=true
651
652
  @autopan=true
652
653
  @startBpm=bpm
653
654
  @midiname=false
@@ -1213,6 +1214,14 @@ module MidiHex
1213
1214
  puts "no percussion name like '#{p}' in list" if $DEBUG && r.size==0
1214
1215
  r.size>0 ? r[0][0] : @snare
1215
1216
  end
1217
+ def self.percussionList
1218
+ self.prepare if not @ready
1219
+ @percussionList.map{|i,v|"#{i} #{v}"}
1220
+ end
1221
+ def self.programList
1222
+ self.prepare if not @ready
1223
+ @programList.map{|i,v|"#{i} #{v}"}
1224
+ end
1216
1225
  def self.bend pos,depth,ch=false
1217
1226
  ch=@ch if ! ch
1218
1227
  depth=(depth*@bendCent).to_i
@@ -2210,6 +2219,18 @@ class MmlTracks
2210
2219
  @vfuzzy=2
2211
2220
  @autopan=true
2212
2221
  end
2222
+ def pmap
2223
+ puts @mx.programList
2224
+ end
2225
+ def dmap
2226
+ puts @mx.percussionList
2227
+ end
2228
+ def psearch k
2229
+ puts @mx.programList.select{|i|i=~/#{k}/i}
2230
+ end
2231
+ def dsearch k
2232
+ puts @mx.percussionList.select{|i|i=~/#{k}/i}
2233
+ end
2213
2234
  def init test,fz
2214
2235
  @mx.prepare(@bpm,@tbase,@velocity,@octave,@vfuzzy)
2215
2236
  @mx.setfile(@infile)
data/lib/smml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Smml
2
- VERSION = "0.0.2.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/smml.gemspec CHANGED
@@ -13,7 +13,7 @@ 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/*")+["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"]+["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
19
  spec.extra_rdoc_files =%w[README_smml.md LICENSE.txt]
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.0.2.3
4
+ version: 0.1.0
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-21 00:00:00.000000000 Z
11
+ date: 2014-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -41,7 +41,9 @@ dependencies:
41
41
  description: compile a Music Macro Language file to a Standard MIDI file.
42
42
  email:
43
43
  - pianotoieba+smml@gmail.com
44
- executables: []
44
+ executables:
45
+ - smml
46
+ - ssmml
45
47
  extensions: []
46
48
  extra_rdoc_files:
47
49
  - README_smml.md
@@ -52,6 +54,8 @@ files:
52
54
  - lib/smml/midi-programChange-list.txt
53
55
  - lib/smml/msm.rb
54
56
  - lib/smml/version.rb
57
+ - bin/smml
58
+ - bin/ssmml
55
59
  - Gemfile
56
60
  - Rakefile
57
61
  - LICENSE.txt