File tree Expand file tree Collapse file tree 2 files changed +96
-90
lines changed Expand file tree Collapse file tree 2 files changed +96
-90
lines changed Original file line number Diff line number Diff line change 1- # MIDI Parser for Garry's Mod Lua
2-
3- ** It is not perfect!!** Use it for just experiment.
4- This is a GLua fork of [ Lua_midiParser] ( https://github.com/FMS-Cat/Lua_midiParser ) .
5-
6- ## Usage
7-
8- ``` lua
9- -- Will attempt to parse "garrysmod/data/abcdef.mid" file
10- myMidi = midiParser ( " abcdef.mid" )
11-
12- -- Will attempt to parse "garrysmod/lua/test.mid" file
13- testingMidi = midiParser ( " test.mid" , " LUA" )
14- ```
15-
16- ## Return sample
17-
18- ``` Lua
19- {
20- format = 1 ,
21- timebase = 96 ,
22- tracks = {
23- {
24- messages = {
25- {
26- time = 0 ,
27- type = " meta" ,
28- meta = " Time Signature" ,
29- signature = { 4 , 2 , 24 , 8 }
30- },
31- {
32- time = 0 ,
33- type = " meta" ,
34- meta = " End of Track"
35- }
36- }
37- },
38- {
39- messages = {
40- {
41- time = 0 ,
42- type = " meta" ,
43- meta = " Set Tempo" ,
44- tempo = 468375
45- },
46- {
47- time = 0 ,
48- type = " meta" ,
49- meta = " End of Track"
50- }
51- }
52- },
53- {
54- name = " TrackName" ,
55- messages = {
56- {
57- time = 0 ,
58- type = " meta" ,
59- meta = " Track Name" ,
60- text = " TrackName"
61- },
62- {
63- time = 0 ,
64- type = " on" ,
65- channel = 0 ,
66- number = 48 ,
67- velocity = 100
68- },
69- {
70- time = 96 ,
71- type = " off" ,
72- channel = 0 ,
73- number = 48 ,
74- velocity = 64
75- },
76- {
77- time = 0 ,
78- type = " meta" ,
79- meta = " End of Track"
80- }
81- }
82- }
83- }
84- }
85- ```
86-
87- ## License
88-
89- MIT
1+ # MIDI Parser for Garry's Mod Lua
2+
3+ ** It is not perfect** ! Use it for just experiment.
4+ This is a GLua fork of [ Lua_midiParser] ( https://github.com/FMS-Cat/Lua_midiParser ) .
5+
6+ ## Usage
7+
8+ ``` lua
9+ -- Will attempt to parse "garrysmod/data/abcdef.mid" file
10+ myMidi = midiParser ( " abcdef.mid" ) -- if path is omitted, it defaults to "DATA"
11+
12+ -- Will attempt to parse "garrysmod/lua/test.mid" file
13+ testingMidi = midiParser ( " test.mid" , " LUA" )
14+
15+ -- Prints the contents of testingMidi table:
16+ PrintTable ( testingMidi )
17+ ```
18+
19+ ## Return sample
20+
21+ ``` lua
22+ {
23+ format = 1 ,
24+ timebase = 96 ,
25+ tracks = {
26+ {
27+ messages = {
28+ {
29+ time = 0 ,
30+ type = " meta" ,
31+ meta = " Time Signature" ,
32+ signature = { 4 , 2 , 24 , 8 }
33+ },
34+ {
35+ time = 0 ,
36+ type = " meta" ,
37+ meta = " End of Track"
38+ }
39+ }
40+ },
41+ {
42+ messages = {
43+ {
44+ time = 0 ,
45+ type = " meta" ,
46+ meta = " Set Tempo" ,
47+ tempo = 468375
48+ },
49+ {
50+ time = 0 ,
51+ type = " meta" ,
52+ meta = " End of Track"
53+ }
54+ }
55+ },
56+ {
57+ name = " TrackName" ,
58+ messages = {
59+ {
60+ time = 0 ,
61+ type = " meta" ,
62+ meta = " Track Name" ,
63+ text = " TrackName"
64+ },
65+ {
66+ time = 0 ,
67+ type = " on" ,
68+ channel = 0 ,
69+ number = 48 ,
70+ velocity = 100
71+ },
72+ {
73+ time = 96 ,
74+ type = " off" ,
75+ channel = 0 ,
76+ number = 48 ,
77+ velocity = 64
78+ },
79+ {
80+ time = 0 ,
81+ type = " meta" ,
82+ meta = " End of Track"
83+ }
84+ }
85+ }
86+ }
87+ }
88+ ```
89+
90+ ## License
91+
92+ MIT
Original file line number Diff line number Diff line change @@ -4,7 +4,10 @@ midi = midiParser( fileName[, path="DATA"] )
44
55-- EXAMPLE --
66myMidi = midiParser( "abcdef.mid" ) -- Will attempt to parse "garrysmod/data/abcdef.mid" file
7- myMidi = midiParser( "test.mid", "LUA" ) -- Will attempt to parse "garrysmod/lua/test.mid" file
7+
8+ testingMidi = midiParser( "test.mid", "LUA" ) -- Will attempt to parse "garrysmod/lua/test.mid" file
9+
10+ PrintTable( testingMidi ) -- Prints the contents of testingMidi table
811-------------------------------------------------------------------------------------------------]]
912
1013_G .midiParser = function ( fileName , path )
You can’t perform that action at this time.
0 commit comments