Saturday, September 4, 2021

PLAYS TFMX

As we all know, TFMX plays the legenday Turrican 2 music.

When I heard this tune back in 1994 (Maybe?) I fell inlove the tune and recorded it to cassette and brought it with me to a holiday in Corton Beach (A that time it was some sort of nudist beach to which I had no idea about!)

With the Turrican 2 music blasting in my ear phones I fell in love with the tune more and more and wished I could write music like that.

I attempted to re-create the tunes using Mod and could never understand how the songs sounded so amazing in just 4 channels, until 96 I came to light that TMFX plays 6 channels instead of the 4.

It since has been a dream of mine to play TFMX music independently without converting, recreating or just simply sampling it to a WAV file.

So with this in mind, when I was developing the Sidbox I just wanted to have the ability to play TFMX. I had zero luck in understanding how the files where done. I couldn’t find the data.

until I came across this http://eab.abime.net … 90994&styleid=4 alexh 11:07 26 February 2018 from the sight pointed me to the download of the source code written in C, as I was looking through the code, it came apparent that the TFMX was not just a tracker. It felt more a sequencer.

I got the source code, compiled it, Failed. Heart sank.
After reconfiguring the compiler, and moving files about and using excessive amounts of ram, I got the tune to at least play and output the results in to a stereo 44Khz 16bit.

Excited that it worked GCC compiler CodeBlocks it worked.

I began to install it to the Sidbox and nothing worked, the ARM processor just organised bytes so very strangely, Signed bytes, unsigned bytes not matching and samples sound distorted or totally miss-aligned. I spent then the next 2 weeks trialling and error the code (not the best way to code at all) When I got the code to work, the player at least was producing the notes and timing but the samples just wouldn’t fit into the 12Bit DAC and distorted. The shifting of bits, the dividing of values, just threw out the audio with nasty clipping and memory corruption.

The first break through was the RAM configuration. I slowed the ram down and suddenly samples began to play properly. but gaps between the buffers and wasn’t working with the DMA at the time.

I began to write the Output buffer to DMA routine. Then it too didn’t work

I scrapped that idea, to just a Output buffer to DMA via a RING buffer method (Write behind, read before) kinda thing I had expected this to sound so bad that the sidbox crash… It didnt, it worked! flawlessly!

Once that begin to work, I put the RAM speed back to normal and it continued to work and noticed that some notes where playing wrong.

Again contending with the signed and unsigned bytes thanks to the ARM processor.

I split the maths out and found that I had to check a value… I believe i shouldn’t have to do this.

if value is more than 128 then value = value - 256 its a crazy method but it worked!

——–
Bottom line.
TFMX now works.

I still have to contend with Single file TFMX files and find away for the Sidbox filemanager to cope with the amiga style of file nameing.
<extention>.<filename> the sidbox likes the <filename>.<ext> more.

Thanks for reading this.

Add comment

Fill out the form below to add your own comments