Skip to content
LTVA1 edited this page Feb 17, 2023 · 20 revisions

Flizzer tracker wiki

Here the basics of how to use Flizzer tracker are collected. Note that some things related to trackers in general will be omitted, so if you are new to the tracker things, consider digging into basics first somewhere else.

Note: Flizzer tracker possesses a lot of similarities with klystrack, because I have been developing a fork of it for more than a year now, so some pieces of code are copy-pasted there...

Flizzer tracker

This is a pretty much generic (not including instrument program, because most chiptune trackers go "macros" way) 4-channel chiptune tracker with basic waveforms and effects. It's capabilities are on par with SID chip, although it has one more channel and independent filter on each channel... Okay I am carried away a bit. So it is a real tracker where you can do real multi-channel chiptune-like songs, as opposed to Zero Tracker and Music Beeper. The goal was to make a feature-rich program and fit it on crappy 128x64 pixels display and make the controls using 6 buttons (lol LSDJ moment). Well, it kinda works...

Main screen

yyy

Technicalities

But how does it work? Well, like flipper wav player! There is an array in RAM used as double buffer. DMA in circular buffer mode loops through the buffer and puts samples into TIM16 compare register which in turn generates a 60 kHz 10-bit PWM signal which is then routed either to internal shitty buzzer or on "3" (aka A6 aka PA6) pin you can find amongst GPIO pins. Connect it to your PC microphone input through a ~400kOhm resistance to have clean sound. Don't plug in any usb cable while listening to/recording this sound, because the common ground or whatever introduces audible noise.

So, let's continue with hardware abuse. Obviously, I want to adjust sample rate of sound engine independently from PWM frequency, so for that I am using TIM1. It is the timer that triggers DMA transfers.

So, are we OK with that? Well, not quite... Because we also have a tracker engine running on its own rate! (typically 50-60 Hz) I could just approximate the rate through sound engine sample rate, but why would I go this miserable silly way, if I can... Yes, abuse third timer!

TIM2 is a unique one in Flipper ARM Cortex M4 main core because it has a 32-bit counter, so without any prescaler fuckery you have a 1-255 Hz range with quite a precision (ofc the master clock (64 MHz) is not itself so precise, but comparing wav recordings playback with my PC ones it's close enough for you to not notice until you launch playback on these two simultaneously). It's interrupt priority is one level higher than sound engine DMA interrupt, so effects timings precision is within one sample duration (and by default you have 44100 Hz sample rate, is it enough precision?).

So these three timers are working together to provide a smooth tracker operation. I am surprized it still has time to update the screen: even when I enable filters on all 4 channels, it still manages to have like 0.5 FPS.

Clone this wiki locally