$ErrorActionPreference='Stop' $root=Split-Path -Parent $PSScriptRoot Set-Location $root $config=Get-Content config.json -Raw | ConvertFrom-Json $python=Join-Path $root $config.piper.pythonPath if(-not (Test-Path $python)){throw 'Falta .venv. Ejecuta scripts\instalar.ps1'} $voice=Join-Path $root "voices\$($config.piper.voice).onnx" if(-not (Test-Path $voice)){throw 'Falta la voz. Ejecuta scripts\descargar_voz.ps1'} New-Item -ItemType Directory -Path 'data\audio' -Force | Out-Null $output=Join-Path $root 'data\audio\prueba_voz.wav' & $python -m piper --data-dir voices -m $config.piper.voice -f $output -- 'Hola, soy Luna Virtual, tu presentadora digital. Bienvenidos al directo.' if($LASTEXITCODE -ne 0){throw 'Piper fallo generando la prueba'} if(-not (Test-Path $output)){throw 'Piper no creo el WAV'} $player=New-Object System.Media.SoundPlayer $output $player.PlaySync() $player.Dispose() Write-Host "Prueba terminada. WAV: $output" -ForegroundColor Green