lua-users home
lua-l archive

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

Thanks a lotFelipe, that's really REALLY helpful!
I looked around your nibble project, it looks fun. Are you connectedwith the circuitmess people in Croatia?

Your code is nice and readable... and now I'm back to wondering... lua or js?
I used to be indecisive, but now, I not sure ;-)

Le lun. 16 janv. 2023 à 11:56, Felipe Tavares <> a écrit :
I have done some MIDI work for my Nibble Virtual console that might help

The C++ side uses RtMidi to generate a MIDI device that accepts MIDI
output from other software or an actual hardware MIDI device. The Lua
side coordinates things to play the notes in an FMSynthesizer (also
coded in the C++ side).

There's also the midi library in Lua which reads and writes (not sure if
I finished writing support) from/to MIDI files into Lua arrays. First
link above. There might be some differences from standard Lua because
there's a couple language extensions and a few standard library
functions coded specifically for the virtual console but it should give
you a pretty good idea on how to parse the MIDI files.

This is what it looks like playing MIDI using a DAW as input:

<>All the best,


On 16/1/23 21:17, Bruno Dumoulin wrote:
> Hello,
> I'm a beginner musician who tinkers with code in his spare time and I
> would like to write a little video game to help me make progress in
> music.
> The game simply plays a MIDI melody then pauses and waits for me to
> play the notes I recognised by ear. Then I use my MIDI keyboard to
> play the melody back to the game, and the game simply checks that I am
> playing the right notes in the right order, ignoring the rhythm.
> In other words, if the midi file contains the melody for "frère
> jacques", the game simply checks that I am indeed playing "do re mi
> do, do re mi do, mi fa sol, mi fa sol..."
> I have a little experience in coding, but not that much and none with
> audio. And I am new to the gaming world. I coded a "pong" video game
> with Lua/Löve2d.
> The principle of the game is simple enough, so I fired up my text
> editor to try and code it in Löve... and... got stuck straight away...
> there is no simple way to play a MIDI melody in Löve, nor stream the
> MIDI input from a keyboard.
> I'm using windows for now. In time I would like my game to run on a
> dedicated raspberry pi, or my android phone, so I can play anywhere
> and share it with other beginner musicians.
> I've done quite a bit of research, asked for help on the Löve forum,
> on the dualo forum (my midi keyboard is a dualo), and reached out to
> Peter Billam who developed several MIDI libraries.
> Someone on the Löve forum said "it's definitely not going to be easy
> using Löve"... Peter Billam has not answered yet.
> Anyway, here is my question: maybe Löve is not the right framework?
> Would it be easier to write it directly in Lua?  And maybe Lua itself
> is not the best option for what I am trying to do and I should turn to
> something like Qt or even C/C++ ? Maybe musicXML is a better option
> then MIDI?
> I don't mind putting in the effort, but I would like to put the effort
> in the right place? Can you help orient me in the right direction?
> Thanks for your time
> Regards
> Bruno