Sunday, April 26, 2020

SoundTracker Pro II

soundtrack2.png After having a problem with reading the format provided by Marco Nelissen, I have to admit that the Psuedo code was a little hard for me to understand.

It wasn’t until ModPlug Tracker had they’re own loader written, C++, and when i looked into the file, things started to make sence.

As soon as I started to program my loader, the files .STP started to make sence, i’ve been since able to read the file as close to properly as possible.

As a result, I’ve been able to extract samples and their loop infomation, turns out i was able to extract each sample into a nice wav file for later use ;)

Then i found the patterns causing some issues. They could be any length from 1 - 9999! WHO USES THAT many rows in one pattern!! Anyways, I ended up having to use a sort of Pattern POINTER, its quick, and simple.

The messy part was, Load the Header, Look at the sample data, load the patterns and their info in to a bank of memory for the points, THEN re-read the sample data for their pointer locations.

I was then able to make patterns load and run. No effects, but the notes are almost identical to that of a Mod!
except i have to now work out the periods needed for the extra 2 octives!

here is the code i used to read through the file

void load_stp_header(FILE *file){
    unsigned char iOrder;
    fread(&mod, 1, 204, file);

    printf("HEADER: %srn", mod.ftype);
    btsEndien16(&mod.version); printf("VERS: %urn", mod.version);
    printf("patterns: %urn", mod.numOrders);
    printf("patternLength: %urn", mod.patternLength);

    btsEndien16(&mod.speed);      printf("speed: %urn", mod.speed);
    btsEndien16(&mod.speedFrac);  printf("speedFrac: %urn", mod.speedFrac);
    btsEndien16(&mod.numSamples); printf("numSamples: %urn", mod.numSamples);
    btsEndien16(&mod.timerCount); printf("timerCount: %u // %Xrn", mod.timerCount, mod.timerCount);
    btsEndien16(&mod.flags);      printf("flags: %urn", mod.flags);
    //btsEndien(&mod.reserved);   printf("reserved: %lurn", mod.reserved);

    printf("rnMidi Inforn");
    btsEndien16(&mod.midiCount);  printf("  MidiCount: %urn", mod.midiCount);
        //printf("    Midi[%2u] = [%2u]rn", iOrder, mod.midi[iOrder]);

    btsEndien16(&mod.sampleStructSize);  printf("rnsampleStructSize: %urn", mod.sampleStructSize);
    printf("-------------------------rnrn");

    Player.cia = mod.timerCount;
}

More to come…

  1. Maddi

    Monday, April 27, 2020 - 01:43:08

    I’ve used 128 patterns before so nerr :op
    STP file format seems to be like a MOD format without restrictions and a few extra goodies. i’ve used Soundtracker Pro 2 since the late 90s and I still love it, despite it being a pain in the butt for you :op lol

  2. electronscape

    Monday, April 27, 2020 - 01:46:38

    Maddi, the issue I face is the tremalo and Portamento functions, the sample functions went in really well…

    switch(effectNumber) {
    case SETVOLUME:
    if(effectParameter > 64) Player.volume[channel] = 64;
    else Player.volume[channel] = effectParameter;
    break;

    }

    This bit :)

Add comment

Fill out the form below to add your own comments