Skip to content

Instantly share code, notes, and snippets.

@pa-0
Forked from hiepxanh/add-voice.ps
Last active May 30, 2025 23:02
Show Gist options
  • Save pa-0/30b411965e9b8cf7094f814f8d1bc655 to your computer and use it in GitHub Desktop.
Save pa-0/30b411965e9b8cf7094f814f8d1bc655 to your computer and use it in GitHub Desktop.
Add microsoft core voice to any application can use
$sourcePath = 'HKLM:\software\Microsoft\Speech_OneCore\Voices\Tokens' #Where the OneCore voices live
$destinationPath = 'HKLM:\SOFTWARE\Microsoft\Speech\Voices\Tokens' #For 64-bit apps
$destinationPath2 = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens' #For 32-bit apps
cd $destinationPath
<#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 #Get the path of this voices key
copy -Path $source -Destination $destinationPath -Recurse
copy -Path $source -Destination $destinationPath2 -Recurse
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment