Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] waveform type 'centroid' #7

Draft
wants to merge 1 commit into
base: waveform-amplitude-fix
Choose a base branch
from

Conversation

m0dB
Copy link
Owner

@m0dB m0dB commented Oct 28, 2023

I have been experimenting with a new waveform visualization that uses the spectral centroid https://en.wikipedia.org/wiki/Spectral_centroid , mapped to hue, and the spectral flatness https://en.wikipedia.org/wiki/Spectral_flatness , mapped to saturation.

The spectral centroid indicates where the center of mass of the spectrum is located, where 0 is in the low frequency band, 0.5 in the mid, and 1 in the high. Normally much more bands are used (typically an FFT) to calculate the spectral centroid. This implementation simply uses the information at hand: the filtered low,mid and high amplitudes (as mapped to R G B color components for the RGB waveform type).

By mapping the spectral centroid to hue, we get a color on a continuous color scale (red - yellow - green - cyan - blue).

Furthermore, I calculate the spectral flatness, which gives an indication of how "strong" the spectral centroid is. By inverse mapping the spectral flatness to saturation, the color is more pronounced for a strong spectral centroid, while it goes towards grey for a flatter spectrum.

Some comparisons between RGB (top) and Centroid (bottom). For example this kick-drum hi-hat sequence:

RGB:
rgb1

Centroid:
centroid1


RGB:
rgb2

Centroid:
centroid2


RGB:
rgb3

Centroid:
centroid3

@m0dB m0dB marked this pull request as draft October 28, 2023 23:45
m0dB added a commit that referenced this pull request Oct 20, 2024
WIP

PreRoll hack

Matrix based on viewport and rect (#7)

* bundle on macos

* use Skin.WaveformDisplay for both decks

* add shaders to mixxx target

* call update from frameSwapped, test with only waveformrendererendoftrack

* avoid error with colorChanged signals

* fix typo in comment

* example cleanup

* keep track of size and viewport to update matrices in waveformwidgetrenderer

* force continuous drawing of end of track, log framerate, use rgbamaterial instead of endoftrack material

* use setViewport instead of resize, protect nullptr

* call setViewport, setRect, setDevicePixelRatio

* replace resize with setViewport, setRect, setDevicePixelRatio

* set matrix with correct offset, minor fixes related with material changes

---------

Co-authored-by: m0dB <m0dB@mixxx.org>

move everything back to declarative style

progress with marks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant