Skip to content

Added audio normalization#307

Draft
tombogle wants to merge 44 commits into
masterfrom
audio-normalization
Draft

Added audio normalization#307
tombogle wants to merge 44 commits into
masterfrom
audio-normalization

Conversation

@tombogle

@tombogle tombogle commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

This change is Reviewable

tombogle and others added 26 commits February 11, 2025 16:50
Passing the PublishingModel into the PublishingMethodBase.PublishChapter method
Removed extra copy of lame from Installer
correct names of boxes in post processing UI
save values from post processing UI in model
add region to improve readability
start pause constraining
@tombogle tombogle changed the title Added some UI to select audio normalization options Added audio normalization Sep 2, 2025
@tombogle

Copy link
Copy Markdown
Contributor Author

Run the "finished product" by Jerry Walker (MD & S) for suggestions for improvement.

tombogle and others added 2 commits July 8, 2026 01:41
… during export

- Replaced the disabled paragraph/section pause placeholder blocks in
  ClipRepository.MergeAudioFiles with a single per-clip loop that picks the
  applicable pause settings (clip, paragraph, or section) for each boundary,
  based on script information supplied by a new getScriptLine callback. The
  callback maps clip file names to block numbers, so gaps from unrecorded,
  skipped, or invalid clips do not shift the lookup, and extraneous clips
  degrade gracefully to clip-pause handling.
- Added ScriptLine.ParagraphStart, set by ParatextParagraph.BreakIntoBlocks
  on the first block of each paragraph, to support paragraph pause detection.
- Renamed SentencePause to ClipPause throughout (settings interface, model,
  project settings XML, and Publish dialog controls) to match its actual
  meaning: the pause between any two consecutive clips.
- Reworked noise reduction during merge: silence is now measured on
  noise-reduced copies of the clips so background noise cannot obscure the
  pauses. A DOUBLE_PASS_NOISE_REDUCTION define (on by default) controls
  whether those copies are also joined, giving published audio a per-clip
  pass — now uniform, including the first clip — in addition to the
  whole-chapter pass, or whether the chapter pass is the only one that
  affects published audio. Also fixed ffmpeg filter escaping and path
  quoting in ReduceNoise.
- Publish dialog now initializes the audio normalization controls from
  persisted settings, saves the choices before the pre-publish problem
  check, and disables the normalization panel while publishing.
- Added release notes entry; minor cleanup in tests.

Also, in PublishDialog:
- Publish button is now initially disabled and only enabled once an audio format is selected.
- All four PauseData constructors read from _numericSectionPauseMin/Max (a copy-paste bug)
- PublishingMethodBase.PublishChapter: enter the post-processing region
  when only chapter pause constraining is enabled (previously it was
  silently skipped unless volume normalization or noise reduction was
  also on), and guard against a null ChapterPause.
- ClipRepository.MergeAudioFiles: use null-conditional access in the
  pause normalization entry condition, and clear all three pause
  settings (not just ClipPause) on error so subsequent chapters do not
  re-enter the failing path.
- Extract the clip/paragraph/section pause selection logic into
  ClipRepository.GetPauseToApply so it can be unit tested directly.
- Add ClipRepositoryNormalizationTests covering pause selection,
  MergeAudioFiles pause normalization entry/skip/error paths, and the
  chapter pause block in PublishingMethodBase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tombogle
tombogle marked this pull request as ready for review July 8, 2026 21:26
@tombogle
tombogle requested review from andrew-polk and removed request for andrew-polk July 8, 2026 21:26
- Prevent failures when paths contain spaces
- Renamed misleading methods
- Leading silence detection only counts silence at *start* of the clip
- Parsing now uses InvariantCulture - works with comma-decimal locales like German
- Improved performace: trailing silence is measured with a single areverse,silencedetect filter chain instead of writing reversed copy to disk
- Added tests for GetDurationOfLeadingSilence and GetDurationOfTrailingSilence.
- Exclude transient ScriptLine.ParagraphStart field from serialization (with unit test)
- One-line (unrelated) code cleanup in LameEncoder.cs
@tombogle
tombogle force-pushed the audio-normalization branch from 2a4bc7f to 1fcad5a Compare July 11, 2026 20:38
tombogle added 2 commits July 11, 2026 17:57
The filter is now simply -af arnndn=m=...
It also handles the stereo edge case (per-clip noise reduction runs before the mono conversion, and arnndn processes each channel independently). Output remains 48 kHz exactly as before.
@tombogle
tombogle marked this pull request as draft July 17, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants