Aegisub icon indicating copy to clipboard operation
Aegisub copied to clipboard

Spectrum Display Improvement

Open Colerar opened this issue 2 years ago • 5 comments

  1. Different Spectrum Mapping, likes in Adobe Audition, from linear to logarithmic.

    In fact, there is a PR #94, and it works well for me. Maybe this branch is no longer active :( so not merged

  2. Better Window Function - Wikipedia Based on #94, there are still some issues. image Look at the underlined part, it seems strange. As far as I know, the performance above is similar to Hamming window funtion, screenshot in Adobe Audition - Hamming window function: Screenshot in Adobe Audition - Hamming Window Function FFmpeg provides varieties of window functions, see FFmpeg filters - showfreqs. For reference, Adobe Audition uses Blackman-Harris (i.e. bharris) as the default.

:) The two enhancement requests are in order to improve efficiency. I lack cpp development experience so I can only raise a issue instead of PR. 😢

Colerar avatar Mar 02 '22 14:03 Colerar

  1. Currently, there is no specific windowing (aka rectangular window) in Aegisub. In AudioSpectrumRenderer::FillBlock(), it should have been located between ConvertToFloat() and fftw_execute(). Given the goal of this spectrogram I’m not sure this is really required, but I could add one. However I’m not sure that what we see in the first screenshot is the result of a lack of window—maybe.

EleonoreMizo avatar Apr 13 '22 22:04 EleonoreMizo

If you can add one, I'll appreciate so much. :)

Colerar avatar Apr 14 '22 06:04 Colerar

I implemented a Blackman-Harris window, but I won’t make a pull request for it because this is a clear regression from a productivity point of view. The reason is simple: with a rectangular window, the main lobe of a frequency component is very sharp (and the side lobes quite high but this is not a problem here), whereas the main lobe of a more sophisticated window is much wider, and it looks blurry when displayed. So voiced components are less obvious to detect visually.

aegisub-win-rectangular aegisub-win-blackman-harris Rectangular (no window) | Blackman-Harris

EleonoreMizo avatar Apr 16 '22 12:04 EleonoreMizo

Thanks for your contribution again.

I partly agree with you. Blackman-Harris windows looks a bit blurry. But it improves the SNR. If a source audio has a lot of noise, Blackman-Harris may be a better choice.

You can add an option if you want, let user to decide. Options are better than nothing.

Colerar avatar Apr 16 '22 13:04 Colerar

For example, in this case, low frequency and repetitive SFX (can be regraded as noise) make the spectrum out of reference value.

Rectangular window:

image

Blackman-Harris:

image

Colerar avatar Apr 18 '22 11:04 Colerar