param( [string]$InputAudio, [string]$RegionsJson, [string]$OutputDirectory, [switch]$VerifyOnly ) $ErrorActionPreference = 'Stop' $runner = Join-Path $PSScriptRoot 'run_rvc.py' if ($VerifyOnly) { & python -B $runner --verify-only if ($LASTEXITCODE -ne 0) { throw 'Release verification failed.' } return } $runtime = Get-Content -LiteralPath (Join-Path $PSScriptRoot 'runtime.local.json') -Raw -Encoding utf8 | ConvertFrom-Json function To-WslPath([string]$Value) { $full = [IO.Path]::GetFullPath($Value).Replace('\','/') if ($full -notmatch '^[A-Za-z]:/') { throw 'Use an absolute local drive path.' } return '/mnt/' + $full.Substring(0,1).ToLower() + $full.Substring(2) } if (-not $InputAudio) { throw 'Supply -InputAudio with a clean vocal WAV or FLAC.' } $taskArgs = @((To-WslPath $runner), '--input', (To-WslPath ((Resolve-Path -LiteralPath $InputAudio).Path))) if ($RegionsJson) { $taskArgs += @('--regions', (To-WslPath ((Resolve-Path -LiteralPath $RegionsJson).Path))) } if ($OutputDirectory) { $taskArgs += @('--output-dir', (To-WslPath $OutputDirectory)) } & wsl.exe -d $runtime.wsl_distribution -e $runtime.wsl_python -B @taskArgs if ($LASTEXITCODE -ne 0) { throw 'Conversion failed; inspect the new output directory and keep the native audio.' }