From 3d69749caf9df052fe9d8fd7c28bb4085425dc8d Mon Sep 17 00:00:00 2001 From: Oleg Petruny Date: Fri, 13 Dec 2024 20:49:09 +0100 Subject: [PATCH] VoiceGenerator --- VoiceGenerator/.gitignore | 4 +++- VoiceGenerator/Install.ps1 | 6 ++--- VoiceGenerator/README.md | 31 +++++++++++++++++++++++++ VoiceGenerator/Uninstall.ps1 | 44 ++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 VoiceGenerator/README.md create mode 100644 VoiceGenerator/Uninstall.ps1 diff --git a/VoiceGenerator/.gitignore b/VoiceGenerator/.gitignore index 7a22e39..a5d2b02 100644 --- a/VoiceGenerator/.gitignore +++ b/VoiceGenerator/.gitignore @@ -1,7 +1,9 @@ * !.gitignore !.gitattributes +!README.md !GenerateDialogue.py -!install.ps1 +!Install.ps1 +!Uninstall.ps1 !voices/ !voices/** \ No newline at end of file diff --git a/VoiceGenerator/Install.ps1 b/VoiceGenerator/Install.ps1 index ac15c7b..857e289 100644 --- a/VoiceGenerator/Install.ps1 +++ b/VoiceGenerator/Install.ps1 @@ -54,12 +54,12 @@ function Setup-Python-Environment { function Install-Espeakng { Write-Output "Installing eSpeak-ng $espeakngVersion..." Invoke-WebRequest -Uri $espeakngInstallerUrl -OutFile $espeakngInstallerPath - Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$espeakngInstallerPath`" /passive" -Wait + Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$espeakngInstallerPath`" /passive /norestart" -Wait Remove-Item $espeakngInstallerPath -Force } function Install-MsBuildTools { - Write-Output "Installing MS Build Tools $msBuildToolsVersion..." + Write-Output "Installing Visual Studio Build Tools $msBuildToolsVersion..." Invoke-WebRequest -Uri $msBuildToolsInstallerUrl -OutFile $msBuildToolsInstallerPath Start-Process -FilePath $msBuildToolsInstallerPath -ArgumentList ` "--passive --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended" -Wait @@ -107,5 +107,5 @@ Install-CUDA Install-PyTorch Install-Coqui mkdir output -Write-Output "Setup finished. Please restart your machine before first startup." +Write-Output "Install finished. Please restart your machine before first startup." Write-Output "To generate dialogue type in PS terminal in VoiceGenerator directory:`n 1] .\Scripts\Activate.ps1`n 2] py GenerateDialogue.py." diff --git a/VoiceGenerator/README.md b/VoiceGenerator/README.md new file mode 100644 index 0000000..a665fbb --- /dev/null +++ b/VoiceGenerator/README.md @@ -0,0 +1,31 @@ +# Voice Generator +Before using the installation is needed. \ +For generation type within directory in PowerShell: + - `.\Scripts\Activate.ps1` + - `py GenerateDialogue.py` +For your own voices create a directory with custom name containing a voice line with the same name. \ +Edit voice name in `GenerateDialogue.py` script. + +# System requirements +OS: Windows 10 or 11 +GPU: NVIDIA +Storage: ~15GB + +# Install.ps1 +By executing the PowerShell script `Install.ps1` the following packages are installed: + - [Python](https://www.python.org/downloads/) 3.11.9 + - [eSpeak-ng](https://github.com/espeak-ng/espeak-ng) 1.51 + - [Visual Studio Build Tools](https://visualstudio.microsoft.com/cs/downloads/?q=build+tools) 17 module "Desktop development with C++" + - [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads) 12.4.1 + - [PyTorch CUDA](https://pytorch.org/get-started/locally/) 12.4 + - [Coqui TTS](https://github.com/idiap/coqui-ai-TTS) 0.25.1 + - [Suno-ai/bark](https://github.com/suno-ai/bark) +It's recommended to run installation script as administrator and restart machine after install completion. + +# Uninstall.ps1 +The uninstall script will try to remove most of the files created during installation. \ +The following packages/data aren't removed: + - Python + - Visual Studio Installer + - voices/ + It's recommended to run uninstallat script as administrator and restart machine after uninstall completion. diff --git a/VoiceGenerator/Uninstall.ps1 b/VoiceGenerator/Uninstall.ps1 new file mode 100644 index 0000000..24fc5d2 --- /dev/null +++ b/VoiceGenerator/Uninstall.ps1 @@ -0,0 +1,44 @@ +$msBuildToolsVersion = "17" +$msBuildToolsInstallerUrl = "https://aka.ms/vs/${msBuildToolsVersion}/release/vs_BuildTools.exe" +$msBuildToolsInstallerPath = "$env:TEMP\vs_BuildTools${msBuildToolsVersion}.exe" + +function Uninstall-Espeakng { + Write-Output "Uninstalling eSpeak NG..." + $app = (Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -like "*eSpeak NG*"}) + Start-Process -FilePath "msiexec.exe" -ArgumentList "/x ${app.IdentifyingNumber} /passive /norestart" +} + +function Uninstall-MsBuildTools { + Write-Output "Uninstalling Visual Studio Build Tools..." + Invoke-WebRequest -Uri $msBuildToolsInstallerUrl -OutFile $msBuildToolsInstallerPath + Start-Process -FilePath $msBuildToolsInstallerPath -ArgumentList ` + "--remove Microsoft.VisualStudio.Workload.VCTools --passive --wait" -Wait + Remove-Item $msBuildToolsInstallerPath -Force +} + +function Uninstall-CUDA { + Write-Output "Uninstalling CUDA Toolkit..." + $uninstall = (gci "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ` + | foreach { gp $_.PSPath } | ? { $_ -like "*CUDA Toolkit*" } | select UninstallString) + $uninstall = ($uninstall.UninstallString -Replace '^"[^"]+"\s+', '') + Start-Process -FilePath "rundll32.exe" -ArgumentList "$uninstall -silent -deviceinitiated" +} + +function Remove-Local-Files { + Write-Output "Removing local files..." + $ExcludeFiles = @(".gitattributes", ".gitignore", "README.md", "GenerateDialogue.py", ` + "Install.ps1", "Uninstall.ps1", "voices") + $FilesToDelete = Get-ChildItem -Path . -File | Where-Object { $_.Name -notin $ExcludeFiles } + foreach ($File in $FilesToDelete) { + Remove-Item -Path $File.FullName -Force + } +} + + + +Write-Output "Starting voice environment uninstall process." +Uninstall-Espeakng +Uninstall-MsBuildTools +Uninstall-CUDA +Remove-Local-Files +Write-Output "Uninstall finished. Please restart your machine to clear temp files."