Skip to content

Instantly share code, notes, and snippets.

@Natsumi-sama
Forked from hiepxanh/add-voice.ps
Last active February 10, 2024 12:42
Show Gist options
  • Save Natsumi-sama/5b73622158b32ad56460865d38c7e19e to your computer and use it in GitHub Desktop.
Save Natsumi-sama/5b73622158b32ad56460865d38c7e19e to your computer and use it in GitHub Desktop.
Add all SAPI voices to OneCore
$sourcePath = 'HKLM:\SOFTWARE\Microsoft\Speech\Voices\Tokens'
$sourcePath32 = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens'
$destinationPath = 'HKLM:\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens'
#cleanup
$listOldVoices = Get-ChildItem $destinationPath
foreach($voice in $listOldVoices)
{
if ($voice.PSChildName.StartsWith("TTS_") -or $voice.PSChildName.StartsWith("IVONA 2")) {
$path = $voice.PSPath
Remove-Item -Path $path -Recurse
}
}
$listVoices = Get-ChildItem $sourcePath
foreach($voice in $listVoices)
{
$source = $voice.PSPath
copy -Path $source -Destination $destinationPath -Recurse
}
$listVoices = Get-ChildItem $sourcePath32
foreach($voice in $listVoices)
{
$source = $voice.PSPath
copy -Path $source -Destination $destinationPath -Recurse
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment