Skip to content

disable_separation and Safety Check#295

Open
RobUmf wants to merge 20 commits intorakuri255:mainfrom
RobUmf:main
Open

disable_separation and Safety Check#295
RobUmf wants to merge 20 commits intorakuri255:mainfrom
RobUmf:main

Conversation

@RobUmf
Copy link

@RobUmf RobUmf commented Feb 1, 2026

Added safety checks for instrumental and vocals audio file paths with --disable_separation before conversion to mp3

Summary by CodeRabbit

  • New Features

    • Added --cache_override_path command-line option to customize the cache folder location
  • Bug Fixes

    • Improved handling when vocal or instrumental audio files are missing to avoid processing errors
    • Added informative bypass messages when audio components are unavailable for processing

RobUmf added 18 commits January 20, 2026 00:09
Adding the bash mixer script to handle 1.4x volume boosting and prevent overmodulation.
Instructions with options
"Updated default volume from 1.4x to 1.2x. During testing, 1.4x caused slight overmodulation in tracks transitioning between high-resonance strings and percussive piano. 1.2x provides the necessary 'Sweet Spot' boost while maintaining clean head-room."
Being compliant with  according to CodeFactor
--disable_separation flag, allowing users to provide pre-separated vocal stems (e.g., from a high-quality manual extraction or specialized external tools). When active, UltraSinger skips the Demucs separation phase entirely, significantly reducing processing time and preventing redundant extraction.
A high-performance Python utility designed to compress and migrate large music archives for mobile devices, flip phones, and portable storage.
Notice I didn't add the flag options
Unnecessary comment.  OUT
Should I delete or reduce other commits.
Removed bypass mode print statements and variable assignments for vocals and instrumental paths.
How about?
# Denoise vocal audio
    if settings.use_separated_vocal:
        denoised_output_path = os.path.join(
            process_data.process_data_paths.cache_folder_path, process_data.basename + "_denoised.wav"
        )
        
        denoise_vocal_audio(input_path, denoised_output_path, settings.skip_cache_denoise_vocal_audio)
        # Update input_path to the denoised version for the next step (Pitch Tracking)
        input_path = denoised_output_path
    else:
        # In Bypass Mode, we skip denoising the full song to prevent distortion/overmodulation
        print(f"{ULTRASINGER_HEAD} {gold_highlighted('Bypass Mode:')} {cyan_highlighted('Skipping vocal denoising.')}")
Added safety checks for instrumental and vocals audio file paths before conversion.
With --disable_separation on going to mp3

Error purposely created.
Add safety checks for audio file conversions
Was having problem preventing hugging face downloading the bin files
Add cache_override_path to Settings.py
been converted to py
Moving to different branch
Deleted bottom one
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

Adds a new CLI option --cache_override_path wired into settings, guards instrumental and vocal conversion steps with existence checks, and conditions vocal/instrumental separation logic in audio processing to run only when settings.use_separated_vocal is enabled.

Changes

Cohort / File(s) Summary
Settings
src/Settings.py
No functional API changes; small newline/formatting adjustment around calculate_score reported.
CLI / Init & Settings
src/UltraSinger.py
Introduced --cache_override_path CLI option and wired it into settings (Settings.cache_override_path).
Audio processing & conversion
src/UltraSinger.py
Guarded instrumental and vocal conversion steps with file-existence checks in CreateUltraStarTxt; moved/conditioned vocal/instrumental separation block in CreateProcessAudio to execute only when settings.use_separated_vocal is true; adjusted input path selection and minor formatting.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant UltraSinger
    participant FS as FileSystem
    participant Converter

    CLI->>UltraSinger: start (args, --cache_override_path)
    UltraSinger->>UltraSinger: init_settings (set cache_override_path)
    UltraSinger->>FS: check input audio path exists
    alt use_separated_vocal
        UltraSinger->>Converter: separate vocals/instrumental
        Converter->>FS: write separated files
        UltraSinger->>FS: check separated vocal/instrumental exist
    end
    UltraSinger->>Converter: convert vocal (if exists)
    UltraSinger->>Converter: convert instrumental (if exists)
    Converter->>FS: write converted outputs
    UltraSinger->>CLI: finish (results / warnings)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through args and found a trail,
A cache flag sings beyond the vale,
I check each file before I play,
Split the voice, then dance away,
Small guards, bright paths — a tidy tale.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title mentions safety checks, which aligns with the PR's main objective of adding validation checks for audio file paths. However, the title is vague and incompletely reflects the actual changes, which include a new cache_override_path CLI option not mentioned in the title. Consider a more specific title like 'Add safety checks for pre-separated audio paths and cache override option' to fully capture both main changes in this PR.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/Settings.py`:
- Line 62: Change the default for cache_override_path from an empty string to
None in Settings.py so the existing check in UltraSinger.py (if
settings.cache_override_path is None) works as intended; update the declaration
of cache_override_path to use None (referencing the variable name
cache_override_path in Settings.py) so UltraSinger.py will fall back to
os.path.join(settings.output_folder_path, "cache") when no override is provided.

In `@src/UltraSinger.py`:
- Around line 399-404: The karaoke conversion silently skips when
settings.create_karaoke is true but
process_data.process_data_paths.instrumental_audio_file_path is missing; add an
else branch after the existing if to emit the same bypass message used in the
v1.1.0+ branch (i.e., log/print that karaoke creation was skipped because no
instrumental audio was produced) so users see feedback for the
karaoke_output_path decision; reference the same variables used here
(settings.create_karaoke, FormatVersion.V1_1_0, karaoke_output_path,
process_data.process_data_paths.instrumental_audio_file_path,
convert_wav_to_mp3) and keep the message consistent with the newer-format
branch.
🧹 Nitpick comments (1)
src/UltraSinger.py (1)

416-418: Silent skip of vocals conversion — inconsistent with instrumental handling.

The instrumental branch (line 412–413) logs a message when skipping, but the vocals branch silently skips. Add a similar log for consistency and debuggability.

Proposed fix
         if process_data.process_data_paths.vocals_audio_file_path:
             convert_wav_to_mp3(process_data.process_data_paths.vocals_audio_file_path, vocals_output_path)
+        else:
+            print(f"{ULTRASINGER_HEAD} Skipping vocals conversion (Bypass mode).")

Comment on lines 399 to +404
if settings.create_karaoke and version.parse(settings.format_version.value) < version.parse(
FormatVersion.V1_1_0.value):
karaoke_output_path = os.path.join(settings.output_folder_path, process_data.basename + " [Karaoke].mp3")
convert_wav_to_mp3(process_data.process_data_paths.instrumental_audio_file_path, karaoke_output_path)

if process_data.process_data_paths.instrumental_audio_file_path:
convert_wav_to_mp3(process_data.process_data_paths.instrumental_audio_file_path, karaoke_output_path)
Copy link

@coderabbitai coderabbitai bot Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Silent skip of karaoke conversion when instrumental is unavailable — user gets no feedback.

When --disable_separation is used, instrumental_audio_file_path is never set, so the karaoke MP3 is silently not created. The v1.1.0+ branch (line 413) prints a bypass message, but this older-format branch does not. Users expecting a karaoke file will be confused.

Proposed fix: add a similar bypass message
     if process_data.process_data_paths.instrumental_audio_file_path:
         convert_wav_to_mp3(process_data.process_data_paths.instrumental_audio_file_path, karaoke_output_path)
+    else:
+        print(f"{ULTRASINGER_HEAD} Skipping karaoke conversion (Bypass mode).")
🤖 Prompt for AI Agents
In `@src/UltraSinger.py` around lines 399 - 404, The karaoke conversion silently
skips when settings.create_karaoke is true but
process_data.process_data_paths.instrumental_audio_file_path is missing; add an
else branch after the existing if to emit the same bypass message used in the
v1.1.0+ branch (i.e., log/print that karaoke creation was skipped because no
instrumental audio was produced) so users see feedback for the
karaoke_output_path decision; reference the same variables used here
(settings.create_karaoke, FormatVersion.V1_1_0, karaoke_output_path,
process_data.process_data_paths.instrumental_audio_file_path,
convert_wav_to_mp3) and keep the message consistent with the newer-format
branch.

Copy link
Owner

@rakuri255 rakuri255 Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RobUmf can you check this?
Maybe just use the given prompt for your ai

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

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