Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sh = require('shell')
- local fs = require('filesystem')
- local args, opts = sh.parse( ... )
- local note = require('note')
- -- version 1
- local infile = io.open(sh.resolve(args[1]), "r")
- local outfile = fs.open(sh.resolve(args[2]), "wb")
- local dict = {['c']= 118,
- ['S']= 100,
- ['a']= 130,
- ['d']= 131,
- ['s']= 132,
- ['r']= 133,
- ['v']= 155,
- ['i']= 144,
- ['G']= 0,
- ['R']= 2,
- ['N']= 3,
- ['B']= 4 }
- local dict2 = {['R']=2, ['N']=3, ['B']=4}
- for line in infile:lines() do
- print(line)
- for command in string.gmatch(line, "([^ ]+)") do
- for wor, defin in pairs(dict) do
- if string.sub(command, 1, 1) == wor then
- print('benis')
- outfile:write(string.pack("<B", defin))
- if not dict2[wor] then
- outfile:write(string.pack("<I1", tonumber(string.sub(command, 2))))
- else
- outfile:write(string.pack("<I1",note.midi(string.sub(command, 2))))
- end
- end
- end
- end
- end
- for i=1,16 do
- outfile:write("<B", 127)
- end
- infile:close()
- outfile:close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement