lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


没想到Lua list里也有同胞啊。呵呵



2010/9/14 江云帆 <jyf1987@gmail.com>
cool, i have tried smidi , but thats for pys60


On Tue, Sep 14, 2010 at 9:10 AM, <pj@pjb.com.au> wrote:
Greetings,

Another module: http://www.pjb.com.au/comp/lua/MIDI.lua
doc homepage:   http://www.pjb.com.au/comp/lua/MIDI.html
test script:    http://www.pjb.com.au/comp/lua/test_mi.lua
version:        3.7

MIDI.lua - for Reading, writing and manipulating MIDI data
translates the MIDI data into Lua variables and back, e.g.

 local MIDI = require 'MIDI'
 local my_score = {
   96,  -- ticks per beat
   {    -- first track
      {'patch_change', 0, 1, 11}, -- vibraphone on channel 1
      {'set_tempo', 0, 750000},   -- microseconds per beat
      {'note', 5, 96, 1, 25, 100},
      {'note', 101, 96, 1, 29, 100},
   },  -- end of first track
 }
 local f = assert(io.open('f.mid','wb'))
 f:write(MIDI.score2midi(my_score))
 f:close()

and, aside from offering this low-level access, also offers a
number of different functions to perform common manipulations.

It's a translation into Lua of my Python module:
 http://www.pjb.com.au/midi/MIDI.html
 http://www.pjb.com.au/midi/free/MIDI.py
which is the basis of my midisox program, which already has a
Perl version, and may soon get a Lua version...

( Translating is a process which I find really instructive; plus
 I really like having compatible calling-interfaces to my most-
 -needed-stuff in different languages; also the resulting study
 of the code and the new test-scripts finds and fixes lots of
 little bugs that no-one seems to spot otherwise. )

May it be useful,  let me know of problems,
Peter Billam

http://www.pjb.com.au       pj@pjb.com.au      (03) 6278 9410
"Was der Meister nicht kann,   vermöcht es der Knabe, hätt er
 ihm immer gehorcht?"   Siegfried to Mime, from Act 1 Scene 2





--
welcom to gtalk me
http://hi.baidu.com/jyf1987



--
Zark Yoc