Skip to content

meisei4/fffftt

Repository files navigation

(f)ixed (f)unction and (f)ast (f)ourier (t)ransform (t)esting

fffftt is an audio-geometry exhibit for fixed-function graphics signal visualization, originally inspired by Shadertoy. It targets Dreamcast as a hardware case study using raylib, OpenGL 1.1 fixed-function rendering, GLdc, and sh4zam's shz_fft().

[overview]

    .h file ........................... shared state/functions in src/fffftt.h
    .c files .......................... one demo per file in src/
    .wav files ........................ Shadertoy media files -> ADPCM .wavs in src/resources/
    audio terrain demos ............... see [audio terrain]
    Shadertoy ports ................... see [shadertoy ports]
    proxy plots ....................... MathWorks-like audio analysis plots in mathworks/ directory
    controls .......................... see [controls]
    desktop ports ..................... see [desktop ports]

[audio terrain]

    [fft bands terrain]
    src/fft_bands_terrain_3d.c ........ mid: chroma, low: onset strength, high: spectral flatness
fft-bands-terrain-3d-dc.mp4
audio should work^^^ otherwise: fft-bands-terrain-3d-dc.webm)
fft_bands_terrain.png
fft bands terrain
fft_bands_terrain_chroma.png
mid-chroma
fft_high_band_terrain_spectral_flatness.png
high-spectral-flatness
fft_low_band_terrain_onset_curtain.png
low-onset-curtains
fft_low_band_terrain_onset_scribbles.png
low-onset-scribbles

    [waveform terrain]
    src/waveform_terrain_3d.c ......... Hilbert envelope, RMS, and onset strength
waveform-terrain-3d-dc.mp4
audio should work^^^ otherwise: waveform-terrain-3d-dc.webm)
waveform_terrain.png
waveform terrain
waveform_terrain_hilbert_overlay.png
hilbert
waveform_terrain_rms.png
rms
waveform_terrain_onset_curtain.png
onset-curtains
waveform_terrain_onset_scribbles.png
onset-scribbles

    [fft terrain]
    src/fft_terrain_3d.c .............. chroma/pitch-class and onset strength
fft-terrain-3d-dc.mp4
audio should work^^^ otherwise: fft-terrain-3d-dc.webm)
fft_terrain.png
fft terrain
fft_terrain_chroma.png
chroma
fft_terrain_onset_curtain.png
onset-curtains
fft_terrain_onset_scribbles.png
onset-scribbles
 

[shadertoy ports]

     [meisei4: basic fft visualizer]
     Shadertoy: https://www.shadertoy.com/view/t3jGzm
     src: src/sh4zam_butterfly.c
Dreamcast capture Shadertoy capture
sh4zam-butterfly.mp4

basic-fft-visualizer.mp4


     [Cotterzz: Visualiser - Picking out notes]
     Shadertoy: https://www.shadertoy.com/view/tcG3Rm
     src: src/picking_out_notes.c
Dreamcast capture Shadertoy capture
picking-out-notes-dc.mp4

picking-out-notes.mp4


     [meisei4: basic waveform data visualizer]
     Shadertoy: https://www.shadertoy.com/view/tcSXRz
     src: src/waveform.c
Dreamcast capture Shadertoy capture
waveform-dc.mp4

basic-waveform-data-visualizer.mp4


     [meisei4: sound envelope reference]
     Shadertoy: https://www.shadertoy.com/view/7fXSWB
     src: src/sound_envelope_2d_iso.c / src/sound_envelope_3d.c
Dreamcast 2D Dreamcast 3D Shadertoy capture
sound-envelope-2d-iso-dc.mp4

sound-envelope-3d-dc.mp4

sound-envelope-reference.mp4


[submodules]

git clone --recurse-submodules https://github.com/meisei4/fffftt.git
# otherwise:
git clone https://github.com/meisei4/fffftt.git
cd fffftt
git submodule update --init --recursive

[all demos]

# [fft]
make dc-sh4zam-butterfly          # run: ./bin/dc/sh4zam-butterfly          # elf: ./build/dc/sh4zam-butterfly/sh4zam-butterfly.elf
make dc-picking-out-notes         # run: ./bin/dc/picking-out-notes         # elf: ./build/dc/picking-out-notes/picking-out-notes.elf
make dc-fft-terrain-3d            # run: ./bin/dc/fft-terrain-3d            # elf: ./build/dc/fft-terrain-3d/fft-terrain-3d.elf
make dc-fft-bands-terrain-3d      # run: ./bin/dc/fft-bands-terrain-3d      # elf: ./build/dc/fft-bands-terrain-3d/fft-bands-terrain-3d.elf

# [waveform]
make dc-waveform                  # run: ./bin/dc/waveform                  # elf: ./build/dc/waveform/waveform.elf
make dc-sound-envelope-2d-iso     # run: ./bin/dc/sound-envelope-2d-iso     # elf: ./build/dc/sound-envelope-2d-iso/sound-envelope-2d-iso.elf
make dc-sound-envelope-3d         # run: ./bin/dc/sound-envelope-3d         # elf: ./build/dc/sound-envelope-3d/sound-envelope-3d.elf
make dc-waveform-terrain-3d       # run: ./bin/dc/waveform-terrain-3d       # elf: ./build/dc/waveform-terrain-3d/waveform-terrain-3d.elf

[controls]

    [dreamcast]                                       [desktop]
    [LT]/[RT] .................... zoom out/in        [F]/[V] .................... zoom in/out
    [ANALOG STICK] ............... lamp strafe        [J]/[L] [I]/[K] ............ lamp strafe
    [X]/[Y] ...................... cycle tracks       [S]/[D] .................... cycle tracks
    [DPAD] ....................... orbit camera       [ARROW KEYS] ............... orbit camera
    [START] ...................... pause/resume       [ENTER] .................... pause/resume
    [B]/[A] ...................... seek cursor        [C]/[X] .................... seek cursor
    [START]+[A] .................. exit               [ESC] ...................... exit
    [START]+[B] .................. initiate disc swap

[desktop ports]

#[unix]
./build.sh desktop # builds and runs all demos
make desktop-<demo> # e.g.: make desktop-fft-terrain-3d -> ./bin/desktop/fft-terrain-3d

#[windows]
./build.bat # builds all desktop demos
./build.bat <demo> # e.g: ./build.bat fft-terrain-3d -> bin/desktop/fft-terrain-3d.exe

[run / build / clean]
    flycast_run.sh .................... flycast_run.sh runs wrappers in ./bin/dc/
    .elf targets ...................... /pc assets enter CDI build via mkdcdisc
    build.sh .......................... build.sh builds Dreamcast demos; ./build.sh desktop for desktop
    build.bat ......................... build.bat builds Windows desktop demos
    make clean-all .................... removes Dreamcast + desktop build artifacts and their logs
    make clean-dc ..................... removes Dreamcast build artifacts and Dreamcast logs
    make clean-desktop ................ removes desktop build artifacts and desktop logs
    build.bat clean ................... removes windows desktop build artifacts

[third party]
    raylib ............................ raylib.com / github.com/raysan5/raylib
    raylib4Consoles ................... github.com/raylib4Consoles/raylib
    raylib4Dreamcast .................. github.com/raylib4Consoles/raylib4Dreamcast
    GLdc .............................. gitlab.com/simulant/GLdc
    sh4zam ............................ github.com/gyrovorbis/sh4zam
    KallistiOS ........................ github.com/KallistiOS/KallistiOS
    KOS docs .......................... kos-docs.dreamcast.wiki
    mkdcdisc .......................... gitlab.com/simulant/mkdcdisc
    Shadertoy ......................... shadertoy.com
    Shadertoy media ................... Shadertoy media files
    fftw .............................. fftw.org / github.com/fftw/fftw3

[todo]
    add polygon mode for QUAD wire frame in GLdc
    prove analysis backends via librosa/essentia, see mathworks/README.txt

[license]
    This project is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This project is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    See LICENSE for details.