Quick Update on Sample Playback

So the good news is that samples now playback like properly audible instruments. There is no longer a jumble of static and it turns out the instrument information is indeed stored as-is in signed 8-bit PCM samples. Lacking more information or documentation, I was initially unsure if the samples were stored with some sort of encoding scheme causing them to not playback correctly. This is not the case and after many headaches I’ve realized the problem lies in the timing system. I have to re-investigate some of the information presented regarding tempo numbers and interrupt speeds to track down why this is the case. As predicted, the issues with the timing system is still the major obstacles holding me back.

In the mean time, while I work on resolving this problem and possibly restructuring the timing system and update cycle, I will continue work on implementing the needed pattern and macro effects in an effort to have them ready for the end of the week.

The Big Push

It has been quite some time since my last update. Since the midterm evaluation period ended, I’ve been working on implementing the sample loading and playback and haven’t taken the time to post updates. It has been problematic to say the least. I can say that TFMX playback is functional… if you consider static noise to be music. As the big push towards the final deadlines and weeks of coding looms, I’ve devised a restructured plan to help myself stay on course and hopefully make up for my original schedule, which has pretty much gone out the window.

  • Objective: Implement sample loading and playback.
    This is the most critical portion of the entire TFMX project. The samples are stored in a separate smpl.* file from the rest of the TFMX data located in mdat.* and loaded via the macro commands tied to each note. They are then played back according to certain parameters set in the note and macro data. I’ve been working on implementing the specific macro commands which relate to sample playback but some issues are still in the way.
    Obstacles: The sample loading is relatively simple and has already been taken care of. There might be some useful optimizations or modifications to the loading structure that will take place later, but the current system of loading the whole sample file into memory will work for now. A handful of the macro commands relating to sample playback have also been implemented. Problems are occurring in the playback of the samples which could be related to speed or timing issues. I am working to solve these problems and also improve some of the other mechanisms related to the timing system. Completion of this task will solve one of the major lingering problems and allow me to finalize the TFMX system.
    Estimated completion time: Friday, July 25th.
  • Objective: Implement effects commands.
    After the sample playback is in place, I will implement the commands which apply effects to playback. These include note transposition, portamento, vibrato, envelope, and volume slides.
    Obstacles: Some of these effects introduce complex problems. The ones related to period manipulation will be more difficult to handle and will likely require some restructuring of playback routines to allow for the effect manipulation to take place. I anticipate there will be some problems here but that I will be able to rely on code used in the other tracker players to resolve many of my issues. I will also focus on only initially implementing the effects which are nessecary for Monkey Island playback.
    Estimated completion time: Thursday, July 31st.
  • Objective: Optimize and build Monkey Island interface
    Another crucial task coming up will be to optimize the code, fix any memory problems, and try to reduce the memory burden as much as possible. I will implement any withstanding pattern/macro commands and resolve any bugs or little quirks related to the Monkey Island TFMX files. The next step will be to implement the interface for the Monkey Island game to have access to the TFMX engine and playback the required audio during game play. At this stage, I’m sure other developers will have many recommendations for improvement or optimization as well.
    Obstacles: This should be a straight-forward cleanup task that should bring to light any remaining issues or problems. Building the interface for Monkey Island should also be simple as the I believe the playback routine code is already partially implemented. I believe enlisting the help of some of the other developers’ expertise on memory issues should help optimize the engine as well.
    Estimated completion time: Monday, August 4th.

At that point, we will be awfully close to the closing time so I cannot realistically say that I will a functional MaxTrax player on the table for the final deadline on August 18th. I will definitely begin working on it as soon as possible and continue to work on it until my commitment is completed, even if that takes us past the final deadline. I will also continue to improve the TFMX engine after the deadline as well. Right now my priorities are on finalizing TFMX and completing the required testing and debugging. After that is complete, I will reevaluate the goals for a MaxTrax player.

Objective 2 & 3 Update

The pattern and note reading functionality has been implemented as described in the previously laid out objectives. The pattern loading is tied to each track. Each track contains a pattern structure which is initialized when a new pattern is loaded. When the pattern is loaded, it is processed on each interrupt call. The pattern handling looks for commands or notes. The simple pattern commands involving sequencing and looping have been implemented. The more complex pattern commands handling note manipulation still need work. The note reading is primitive until the majority of the macro commands are implemented.

While the initial objectives were actually quite simple to achieve, they revealed other obstacles and problems that need to be handled. I plan to solve some of these problems over the next few days and my goal is to have a functional player in the next few days. The timing system still needs some work. I’m still trying to find the best method to handle the track tempo and wait commands which will also satisfy the requirements of some of the macro commands. The other major difficulty arises in the handling of some of the more complicated note effects. Once I can clear up some of the issues regarding the note processing and some of the more important macros, I will be able to have a simple player with limited capabilities. With the midterm evaluation looming, I expect to have this ready shortly.

Objective 1 Update

I’ve implemented the readTrackstep() functionality of the program. It simply reads through the trackstep of a song line by line and checks for either commands or pattern numbers. When it finds a pattern number, it passes on the handling to a separate readPattern function. The trackstep commands still need some work. There is a total of five commands where one is a simple stop command and another is not used in Monkey Island. The remaining three commands either play a selection, set the tempo, or start a volume slide. These three functions will be developed as the track handling structure evolves. The trackstep is handled via an 8 member array of track structures. The requirements of this structure is still changing as I refine the design. I still need to develop a method for handling the tempo/speed settings at which tracks are updated. I’m still not quite sure how to do this.

The readPattern function is also partially implemented with work in progress. Reading patterns involves identifying either commands or notes. The notes are handled by a separate function, leaving the command handling to be taken care of. The pattern commands are very much linked to the trackstep so developing the command reading functionality will help refine the required track structure. As the commands are implemented, I will go back to make the necessary changes and updates to the readTrackstep function.