pedroalvesv / luamidi Goto Github PK
View Code? Open in Web Editor NEWLuaMidi ♫ is the pure Lua library to reading and writing MIDI files, with friendly API.
License: MIT License
LuaMidi ♫ is the pure Lua library to reading and writing MIDI files, with friendly API.
License: MIT License
It would be great to include a way to easily calculate at what time events are placed instead of deltatime.
Is there a way to do it?
Example program:
local LuaMidi = require ('LuaMidi');
local tracks = LuaMidi.get_MIDI_tracks("tetris.midi");
events = tracks[2]["events"]
for i=2, #events do
console.log(events[i]:get_duration()); --no return value
end
On line 147 of LuaMidi.lua, the event table created for the new NoteEvent doesn't have duration information. I gave a look at raw_note myself but it was tough to determine how to find a duration from that.
I take it what needs to happen is looking at the difference between a NoteOn and NoteOff event, but I'm not familiar enough with the MIDI spec or how the data is being digested to really discern how to figure that information out.
Crashed because of missing META_PREFIX_PORT event.
I added it to the CONSTANTS:
META_CUE_POINT = 0x07,
META_PREFIX_PORT = 0x21,
META_TEMPO_ID = 0x51,
META_TIME_SIGNATURE_ID = 0x58,
and
[33]="Prefix Port", [81] = "Tempo",[88] = "Time Signature",[89] = "Key Signature"}
and it moved past that point, but crashed soon thereafter.
Unfortunately, I can't find a good tool to view the actual MIDI file contents and I haven't had time to dig through your code, so I can't offer a suggestion as to what went wrong next.
Hello, do you have any more sample files(just like a whole song)? I want to explore a better writing scheme. If not, I can build one for this project.
I'm using Lua 5.4.4. After installing LuaMidi using luarocks, the following script throws an error:
local LuaMidi = require('LuaMidi')
print(LuaMidi.get_MIDI_tracks)
local tracks = LuaMidi.get_MIDI_tracks('./tracks/hot_cross_buns.mid')
print(tracks)
The value of the function LuaMidi.get_MIDI_tracks
is printed as nil
and an error is thrown.
Elliot@MacBook-Air harp-hero % lua build/import-midi.lua
nil
lua: build/import-midi.lua:3: attempt to call a nil value (field 'get_MIDI_tracks')
stack traceback:
build/import-midi.lua:3: in main chunk
[C]: in ?
Not sure what I'm doing wrong here. Unfortunately I couldn't find any examples in the documentation for how to use this function. Any help appreciated!
Hello,
how to create a dash between notes or a chord ?
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.