Audio Library for FX

Those 64 bytes per channel are needed only if commands are fetched from SPI flash but I don’t think it’s worth doing. osc.c needs 4 bytes per channel.

Timer register setup and some constants are depend on channel count. The interrupt handler needs to iterate over an array of channel_count elements.

The setup isn’t a problem, but the constants would be because the interrupt code won’t know which template has been instantiated.

It might have been possible if the interrupt handler could be made to be a static member function, but it would depend on how the interrupt handler is registered.
If an interrupt has to be manually selected (e.g. INTERRUPT(functionName)) then it would be possible, but if the function is selected at its point of definition rather than needing to be ODR-used (e.g. INTERRUPT void someFunction() { /*body*/ }) then it probably wouldn’t be.

Hey @dxb. If you have anything to test, please let me know. Currently I have the ATMlib2 (from the old repo) slabbed into my code and it is currently consuming 10ms of each frame rendering time.
Right now I am at 25fps and 25% of the CPU is going to be consumed by the audio library.
So I am really looking forward how good the new library will perform.

Hi @veritazz and thanks @Pharap for the reply. I did spend some time on this since I last wrote but I have nothing to show for the moment. I have decided that the best way to go about this is taking simple .mod (or .xm) file and write a script to convert it to a new format usable by our library (the new format is TBD). I will not have something usable for at least a month, sorry.

As for the 25% CPU usage I am sure we can improve it but I haven’t looked at what the lower bound could be.


No need to apologize, your work is amazing! Happy to see it come to life, if it takes time that just means it is good quality! :slight_smile:

Hey, no problem. Just wanted to ping you and offer some help for testing. No need to rush. I am also rare on time these days.
I like your approach of using .mod (or .xm) files and convert from there to the new format. That is actually really exciting and to my mind the most important missing feature from all the other libraries. @luxregina is already excited to have something like this as he seems to be an FT2 veteran. Wow, I cannot wait to see what will happen if musicians can actually use real tracker tools to create their music and effects.

So please understand my ping just as an offer to check out your library in some game engine for testing. Take your time and let me know if I can help out anywhere.

I confirm: I tried to use Team ARG tracker but had a hard time with some of the usability features.
I spent a fair amount of time of FastTracker II and to this day, I still use its modern iteration and being able to compose music that way would be great (and a great throwback to the C64/Amiga/AtariST demo scene!)


Ah, no pressure, right? :laughing: But seriously, thank you.

I guess the rush is self-imposed because I would love work on this to move faster.

Could anyone (especially @luxregina) suggest one or two simple .mod or .xm using 4 channels or less that I could use as reference, examples and tests? Thank you.

1 Like

I can try to dig in to find some old 4 channels tunes - I haven’t used FTII in a while, and my more recent songs used wayyyy more than 4 channels, leverage VST intruments, hardware synths, etc…
But give me a bit of time and I’ll find you something (I have a hellish week ahead of me)

in the meantime, you may be interested in this >

1 Like

Actually, I was able to track back an old “Blue Monday” mod (not written by me) that I saved as an XM file for you. It’s in the zip, as well as a win64 version of FastTracker II.

1 Like

., as in New Order?

Of course! :slight_smile:

I was a huge fan of Joy Division and then, of course, New Order.

1 Like

Thank you!

Hey @dxb. Just a quick question regarding the memory requirements for a average score (for level music) and some sfx sounds. Can you already guess a few numbers how much bytes are required for

  • some average score for music in a level (any guess would be sufficient)
  • an sfx sound

I would need that to estimate how much progmem I need to leave available for this in the game.

If you do not have the answers ready right now, then no hurry. I do not need them urgently. It is just for me to plan better with the memories available.


Warning guesstimates ahead: I think we should be able to encode a decent song using 128 bytes or less. As for the SFX budget I would say count 20 bytes for each sound effect.

I’m going to go back in hiding now but… I’ll be back



Great many thanks. That helps much even if they are just guessed.
I’ll go as well back into my cave… :crazy_face:

LOLZ @Pharap thank you for splicing in that gif!

1 Like

Totally legitimate use of moderator/leader privileges. :P