MIDI Markers (again)

Since Ardour can’t read markers from a MIDI file I decided to make a little bash script (with the help of midicomp) to extract the markers and add them as locations into an Ardour session.

I noticed locations have an ID, how are these assigned?

There’s a global ID counter used for all PBD::ID members of objects. It is serialized as “id-counter” near the top of a session file in the <Session> node.

Using this is dangerous though - if you try to get the markers’ IDs based on this, you run the risk of ID collisions for any new objects in the session. So you will need to edit id-counter as well.

Thanks.

So for adding new markers I should take the id-counter as the starting id and go up from there, and once I’ve added my markers I should set id-counter to the id of the last marker I added?

Yes, that ought to work.

1 Like

It seems dealing with floating point numbers and xml files is trickier than I expected in pure bash. Is there anyone who I can pay to implement this feature directly in Ardour?

We use libsmf to parse MIDI files. I just grepped the source, and don’t see any mention of the word “marker” anywhere. Is there some other term?

It’s a meta event (I think that’s the right term).

I just had a look myself on github and found a reference to it (capital M) in the smf_decode.c file, I don’t know if that’s relevant.

Line 169:

case 0x06:
    return (smf_event_decode_textual(event, "Marker"));

Send me a couple of files with the markers in, and I’ll get it done. Email paul@ardour.org

1 Like

Thanks Paul! I’ll send them over shortly.

Now in git (ardour/master). It imports markers and cues. One proviso until version 7: do not import multiple MIDI files with the markers in one and the tempo map (if importing) in another. For somewhat obvious reasons, the markers will end up in the wrong place.

2 Likes

Wow that was fast, thanks Paul!

I’ve just tested this out in the latest nightly build. The marker import is working but the markers are not in the correct positions.

Here are the original markers in Reaper

And this is how they come out in Ardour

I wonder if there is a conversion from tics to samples that’s missing?

Should now be fixed in git master. But please do me a favor and create a test file with a varying tempo map as well, so I can check that combination.

1 Like

Thanks Paul. No problem, I’ll get that done and sent over tomorrow.

Great job!

Any chance for WAV markers?