TrackerModule

Discuss SoundTrackers, shims to QTM, 32bitting and ARMv7 compatibility
Post Reply
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

TrackerModule

Post by JonAbbott »

I've 32-bitted this soundtracker (filename TrackerMod), source and module on the dev site. I based this on 4.09 [dev/C] and re-rolled all the loops to speed it up on ARM3+, the module is now about 5k smaller.

We may be able to use this for trackers that QTM doesn't understand (see the QTeM thread)
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: TrackerModule

Post by JonAbbott »

JonAbbott wrote:We may be able to use this for trackers that QTM doesn't understand (see the QTeM thread)
I've tested with the following games and it seems to work:

FRED (although no sound effects)
Magic Pockets
Paradroid 2000
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: TrackerModule

Post by JonAbbott »

It would seem that although it tested okay on the Iyonix, it's not working on the Pi.

I've double checked the code and all looks okay, I've pinned the problem down to the buffer fill code, which is going to an obscure address when reading the samples. I believe this is the only reason Magic Pockets doesn't work on the Pi, so will endevour to resolve it soon.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: TrackerModule

Post by JonAbbott »

It's now working although sounds awful on the Pi. Steve, could you please take a listen as I'm sure you'll know immediately what's wrong. It's timing and/or pitch related, I know that much.

5.01 source and module are in /development/TrackerModules/TrackerMod
There's also a test script and tracker mod in there.

I've labelled obvious bits, such as ChannelFillCode, configure_sample_period etc. I also took the liberty of making configure_sample_period use XSound_SampleRate if it's available although took a guess at the sample rate - it may well change between trackers, but I don't know enough about them to alter accordingly.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: TrackerModule

Post by JonAbbott »

Thanks for the info Steve...I changed the code to query the sample length and it's now playing correctly.

Now the next problem...TrackerMod is hardcoded to 31.25kHz so it needs modifying to query the best frequency and alter itself accordingly. Probably the simplest method is to alter the playback pitch by the difference between 31.25kHz and what it actually got. I'm looking at that now, in the meantime 5.02 is on the dev site.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: TrackerModule

Post by JonAbbott »

JonAbbott wrote:TrackerMod is hardcoded to 31.25kHz so it needs modifying to query the best frequency and alter itself accordingly. Probably the simplest method is to alter the playback pitch by the difference between 31.25kHz and what it actually got.
This is now done, I've updated 5.02 on the dev site and put a copy of the Betty Bo MOD used in Magic Pockets. I was stumped for a while pondering why it worked on a RiscPC and not on the Pi, until I realised the Pi has a linear handler installed.

Should we need to do this for another tracker module, its coded as follows:
  • When we configure the sample rate, work out the ratio of the sample rate we want to the one we got:
    If a linear handler is installed: R=((W/(G/1024)))/1024
    otherwise, must be logarithmic: R=((W/(G/1024))^2)/1024
  • In the buffer fill code adjust the sample step rate:
    S=(S*R)/1024

    Where:
    R = ratio of sample rates
    W = sample rate we want * 1024
    G = sample rate we got * 1024
    S = sample step rate
eg. If we get 32kHz instead of the 31.25kHz we want:

R=((32000000/(32768000/1024))^2)/1024 = 976
S=(S*976)/1024

So the sample plays at a lower frequency
steve3000
Posts: 198
Joined: Thu May 02, 2013 9:25 pm

Re: TrackerModule

Post by steve3000 »

JonAbbott wrote:Should we need to do this for another tracker module, its coded as follows:
  • When we configure the sample rate, work out the ratio of the sample rate we want to the one we got:
    If a linear handler is installed: R=((W/(G/1024)))/1024
    otherwise, must be logarithmic: R=((W/(G/1024))^2)/1024
  • In the buffer fill code adjust the sample step rate:
    S=(S*R)/1024

    Where:
    R = ratio of sample rates
    W = sample rate we want * 1024
    G = sample rate we got * 1024
    S = sample step rate
eg. If we get 32kHz instead of the 31.25kHz we want:

R=((32000000/(32768000/1024))^2)/1024 = 976
S=(S*976)/1024

So the sample plays at a lower frequency
Nice one Jon. If you have this working for the sample rate I guess that's the rate returned by Sound_Configure? Have you also included a recalculation to compensate for the 'not-divisible by 8' clock speed in Modes 25-28 and similarly clocked letterbox Modes 9/12/13/15 on VIDC1 hardware with 25.175MHz clock? You just need to recalculate based on the fact the VIDC is being clocked faster by ratio of 25.175/24 in those modes and feed it back in the equations...
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: TrackerModule

Post by JonAbbott »

steve3000 wrote:Nice one Jon. If you have this working for the sample rate I guess that's the rate returned by Sound_Configure? Have you also included a recalculation to compensate for the 'not-divisible by 8' clock speed in Modes 25-28 and similarly clocked letterbox Modes 9/12/13/15 on VIDC1 hardware with 25.175MHz clock? You just need to recalculate based on the fact the VIDC is being clocked faster by ratio of 25.175/24 in those modes and feed it back in the equations...
The changes only kick in if XSound_Mode succeeds - which is RO3.5+, so on VIDC1 the original code is used.
fatmarrow
Posts: 3
Joined: Sun Mar 29, 2015 12:08 pm

Re: TrackerModule

Post by fatmarrow »

Hi

Jonathan Abbott pointed me in the direction of this forum - I just thought I'd introduce myself on this thread as I did some of the original work to put together a soundtracker/tracker RM player. I was involved in the Arc scene from near the beginning to after the release of the RiscPC (that is, till about 1999). I haven't really followed any developments since, so bear with me if I'm rusty.

By way of further history, a guy called Fabrice Mercier wrote Tracker, which was the first program approximating ProTracker et al on the Amiga, except extended to 8 channels. He released the source code and I messed about with it, making it dual purpose (playing soundtrackers as well as the new trackers). I made some optimisations (unrolling loops) which I understand are now significant performance hits (ah well). I also, over time, discovered and properly dealt with various protracker effects like portamento, pitch slide, volume slide, etc, which Tracker didn't cope with. I'm not aware of anyone using my RM to play trackers/soundtrackers in games, but it was public domain and possible, I suppose. I'd put in SWI calls as well as * commands, so it was easily doable. I also recall that Hugo Rune was someone involved with distributing lots of PD (public domain) software, I think, and especially protrackers, which presumably were scooped up from the Amiga scene.

It sounds like the developments in RiscOS/ARM are too much for me to get on top with, let alone the further work on the various emulations. However if I can be of any help I would be happy to help (within my serious time constraints).

I have a RiscPC and plenty of old stuff to go with it in my loft - I don't expect it to run but maybe I can dig up some old game floppies (again, not expecting to run). I have a load of Syquest removable hard discs - I'd love to have a poke around on those (again, if they work, which is questionable), though I don't have access to any technology other than my Risc PC with the necessary SCSI ribbon interface. Perhaps if I draw a blank I can liaise with someone here on the hardware side - I may have the source code for the soundtracker stuff if that's of any interest.

I was also involved in the sound and graphics work for Kerbang!, a very low profile (and if I'm honest, slightly shitty, even by Arc standards) game, released by Eterna. I don't have the source code, but I have a feeling that Eterna may either have supplied a code fragment or given a direction on how to implement the copy protection, but that wasn't the only copy protection on the game. I don't have any source code or recollection beyond that I'm afraid. I think the protection was so hacky that the game wouldn't have run on the version of RiscOS that came with the RiscPC. Probably pissing about with IRQ callbacks, self-modifying and encrypted code, and so on. But that extra stuff was done by the Kerbang coders on their own initiative, rather than a standard Eterna system.
fatmarrow
Posts: 3
Joined: Sun Mar 29, 2015 12:08 pm

Re: TrackerModule

Post by fatmarrow »

PS the TrackerModule that came with Tracker was (at the time) pretty seriously inefficient, so woe betide a game that used it and needed any CPU time for video stuff
Post Reply