-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtts.ps1
More file actions
55 lines (42 loc) · 1.44 KB
/
Copy pathtts.ps1
File metadata and controls
55 lines (42 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
[CmdletBinding(DefaultParameterSetName = "Single")]
param(
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = "Single")]
[string]$Text,
[Parameter(ParameterSetName = "Single")]
[ValidateSet("tara", "leah", "jess", "leo", "dan", "mia", "zac", "zoe")]
[string]$Voice = "tara",
[Parameter(Mandatory = $true, ParameterSetName = "Script")]
[string]$ScriptFile,
[Parameter()]
[string]$Output
)
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
$Python = Join-Path $Root ".venv\Scripts\python.exe"
$Script = Join-Path $Root "gguf_orpheus.py"
$MultiScript = Join-Path $Root "multi_speaker_tts.py"
if (-not (Test-Path -LiteralPath $Python)) {
throw "Python virtual environment not found: $Python"
}
if (-not (Test-Path -LiteralPath $Script)) {
throw "TTS script not found: $Script"
}
if ($PSCmdlet.ParameterSetName -eq "Script") {
if (-not (Test-Path -LiteralPath $MultiScript)) {
throw "Multi-speaker script not found: $MultiScript"
}
if (-not (Test-Path -LiteralPath $ScriptFile)) {
throw "Script file not found: $ScriptFile"
}
if (-not $Output) {
throw "Output is required for multi-speaker mode."
}
$ArgsList = @($MultiScript, "--script", $ScriptFile)
} else {
$ArgsList = @($Script, "--text", $Text, "--voice", $Voice)
}
if ($Output) {
$ArgsList += @("--output", $Output)
}
& $Python @ArgsList
exit $LASTEXITCODE