fbpx
Skip to main content

MIDI Forum

How do YOU handle a...
 
Notifications
Clear all

How do YOU handle all the data when creating a MIDI editor?

10 Posts
3 Users
0 Reactions
346 Views
Jason
Posts: 438
Honorable Member
Topic starter
 

Just curious how some of you handle data collection/retrieval/etc when programming a MIDI editor.

MIDI-MIS has become quite the MIDI mess, mostly because it started out when I knew very little about MIDI internals, and learned everything as I was programming it.  Many things that seemed like a good idea at the time could have been handled much better had I known more from the beginning.  I have tons of various arrays and such to store things like track start locations, note locations, msb/lsb locations, just added in bend value locations which required making a note object that now contains even more arrays, and the list goes on... and most of this stuff is all cross-linked in various ways.

Some things I have to store using per-channel info so they get applied to the appropriate channel when editing.  Some things have to be done per track.

There's got to be a better way, but I'm really not sure HOW to optimize everything, since I have to read in the entire file and essentially dice it up in to pieces that I'm interested in modifying.  I've just used my first structs to store note on/off values and locations with all corresponding pitch bends, so those at least are all "together" in a somewhat organized manner.

 
Posted : 23/05/2024 5:28 pm
Geoff
Posts: 1043
Noble Member
 

Jason,

Don't know if this is of any interest?

I wrote my own prog to handle and specifically PLAY midi files a few years back, the prog is not finished yet but it does load the midi file, and it will play back the data I've loaded.

Not yet trying to store everything, but most of the important stuff.

There is some incidental EDIT facility there, both within my prog, but also externally given how I've stored my data.

As most of my commercial programming uses dBASE .DBF fales, and associated indexes, I've used the same processes to store the data extracted data, and the PLAY plays directly from the .DBF using an index based on the delta time. But I have other indexes for accessing the data in whichever order I need, i.e. by Track or Channel, or whatever I like. Also, any extenal prog that I can use to process .DBF files could be used directly on the same files.

Of course, MY data is MUCH bigger that the original .MID file, by MANY times, but the data is all in standard files on the HD so is not dependant on RAM manipulation.

One of the things I want to do but not done yet is to convert my data back to std midi file.

More details if you're interested.

Geoff

 
Posted : 25/05/2024 12:41 pm
Jason
Posts: 438
Honorable Member
Topic starter
 

More info please 😀 

Probably won't be able to do it exactly the same, but any ideas are welcome. 

I've used Game Maker (formerly GameMaker Studio) for my project. I read the entire file in to a memory buffer, and store heap gads of arrays and values for things. Because Game Maker is designed for games, it comes with all sorts of handy things for me to use. Each instrument get a "manipulator" object, which then holds/gets assigned anything relevant to that particular instrument as I'm initially parsing the buffer. Each manipulator stores notes, bends, channel info, track info, program select info, and anything else that instrument needs. I don't actually store any delta time info. Any data inserts I make I typically add a delta of 0 after the edit. All editing is done in memory. 

Some day when I'm bored (and have lots of time) I may end up rewriting the core functionality. As is, it's getting more confusing to add new functionality, as the order the data extraction happens is not readily apparent without manually stepping through the code.

 
Posted : 25/05/2024 2:11 pm
Geoff
Posts: 1043
Noble Member
 

Jason,

Have a look at the attached .zip

This is the set of files created by my system for a midi file called PRINCESS, which is a rather sweet piece of ethnic Indian sounding music. It's a pretty well done midi file. The file is set up for the Roland LAPC-I sounds, so the origina; midi will not sound quite right using GM, but the .TRK file has the track headers/text saying what the sounds should be.

The .DAT file should be recogniseable as the midi data from the midi file, note that I've done what some other systems do and replaced the NOTE OFF event with an explicit NOTE LENGTH value as part of the NOTE ON event, so the only real 'extra' work that my playback has to do is to add to a NOTE OFF table/list within my system to replicate the explicit NOTE OFF event that is no longer there.

Geoff

 
Posted : 28/05/2024 2:01 pm
Geoff
Posts: 1043
Noble Member
 

Jason,

I meant to include the original midi file in the zip file I sent, but seems it got missed out.

ZIP redone, now includes the midi, credited to Robin Goodliffe of Sangeet Studios. The original download had another file of a similar sort of thing, just not quite as nice. I'd rather like to find the printed score for at least the opening these for the movie Sakaam Bombay whichwould make an interesting modo to go with these.

Geoff

 
Posted : 28/05/2024 3:15 pm
Jason
Posts: 438
Honorable Member
Topic starter
 

Is there an easy tool you use to view the dat file?  I tried loading it in Notepad++ and can only see a semi-readable for in Hex view, which squeezes it all in to a narrow column.  Curious to see how everything is organized.

 
Posted : 28/05/2024 5:49 pm
Bavi_H
Posts: 267
Reputable Member
 

Posted by: Jason
Is there an easy tool you use to view the dat file?

I renamed some of the files to end with a .dbf extension, then I could open them in LibreOffice Calc:

PRINCESS.DATPRINCESS.DAT.dbf
PRINCESS.GBSPRINCESS.GBS.dbf
PRINCESS.TRKPRINCESS.TRK.dbf

The GBS file looks like some global properties.
The TRK file looks like a track list.
The DAT file looks like an event list.

I guess the CDX file is some kind of index that helps the dBase software quickly locate or search for rows in one or more of the other three files.

 
Posted : 28/05/2024 9:52 pm
Geoff
Posts: 1043
Noble Member
 

Yes, Calc should know about dBASE files, as prob will EXCEL and ACCESS, but these are rather large systems. I use smaller progs, but these are all DOS.

The .CDX file is a FoxPro Compound Index, where the one file contains multiple index tags which can be swapped as required. The file at present contains three tags, ordering the data by time, or Channel and time, or Track and time. The raw file (no index in use) will be as per the midi file, i.e. Track and time. For playing the data, the index based on time alone will be used.

I've got a WinDoze prog called FIVEDBU, this works to some extent but it's still fairly large (3 Mb +). Supports some of the CDX facilities but I've not checked all.

Geoff

 
Posted : 29/05/2024 9:57 am
Geoff
Posts: 1043
Noble Member
 

If you want to play PRINCESS.MID, you might be able to.

I've been checking both my main Sound Modules, and they do have some facility to do so. Other devices might as well.

My Yamaha MU90r usit has as explicit C/M mode, it is called this as the MT32 device from Roland later developed into the CL32 and then the CM32 (specifically re computer music), and in fact the internal LAPC-I board that I have is a follow-on from the CM32 rather than the MT32 directly. The Yamaha C/M mode includes both the relevant sounds to match the numbers in the midi file, and also a MT32 compat drumkit as this is different from the GM sets. So, later Yamaha boxes MAY have this C/M mode, either explicitly, or maybe shightly hidden?

The actual sounds will be slightly different from the original, as they will be sampled into ROM and NOT generated by your device using LA synthesis, but that may not be a major issue.

I also have a KORG NS5R, and this explicitly has some support for certain other KORD devices, but no CLEAR indication of any C/M support. BUT, digging into the manual I first found a drumkit called CM, without any mention as to what this was for, and when I check the details of this I find it matched the instruments for the MT32 system. Hmm! The details for the main soundbanks, nothing.

Went into the meat of the manual, and found the section where you can select the soundbank for each channel via the front panel, and this included various options which were NOT explicitly listed in the sounds tables listed, and one if these is r:CM. No detail as to what's in r:CM, but there is some hint elsewhere that this is linked with the CM drumkit (which IS what is needed) so it looks like the KORG device has something there/available, although slightly hidden.

As the above relates to two non-Roland devices, it's more likely that later Roland devices may also have something, agail called 'CM' or 'C/M' rather than MT32. Worth looking?

Geoff

 
Posted : 31/05/2024 7:12 am
Jason
Posts: 438
Honorable Member
Topic starter
 

So I looked through the files, and I guess the way the databases are laid out is sort of how I'm doing it, just all in memory, and probably less structured.  And probably with a bunch of repeated data that I should try to optimize some day.  And also broken up in to lots of individual bits rather than a cohesive whole... so not very similar at the same time?  Ahem.

 
Posted : 31/05/2024 9:17 pm
Share: