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

Spectrum display improvement #94

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

EleonoreMizo
Copy link

@EleonoreMizo EleonoreMizo commented Dec 15, 2020

Context: sometimes, for subtitling music videos, it is important to synchronize subtitles to the music. Most of the music energy is located in the bass frequencies, but the current spectrum display packs everything in the 2–3 bottom lines, which is unreadable. Generally, in audio software, spectrum is displayed on a logarithmic frequency scale, spacing octaves linearly, giving more display room for the bass frequencies. Anyway, something in-between linear and log is probably the most suitable for subtitling, showing clearly both the vocal formants and the low-frequency content (bass drum and other instruments).

This patch adds the following:

– Selection of 5 different frequency mappings for the spectrum display, from linear (current default) to logarithmic (octaves are spaced linearly). Internally, the mapping is done by adjusting the vertical position of the 1 kHz band. Formula here.
– Field added in the preference page to select this frequency mapping.
– New preference key to remember this setting: Audio/Renderer/Spectrum/FreqCurve

It also fixes some existing quirks:

– Consistent display with high sampling rates (> 48 kHz). Previously, the FFT size was not adjusted depending on the sampling rate, leading to a poor frequency resolution in the audible part of the spectrum.
– Display is clipped to 20 kHz, so ultrasonic content does not waste the space at high sampling rates anymore.
– Fixed time shift with high quality settings (code copied from another Aegisub fork)
– Previous “interpolate” mode was buggy (minband added twice + range not checked leading to corrupted display)

This patch also makes the high and insane qualities actually useful, showing much more details from the lower part of the spectrum.

The following picture shows, in “better” spectrum quality:

  1. Top: standard linear display
  2. Middle: medium mapping
  3. Bottom: logarithmic mapping. It is suggested to increase the quality setting when using this scale, to improve the resolution of the lower part of the spectrum.

spectrum

EleonoreMizo and others added 2 commits December 15, 2020 20:11
– Selection of different frequency mappings for the spectrum display,
from linear (current default) to logarithmic.
– Field added in the preference page to select the frequency mapping
– New preference key to remember this setting:
Audio/Renderer/Spectrum/FreqCurve
– Consistent display with high sampling rates (> 48 kHz)
– Fixed time shift with high quality settings
@CoffeeFlux
Copy link
Member

Thanks for rebasing, though it seems it still has conflicts? If you can get this cleanly rebased I'll review promptly - sorry for all the delays.

@EleonoreMizo
Copy link
Author

I thought the conflict was solved. Or am I missing something? Sorry I’m not very comfortable with using git and I fear breaking everything with a wrong command. Thank you for replying.

MIRIMIRIM added a commit to AmusementClub/Aegisub that referenced this pull request Aug 3, 2022
TypesettingTools#94

– Selection of different frequency mappings for the spectrum display,
from linear (current default) to logarithmic.
– Field added in the preference page to select the frequency mapping
– New preference key to remember this setting:
Audio/Renderer/Spectrum/FreqCurve
– Consistent display with high sampling rates (> 48 kHz)
– Fixed time shift with high quality settings

Co-Authored-By: EleonoreMizo <[email protected]>
MIRIMIRIM added a commit to AmusementClub/Aegisub that referenced this pull request Aug 3, 2022
* Spectrum display improvement

TypesettingTools#94

– Selection of different frequency mappings for the spectrum display,
from linear (current default) to logarithmic.
– Field added in the preference page to select the frequency mapping
– New preference key to remember this setting:
Audio/Renderer/Spectrum/FreqCurve
– Consistent display with high sampling rates (> 48 kHz)
– Fixed time shift with high quality settings

Co-authored-by: EleonoreMizo <[email protected]>
@CoffeeFlux
Copy link
Member

@EleonoreMizo Sorry for only just getting to this, but I'm looking back through PRs to land before cutting a stable off Aegisub/Aegisub in hopefully a couple weeks. In update_derivation_values, why do you only adjust the values when the sampling rate ratio is greater than 1? Wouldn't you want to just pick a target rate and adjust it in all cases where it doesn't match?

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

Successfully merging this pull request may close these issues.

2 participants