alemidev / scope-tui

a simple oscilloscope/vectorscope/spectroscope for your terminal
MIT License
175 stars 12 forks source link

Feature request: Spectrogram #9

Open eye-wave opened 2 months ago

eye-wave commented 2 months ago

I don't know what else to say. Spectrogram would be a really cool addition for this app

izotope: understanding spectrograms

eye-wave commented 2 months ago

i already tried making it myself, but afaik ratatui graphs do not allow for solid blocks that would look the best for this usecase.

joshka commented 1 month ago

It's maybe not quite fully what you're looking for, but I added ChartType::Bar to the Chart widget just recently in https://github.com/ratatui-org/ratatui/pull/1205. This should be out in Ratatui 0.27.1 (and is likely in an alpha release already).

I don't think it would get close to that image though :D

alemidev commented 1 month ago

hi! sorry for my late replies

Spectrogram would be a really cool addition for this app

it definitely would @eye-wave ! right now i have a spectogram implemented (you can reach it cycling views with TAB), but it is only an instant view: there is no color shading for history. to support such a view i need to first rework a bit how we receive audio data: right now scope-tui completely relies on your audio backend and thus receives only an "instant" of what is being played, keeping instead an internal buffer would allow to display history (and also to have higher refresh rates! by showing "half" of the new "window" and a smoother visualization)

i plan to do this eventually :tm: but it's not a very small change, some work will be required :)

It's maybe not quite fully what you're looking for, but I added ChartType::Bar to the Chart widget just recently in ratatui-org/ratatui#1205

thanks! this looks great and it definitely helps a ton, but to achieve a usable spectrogram with history we probably need to be able to shade bar blocks individually. i think it's possible as both cava and btop do it, i'm not sure if ratatui already supports it from 0.27.1, i may look into adding such feature into ratatui first! once again thanks @joshka for maintaining this awesome library!! c:

eye-wave commented 1 month ago

oh speaking of usable spectrogram history, that would be also nice for other stuff. for example using smaller buffer with a oscilloscope to achieve the resolution of huge buffers that normally would drop the framerate to 1 or 2