class Object
Public Instance Methods
hint()
click to toggle source
# File lib/smml/msm.rb, line 124 def hint hintminimum showsyntax end
hintminimum()
click to toggle source
# File lib/smml/msm.rb, line 16 def hintminimum cmd="smml" puts "Smml v#{version}" puts <<EOF usage: data to mid #{cmd} -d \"cdef gabc cbag rfed c4\" -o outfile.mid file to mid #{cmd} -i infile.txt -o outfile.mid show syntax #{cmd} -s for farther details, see tutorial_smml.md in gem EOF end
round(n=0)
click to toggle source
# File lib/smml/msm.rb, line 131 def round n=0 c=10**(n+1) f=(((self*c).to_i+5)/10).to_f/(10**n) n>0 ? f : f.to_i end
showsyntax()
click to toggle source
# File lib/smml/msm.rb, line 30 def showsyntax puts <<EOF syntax: ...( will be changed time after time) abcdefg =tone; capital letters are sharps. followed by number as length. +- =octave change r =rest >< =tempo up-down(percent) a4 =4 beats of note 'a'. in length words, integers or flout numbers can be used. a =one beat of note 'a'. default length equals 1 now. A*120 =120 ticks of note 'a #' (v:60) =velocity set to 60 (0-127) &(00 00) =set hex data directly. This can include ... '$delta(240)' for deltaTime data making '$se(F0 41 ..)' system exclusive to system exclusive message (p:11) =ProgramChange channel here, instrument 11 (p:organ) =ProgramChange channel here, instrument ?(search word like 'organ' from list if exist) map text must start with instrument number channel number can be used, but not recommended. '(p:0,11)' (key:-4) =transpose -4 except percussionSoundName like '_snare!' [...] =repeat 2 times for first time [...]3 =3 times of inside block [] /2:abcd/ =(triplet etc.) notes 'abcd' in 2 beats measure /:abc/ =triplet 'a''b''c' in one beat. /*120:abcd/ = notes 'abcd' in 120 ticks measure. now, default measure is 480 ticks per one beat. /:cd/ ~2e /:~fga/ =(tie) each length : c 0.5 d 0.5+2 e 1+0.25 f 0.25 g 0.25 a 0.25 after '~' length needed. if not length 1 is automaticaly inserted. 'c~~~' = 'c4' = = same note and length as the previous note. 'c2c2c2c2' = 'c2===' (tempo:120) =tempo set (ch:1) =set this track's channel 1 (cc:10,64) =controlChange number10 value 64. see SMF format. (pan:>64) =panpot right 64. ( pan:>0 set center ) (oct:2) =set octave 2 (bend:100) =pitch bend 100 (bendRange:12) =set bend range 12. default is normaly 2. (bendCent:on) =set bend value unit cent (half tone = 100). default is 'off' and value is between -8192 and +8192. '(bendCent:off)(bend:8192)' = '(bendCent:on)(bend:100)' (on:a) =note 'a' sound on only. take no ticks.; the event 'a' is the same as '(on:a)(wait:1)(off:a)'. (wait:1) =set waiting time 1 for next event (off:a) =note 'a' sound off (g:10) =set sound gate-rate 10% (staccato etc.) {64} =tone '64' by absolute tone number. ='(x:64)' {c,e,g} =multi tone. use similar way to tone 'a' etc. = '(on:c)(on:e)(on:g)(wait:1)(off:c)(off:e)(off:g)' :cmaj7, =use chord name. the first letter is tone name 'c'. so using capital one is with sharp. (stroke:4) =chord stroke interval ticks '4'. if '-4' down-up reversed. (V:o,o,110) =preceding modifier velocities. if next notes are 'abc' ,third tone 'c' is with velocity 110. a blank or 'o' mean default value. (G:,,-) =preceding modifier gate rates. if next notes are 'abc' ,third tone 'c' is with gate rate shorter. new preceding modifiers cancel old rest preceding values. ^ =accent ` =too fast note, play ahead ' =too late note, lay back (-)c =c flat (+)c =c sharp; equals 'C' (+2)c,(++)c =c double sharp (0)c =c natural (gm:on) (gs:reset) (xg:on) (syswait:) =when using '(gm:on)' etc., this command is needed for all other tracks to adjust wait-time. ||| = track separater /// = page separater series of page separaters insert unique '(mark:all track mark)' to allready running tracks automaticaly. (mark:posname) =position name for adjustment of tracks after long rest etc. .DC .DS .toCODA .CODA .FINE =coda mark etc. .SKIP =skip mark on over second time .$ =DS point _snare! =percussion sound ( search word like 'snare' (can use tone number) from percussion list if exist ) similarly, _s!=snare, k:bassKick, o:openHighHat, c:closedHighHat, cc:CrachCymbal, h:highTom, l:lowTom as default. map text personaly you set must start with tone number. (loadf:filename.mid,2) =load filename.mid, track 2. Track must be this only and separated by '|||'. W:=abc =macro definition. One Charactor macro can be used. use prefix '$' for refering. macro W:=abc =macro definition. fn(x):=ab$x =macro with args. in this case, '$fn(10)' is substituded by 'ab10'. similarly, '$fn(:10,20,30)' = 'ab10ab20ab30'. '$fn(4:10,20,30)' = 'ab10(wait:4)ab20(wait:4)ab30'. compile order is : page,track separate => macro set and replace => repeat check => sound data make ; =separater. same to a new line blank =ignored ;; comment =ignored after ';;' of each line ;;;;;; =start mark of multi-line comment. end mark is same or longer mark of ';;'. these must start from the top of line. basicaly, one sound is a tone command followed by length number. now, tone type commands are : 'c' => single note '(-)d' => single note with flat/sharp modifier '{64}' => single note by absolute note number '_snare!' => drum note by instrument name '{d,g,-b}' => multi note ':cmaj7,' => chord name and other commands are with parentheses. for more details, see tutorial_smml.md EOF end
version()
click to toggle source
as gem or this file only
# File lib/smml/msm.rb, line 9 def version if defined?(Smml) && ( Smml.constants.member?("VERSION") || Smml.constants.member?(:VERSION) ) Smml::VERSION else File.mtime(__FILE__).strftime("%Y-%m-%d") end end