Unnamed Music Tracker Devlog 4

Oh no.

27 May:

28 May:

  • Added a pitch setting for notes.
  • Tested adding linear interpolation to the mixer function. I would like for interpolation to be configurable, either on a per-channel or per-instrument basis, maybe with a full environment override as well. In Milky, it’s an application-wide setting as far as I can tell. Interpolation helps with longer samples, but it can also remove the bite from square waves and other short period samples, especially at lower frequencies.

29 May:

  • Added a (very simple) low-pass filter based on this example by Kirit Chatterjee.
  • When I added linear interpolation earlier, I only tested it with mono samples. The stereo sample playback broke very badly along the way, and I didn’t notice the problem until this evening. This is the first time I’ve really gotten a lot of screeching audio of the “opening the gates of hell” variety.

30 May:

  • Added support for mixing 8-bit unsigned WAV samples.
  • Added something like the Key Scaling Level feature in AdLib Tracker II, where the volume of a channel can be reduced by a certain factor with every octave. I think my implementation isn’t quite correct, but should be OK for now as a prototype. Testing it out with a sine wave sample, I do find myself preferring the volume to be a bit lower on higher notes.

31 May:

  • Added the ability to cross-fade when cutting over to a new sample when changing rows. Triggering new samples no longer causes a loud click or pop to occur. This is the last big missing piece of the mixer, I think. If you listen carefully, you can still hear a small ‘blep’ when the samples cut over, but it’s nowhere near as loud now. Woo!
  • As suspected, Audacity’s Pitch Detect confirms that my playback is out of tune. Upon further investigation, long samples report the correct playback pitch, but short periodic samples are a little high. My first thought was there is a problem with re-positioning the sample after looping. Turns out it’s just a problem with my samples, and a lack of frequency correction. The sample length for a 440 Hz A4 note playing at 44100 Hz is 100.227272727, and samples can’t have fractions, so … a 100 sample-point sample won’t cut it on its own. Oops. I’ll look into frequency correction once I have more of an interface to work with.

The mixing function itself has become a bit long and could probably stand to be chopped up into a few smaller functions. While I’ve done no real optimization work, performance at four channels seems OK so far. Interface is still read-only, I’ll have to start working on that because entering note data in the source code is a pain.

I uploaded some audio of the cross-fading, interpolation and filtering here.

Leave a Comment