Tuesday, April 24, 2018

Mea Culpa

Isn't it just plain annoying when you end up wasting most of an afternoon trying to find a bug in your code when there is no bug? Just happened to me ... and the really annoying part is that I've don't something very similar in the past! Guess we don't always learn from past mistakes?

I was trying to import a MIDI file into a MMA file using MidiInc and a START offset. At first it all seemed to work just fine, but the imported stuff was starting at the wrong point. How come?

The funny thing is that if I didn't use the offset and had the creator of the Midi file adjust things to what I needed, it worked.

Well, to make a long story short enough to blog about:
  • I have a .mmarc file which initializes my keyboard to a known state,
  • The initialize includes a "beatadjust 1" after doing a bunch of ChannelInits,
  •  I, next, imported the MMA generated Midi file into graphical notation programs.
Are you seeing the problem? Things are out of sync! Bar lines are in the wrong location!

But, I'd forgotten about the initialization and figured it was deeply buried bug in my beautiful MMA code. The upside is that I did find a bug when using a START offset, and that is now fixed.

The solution was pretty simple: In my directory which had the test MMA and Midi files in it I just created an empty file called "mmarc". And all worked. Maybe I've created too many options? Too late to change it all now....

Hey, if there are no bugs we'd never have to do new releases!





No comments:

Post a Comment

Truncate

I just found a minor bug in the TRUNCATE code. It didn't accept an integer argument for the Side= option. The underlying code all worked...