scope-tui icon indicating copy to clipboard operation
scope-tui copied to clipboard

Feature request: Spectrogram

Open eye-wave opened this issue 1 year ago • 5 comments

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

izotope: understanding spectrograms

eye-wave avatar Jul 08 '24 10:07 eye-wave

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

eye-wave avatar Jul 08 '24 10:07 eye-wave

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

joshka avatar Jul 23 '24 07:07 joshka

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:

alemidev avatar Aug 02 '24 12:08 alemidev

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

eye-wave avatar Aug 02 '24 12:08 eye-wave

an update on this: I think I completed the generic audio source and can now look into this. I'm still interested in the buffered source thing, which can then be used for the spectrogram view.

I want to stress: using TUI graphics, if I ever get around to doing a spectrogram with history, the resolution will never be as good as the example picture in the first message, especially in the high-end range

alemidev avatar Jun 03 '25 10:06 alemidev