Feat/audio trimming waveform selector#22
Merged
Conversation
Introduce ClampedWav to trim ref/UTAU audio to user-specified ranges; expose offset_sec/duration_sec on ExpressionLoader. Shift extracted ticks by UTAU trim offset to fix silent MIDI misalignment. Add WaveSurferRangeSelector UI component with two-way timestamp bindings. Wire ref_start/ref_end/utau_start/utau_end through GUI, CLI, and process_expressions(). Fix time_to_ticks to output rounded integer ticks. Vendor WaveSurfer.js 7.8.10 via hatch build hook.
WaveSurfer's enableDragSelection misinterprets a mousedown at scrollLeft=0 as a drag gesture, creating a zero-width region at t=0. This then propagates through the Python binding where `end=0` collapses to None, causing a full-width region to be drawn. Fix by clamping scrollLeft to a minimum of 2 whenever the scroll container reaches the leftmost position.
- Remove scroll-clamp workaround for spurious drag regions - Sync zoom slider value on ws 'zoom' event - Emit 'ready' event with duration and trigger range change on load - Clear regions and reset zoom before loading new wav - Guard apply() with duration > 0.001 to avoid premature execution
Add a `trim_silence` bool arg (default: True) to DynLoader and TencLoader. When enabled, extract_wav_rms masks silent edge frames with NaN, and any tick positions where the UTAU signal is silent are subsequently masked in the aligned reference RMS before expression computation. zscore calls are updated to use nan_policy='omit' to handle the new NaN values correctly. feat(wavtool): move extract_wav_mfcc, extract_wav_frequency, extract_wav_rms to utils/wavtool Consolidate the three audio feature extraction helpers that were duplicated across expressions/pitd.py, expressions/dyn.py and expressions/tenc.py into utils/wavtool.py. extract_wav_rms gains a mask_silence parameter backed by Otsu thresholding (skimage). Add scikit-image to pyproject.toml dependencies. Downstream expression modules now import from utils.wavtool. feat(cli): extract add_expression_args_group and str2bool into utils/cli Move the argument-group building logic from expressive.py into a reusable add_expression_args_group() helper. Bool-typed args are wired through a new str2bool() converter with [True, False] as choices, replacing plain type=bool which argparse cannot deserialise from command-line strings. feat(gui): add Trim Silence toggle to dyn and tenc expression cards fix(log): mark __main__ block as pragma: no cover style(ui): increase waveform scrollbar height from 6px to 10px test(wavtool): add tests for extract_wav_mfcc, extract_wav_rms, extract_wav_frequency, get_wav_end_ts, ClampedWav test(cli): add tests for str2bool and add_expression_args_group; expand formatter coverage test: add test_worker.py covering WorkerContext dataclass and setup_worker_context i18n: update pot/po files for trim_silence strings and wavtool cache messages
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.