TypesettingTools / Aegisub

Cross-platform advanced subtitle editor
http://www.aegisub.org
Other
341 stars 498 forks source link

Spectrum Display Improvement #149

Open Colerar opened 2 years ago

Colerar commented 2 years ago
  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. 😢

EleonoreMizo commented 2 years ago
  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.
Colerar commented 2 years ago

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

EleonoreMizo commented 2 years ago

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

Colerar commented 2 years ago

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 commented 2 years ago

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