Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

bogus MIDI time signature and/or tempo imports

Open
#13 14 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp

Research direction

Start with modules/tracktion_engine/midi/tracktion_MidiList.cpp around line 1528, where simultaneous tempo and time-signature meta events are mishandled. Read the surrounding MIDI import loop and the pseudo event list in the issue (Section C) to reproduce the overlap. Build a minimal MIDI file or test that triggers a tempo and time-signature change at the same timestamp, then check the imported tempo and signature are both applied. Done means the importer no longer drops either event.

Written by the indexing model from the issue text.

Description

I am trying to import some MIDI file into Waveform 9 (tried 10beta too), but the imported data is corrupt around where time signature changes. I suspect that tracktion_engine fails to deal with them.

I can't share my song in production, but my pseudo MIDI event list for my master track (0) is like this:

	BEAT4,4 r1
	MARKER "Section A"
	t110 [r1]2  t112[r1]2  t114[r1]2  t115[r1]2
	[r1]8
	MARKER "Section B"
	[ r1  BEAT7,8r2..BEAT4,4 ]3  r1  BEAT3,4r2.BEAT4,4
	[ r1  BEAT7,8r2..BEAT4,4  r1  BEAT3,4r2.BEAT4,4 ]2
	MARKER "Section C"
	t120
	[ BEAT3,4r2.r2.  BEAT4,4r1BEAT7,8r2..]2
	BEAT3,4r2.r2.  BEAT4,4r1BEAT7,8r2..

(t is tempo, r is rest, BEAT is for time signature, and MARKER is marker meta text. Edit: and '[' to ']'n means "repeat n times".)

Starting Section B, Waveform fails to generate valid tempo/timesig changes, I can't really logically explain the actual behavior. It would be reproducible but changes them at many points.

Tracking the MIDI importer sources, this code smells:

            if (msg2.getTimeStamp() == msg.getTimeStamp())
            {
                ++i;

                if (msg2.isTempoMetaEvent())
                    secsPerQuarterNote = msg2.getTempoSecondsPerQuarterNote();
                else if (msg2.isTimeSignatureMetaEvent())
                    msg2.getTimeSignatureInfo (numer, denom);
}

I guess this assumes that they are either "both time signature" or "both tempo" and thus ignores the other. But my song contains a time signature change and a tempo change at the same time at Section C.

Dominant language
C++
Stars
1.5k
Forks
222
Avg merge
15h 44m
Merged PRs (30d)
33

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Tracktion/tracktion_engine

All issues in Tracktion/tracktion_engine

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.