Skip to content
Vadim Grigoruk edited this page Nov 22, 2026 · 1 revision

VQT

Added in 1.3. Requires TIC-80 started with --fft; see FFT.

The Variable-Q Transform maps the spectrum onto 120 logarithmically spaced bins — 10 octaves of 12 notes. Bin frequency is 19.445 * 2^(bin/12) Hz; bin 0 is D#0/Eb0. The normalized variants return a value roughly 0..1 for their bin; the raw variants are not peak-normalized, so their scale depends on the input.

Every variant answers one question: normalized or raw, smoothed or not, whitened or not.

Function Peak-normalized Smoothed Whitened Notes
vqt(bin) yes no no the everyday magnitude
vqts(bin) yes yes no steadier for visuals
vqtr(bin) no no no raw magnitude
vqtrs(bin) no yes no raw and smoothed
vqtw(bin) yes no yes notes stand out from the spectral envelope
vqtsw(bin) yes yes yes whitened and steadier
vqtrw(bin) no no yes whitened without auto-gain
vqtrsw(bin) no yes yes raw, smoothed and whitened

bin is 0..119. A value outside the range reads as zero.

Example

-- one bar per octave, using the smoothed normalized magnitude
function TIC()
    cls(0)

    for octave = 0, 9 do
        local sum = 0
        for note = 0, 11 do
            sum = sum + vqts(octave * 12 + note)
        end

        local h = sum / 12 * 100
        rect(10 + octave * 22, 120 - h, 16, h, 12)
    end
end

Use FFT when you want linear buckets instead of musical notes.

Home
Tips for newcomers

Built-in Editors

Code | Sprites | Maps | SFX | Music

Console

All commands

save | export | load | import | menu | config | surf | shelf | demo | eval 

Platform

RAM | VRAM | Display | Palette | Bits per Pixel (BPP) | .tic Format | Supported Languages

Other

Tutorials | Code Snippets | Libraries | External Tools | FFT


API

All API functions

Callbacks

TIC | BOOT | MENU | BDR

  • SCN (deprecated)
  • OVR (deprecated)

Input

btn | btnp | btnr | key | keyp | keyr | mouse

Drawing

circ | circb | clip | cls | elli | ellib | font | line | map | paint | pix | print | rect | rectb | rrect | rrectb | spr | tri | trib | ttri | fill patterns

Sound

music | sfx | FFT | VQT

Memory

memcpy | memset | mget | mset | peek | poke | pmem | sync | vbank

System

exit | reset | time | tstamp | trace

Clone this wiki locally