@tritard/waterbrother 0.14.21 → 0.14.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/voice.js +14 -8
package/package.json
CHANGED
package/src/voice.js
CHANGED
|
@@ -714,14 +714,20 @@ export async function setupVoice(onStatus) {
|
|
|
714
714
|
playArgs = [mp3Path];
|
|
715
715
|
} else if (process.platform === "win32") {
|
|
716
716
|
// Use sox to play the audio — it's already installed for recording
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
717
|
+
// Use PowerShell to play MP3 via Windows Media Player COM
|
|
718
|
+
const psScript = `
|
|
719
|
+
$wmp = New-Object -ComObject WMPlayer.OCX
|
|
720
|
+
$wmp.URL = "${mp3Path.replace(/\\/g, "\\\\")}"
|
|
721
|
+
$wmp.controls.play()
|
|
722
|
+
Start-Sleep -Milliseconds 500
|
|
723
|
+
while($wmp.playState -eq 3){ Start-Sleep -Milliseconds 200 }
|
|
724
|
+
$wmp.close()
|
|
725
|
+
`.trim();
|
|
726
|
+
const psPath = path.join(tmpDir, `tts-${ts}.ps1`);
|
|
727
|
+
await fs.writeFile(psPath, psScript);
|
|
728
|
+
cleanupFiles.push(psPath);
|
|
729
|
+
playCmd = "powershell.exe";
|
|
730
|
+
playArgs = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", psPath];
|
|
725
731
|
} else {
|
|
726
732
|
playCmd = "mpv";
|
|
727
733
|
playArgs = ["--no-video", "--really-quiet", mp3Path];
|