Script PowerShell per instal·lar veus OneCore per idioma

Aquest script utilitza Add-WindowsCapability per instal·lar els paquets de veu oficials de Microsoft via DISM (eina integrada).

varificar la versió de powershell

$PSVersionTable.PSVersion
powershellCopiaModifica
# Idiomes i veus que vols instal·lar
$languageTags = @(
    "en-US",   # English (US)
    "en-GB",   # English (UK)
    "es-ES",   # Spanish (Spain)
    "ca-ES",   # Catalan (Spain)
    "fr-FR",   # French (France)
    "de-DE"    # German
)

foreach ($lang in $languageTags) {
    Write-Host "Instal·lant veu per a $lang..." -ForegroundColor Cyan
    try {
        # Instal·la la llengua si no existeix
        $langList = Get-WinUserLanguageList
        if (-not ($langList.LanguageTag -contains $lang)) {
            $langList.Add($lang)
            Set-WinUserLanguageList $langList -Force
        }

        # Instal·la la veu OneCore associada
        $capability = "Language.$lang~Basic~~~"
        Add-WindowsCapability -Online -Name $capability -ErrorAction Stop

        # Opcional: activa reconeixement de parla
        $speechCap = "Language.$lang~Speech~~~"
        Add-WindowsCapability -Online -Name $speechCap -ErrorAction SilentlyContinue
    }
    catch {
        Write-Warning "Error instal·lant per a $lang: $_"
    }
}

🧩 Què fa aquest script?

✔️ Funciona amb PowerShell 5.x (Windows PowerShell): parcialment en 7

  • Afegeix l’idioma si cal.
  • Instal·la la veu (OneCore).
  • Intenta afegir també el reconeixement de veu (opcional).
  • Funciona en Windows 10 i 11, però cal accés d’administrador.

2. 🔊 Comprova que les veus apareixen a OneCore:

Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens" | ForEach-Object {
    $keyPath = $_.PSPath
    $subkeys = Get-ChildItem -Path $keyPath -ErrorAction SilentlyContinue
    $displayName = $null

    foreach ($subkey in $subkeys) {
        $subProps = Get-ItemProperty -Path $subkey.PSPath -ErrorAction SilentlyContinue
        if ($subProps.DisplayName) {
            $displayName = $subProps.DisplayName
            break
        }
    }

    [PSCustomObject]@{
        VoiceId = $_.PSChildName
        Name    = $displayName
        Path    = $keyPath
    }
}

i a powerhshell

——- —- —-
MSTTS_V110_caES_Herena Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_deDE_HeddaM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_deDE_KatjaM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_deDE_StefanM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_enGB_GeorgeM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_enGB_HazelM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_enGB_SusanM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_enUS_DavidM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_enUS_MarkM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_enUS_ZiraM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_esES_HelenaM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_esES_LauraM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…
MSTTS_V110_esES_PabloM Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCor…


veus clàssiques (SAPI5)

# Carrega la biblioteca TTS clàssica
Add-Type -AssemblyName System.Speech

# Crea un objecte per accedir al sintetitzador de veu
$voiceSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer

# Obtenir totes les veus instal·lades
$voices = $voiceSynth.GetInstalledVoices()

# Mostra informació detallada de cada veu
foreach ($v in $voices) {
    [PSCustomObject]@{
        Name        = $v.VoiceInfo.Name
        Culture     = $v.VoiceInfo.Culture
        Gender      = $v.VoiceInfo.Gender
        Age         = $v.VoiceInfo.Age
        Description = $v.VoiceInfo.Description
        Attributes  = $v.VoiceInfo.OtherProperties
    }
}

PS C:\Users\urqte> # Carrega la biblioteca TTS clàssica
PS C:\Users\urqte> Add-Type -AssemblyName System.Speech
PS C:\Users\urqte>
PS C:\Users\urqte> # Crea un objecte per accedir al sintetitzador de veu
PS C:\Users\urqte> $voiceSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer
PS C:\Users\urqte>
PS C:\Users\urqte> # Obtenir totes les veus instal·lades
PS C:\Users\urqte> $voices = $voiceSynth.GetInstalledVoices()
PS C:\Users\urqte>
PS C:\Users\urqte> # Mostra informació detallada de cada veu
PS C:\Users\urqte> foreach ($v in $voices) {

[PSCustomObject]@{
    Name        = $v.VoiceInfo.Name
    Culture     = $v.VoiceInfo.Culture
    Gender      = $v.VoiceInfo.Gender
    Age         = $v.VoiceInfo.Age
    Description = $v.VoiceInfo.Description
    Attributes  = $v.VoiceInfo.OtherProperties
}

}

1 Name : Microsoft Helena Desktop
Culture : es-ES
Gender : Female
Age : Adult
Description : Microsoft Helena Desktop – Spanish (Spain)
Attributes :

2 Name : Microsoft Hazel Desktop
Culture : en-GB
Gender : Female
Age : Adult
Description : Microsoft Hazel Desktop – English (Great Britain)
Attributes :

3 Name : Microsoft David Desktop
Culture : en-US
Gender : Male
Age : Adult
Description : Microsoft David Desktop – English (United States)
Attributes :

4 Name : Microsoft Zira Desktop
Culture : en-US
Gender : Female
Age : Adult
Description : Microsoft Zira Desktop – English (United States)
Attributes :

5 Name : Microsoft Hedda Desktop
Culture : de-DE
Gender : Female
Age : Adult
Description : Microsoft Hedda Desktop – German
Attributes :

6 Name : Vocalizer Expressive Jordi Harpo 22kHz
Culture : ca-ES
Gender : Male
Age : Adult
Description : Vocalizer Expressive Jordi Harpo 22kHz
Attributes :


Script PowerShell — Prova de veus SAPI (Desktop)

Add-Type -AssemblyName System.Speech
$tts = New-Object System.Speech.Synthesis.SpeechSynthesizer

$proves = @(
@{ Nom = “Microsoft Helena Desktop”; Missatge = “Hola! Esta es la voz española de Microsoft Helena.” },
@{ Nom = “Microsoft Hazel Desktop”; Missatge = “Hello! This is the British English voice of Microsoft Hazel.” },
@{ Nom = “Microsoft David Desktop”; Missatge = “Hi there! I’m Microsoft David, the American English voice.” },
@{ Nom = “Microsoft Zira Desktop”; Missatge = “Welcome! I am Zira, the female voice for American English.” },
@{ Nom = “Microsoft Hedda Desktop”; Missatge = “Hallo! Ich bin Hedda, die deutsche Stimme von Microsoft.” },
@{ Nom = “Vocalizer Expressive Jordi Harpo 22kHz”; Missatge = “Bon dia! Sóc en Jordi, la veu en català del sistema.” }
)

foreach ($prova in $proves) {
Write-Host “`n🔊 Prova amb veu: $($prova.Nom)” -ForegroundColor Cyan
try {
$tts.SelectVoice($prova.Nom)
$tts.Speak($prova.Missatge)
} catch {
Write-Warning “⚠️ No s’ha pogut trobar o usar la veu: $($prova.Nom)”
}
}

Publicat dins de Veus

Veus disponibles

Script per mostrar noms visibles de totes les veus OneCore:

Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens" | ForEach-Object {
    $keyPath = $_.PSPath
    $voiceProps = Get-ItemProperty -Path $keyPath

    # Cerquem DisplayName dins dels subvalors (per exemple, en-US, es-ES...)
    $subkeys = Get-ChildItem -Path $keyPath -ErrorAction SilentlyContinue

    $displayName = $null

    foreach ($subkey in $subkeys) {
        $subProps = Get-ItemProperty -Path $subkey.PSPath -ErrorAction SilentlyContinue
        if ($subProps.DisplayName) {
            $displayName = $subProps.DisplayName
            break
        }
    }

    [PSCustomObject]@{
        VoiceId = $_.PSChildName
        Name    = $displayName
        Path    = $keyPath
    }
}

PS C:\WINDOWS\system32> Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens" | ForEach-Object {
>>     $keyPath = $_.PSPath
>>     $voiceProps = Get-ItemProperty -Path $keyPath
>>
>>     # Cerquem DisplayName dins dels subvalors (per exemple, en-US, es-ES...)
>>     $subkeys = Get-ChildItem -Path $keyPath -ErrorAction SilentlyContinue
>>
>>     $displayName = $null
>>
>>     foreach ($subkey in $subkeys) {
>>         $subProps = Get-ItemProperty -Path $subkey.PSPath -ErrorAction SilentlyContinue
>>         if ($subProps.DisplayName) {
>>             $displayName = $subProps.DisplayName
>>             break
>>         }
>>     }
>>
>>     [PSCustomObject]@{
>>         VoiceId = $_.PSChildName
>>         Name    = $displayName
>>         Path    = $keyPath
>>     }
>> }

VoiceId                 Name Path
-------                 ---- ----
MSTTS_V110_caES_Herena       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_caES_Herena
MSTTS_V110_deDE_HeddaM       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_deDE_HeddaM
MSTTS_V110_deDE_KatjaM       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_deDE_KatjaM
MSTTS_V110_deDE_StefanM      Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_deDE_StefanM
MSTTS_V110_enGB_GeorgeM      Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_enGB_GeorgeM
MSTTS_V110_enGB_HazelM       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_enGB_HazelM
MSTTS_V110_enGB_SusanM       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_enGB_SusanM
MSTTS_V110_enUS_DavidM       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_enUS_DavidM
MSTTS_V110_enUS_MarkM        Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_enUS_MarkM
MSTTS_V110_enUS_ZiraM        Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_enUS_ZiraM
MSTTS_V110_esES_HelenaM      Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_esES_HelenaM
MSTTS_V110_esES_LauraM       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_esES_LauraM
MSTTS_V110_esES_PabloM       Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\MSTTS_V110_esES_PabloM


PS C:\WINDOWS\system32>

Add-Type -AssemblyName System.Speech
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$synth.GetInstalledVoices() | ForEach-Object {
    $_.VoiceInfo.Name
}

🔍 4. (Opcional) Llistar també les veus modernes (OneCore)

Aquestes veus (com Microsoft Aria, Microsoft Jenny) no apareixen amb System.Speech, però pots veure-les així:

powershellCopiaModificaGet-ChildItem "HKLM:\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens" | ForEach-Object {
    $_.GetValue("")
}

sadsd

profile

Qwen3-235B-A22B

Perfecte! 🎉

Les veus que veus són les veus TTS (Text-to-Speech) instal·lades al teu Windows 11. I sí, les mantindras de forma estable al sistema sempre que no les desinstal·lis o restableixis el sistema a valors d’origen.


✅ Què vol dir això?

Les veus que tens actualment:

Microsoft Hazel Desktopen-GBFemeníAnglès del Regne Unit
Microsoft David Desktopen-USMasculíAnglès dels EUA
Microsoft Zira Desktopen-USFemeníAnglès dels EUA
Microsoft Hedda Desktopde-DEFemeníAlemany
Vocalizer Expressive Jordi Harpoca-ESMasculíCatalà (amb motor de tercers)

🧠 Aquestes veus són compatibles amb l’API clàssica (System.Speech.Synthesis) i poden ser utilitzades per programes com Narrador, Cortana, PowerShell, etc.


💾 Seran estables? Sí 👍

Publicat dins de Veus

🌟🌟 Instal·lar veus angleses (com les de Text-to-Speech o TTS) a Windows 11

Només veus SAPI:

Add-Type -AssemblyName System.Speech
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$synth.GetInstalledVoices() | Select-Object -ExpandProperty VoiceInfo | Format-Table Name, Culture

Name Culture
—- ——-
Microsoft Zira Desktop en-US
Microsoft David Desktop en-US
Microsoft Helena Desktop es-ES
Vocalizer Expressive Jordi Harpo 22kHz ca-ES

per les veus modernes (OneCore),:

Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens" | ForEach-Object {
    $_.GetValue("")
}

Per instal·lar veus angleses (com les de Text-to-Speech o TTS) a Windows 11 mitjançant PowerShell, pots utilitzar el mètode de Add-WindowsCapability o mitjançant registres i eines COM, depenent de la versió de Windows i el tipus de veu (clàssica o de nova generació).

✅ Mètode 1: Instal·lar veus angleses amb Add-WindowsCapability

powershellCopiaModifica# Executar com a administrador

# Exemple per instal·lar veu anglesa dels EUA
--------------------------------------------------------------------------
Add-WindowsCapability -Online -Name "Language.Basic~~~en-US~0.0.1.0"
Add-WindowsCapability -Online -Name "Language.Speech~~~en-US~0.0.1.0"
Add-WindowsCapability -Online -Name "Language.TextToSpeech~~~en-US~0.0.1.0"


Aquest mètode funciona amb paquets de reconeixement de veu i sínt

Altres idiomes (en-GB, en-AU, etc.) també estan disponibles canviant en-US per l’identificador corresponent.

✅ Mètode 2: Afegeix l’idioma complet (amb TTS inclòs)

powershellCopiaModifica# Afegeix anglès dels EUA amb suport de veu
$LangList = New-WinUserLanguageList en-US
$LangList[0].Handwriting = $true
Set-WinUserLanguageList $LangList -Force

Això afegeix l’idioma, però per garantir que la veu estigui disponible, potser necessites reiniciar o obrir manualment la configuració perquè Windows acabi de descarregar els components.


🔄 Mètode avançat: Activar la veu al registre (només si ja està instal·lada)

powershellCopiaModifica# Exemple d'activació d'una veu anglesa si està instal·lada
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0" -Name "411" -Value "Microsoft Zira"

🧪 Com llistar les veus disponibles

powershellCopiaModificaAdd-Type –AssemblyName System.Speech
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$synth.GetInstalledVoices() | Select-Object -ExpandProperty VoiceInfo | Format-Table Name, Culture

❗ Notes

  • Algunes veus modernes (com neural voices de Microsoft) només es poden utilitzar mitjançant serveis de núvol (Azure Cognitive Services).
  • Executa sempre el script amb permisos d’administrador.
  • Algunes veus poden necessitar connexió a Internet per descarregar-se després de la instal·lació.

Script PowerShell per guardar la llista de veus en un fitxer .txt

Add-Type -AssemblyName System.Speech
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer

# Ruta on es desarà el fitxer (escriptori de l'usuari actual)
$outputPath = [System.IO.Path]::Combine([Environment]::GetFolderPath("Desktop"), "Veus_Instal·lades.txt")

# Obtenir les veus i formatejar-les
$voicesInfo = $synth.GetInstalledVoices() | ForEach-Object {
    $voice = $_.VoiceInfo
    "Nom: $($voice.Name)`nIdioma: $($voice.Culture)`nGènere: $($voice.Gender)`nEdat: $($voice.Age)`nDescripció: $($voice.Description)`n---"
}

# Escriure-ho al fitxer
$voicesInfo | Out-File -FilePath $outputPath -Encoding UTF8

# Mostrar confirmació
Write-Output "Llista de veus desada a: $outputPath"

Nom: Microsoft Zira Desktop
Idioma: en-US
Gènere: Female
Edat: Adult

Descripció: Microsoft Zira Desktop – English (United States)

Nom: Microsoft Hazel Desktop
Idioma: en-GB
Gènere: Female
Edat: Adult

Descripció: Microsoft Hazel Desktop – English (Great Britain)

Nom: Microsoft Helena Desktop
Idioma: es-ES
Gènere: Female
Edat: Adult

Descripció: Microsoft Helena Desktop – Spanish (Spain)

Nom: Microsoft Hortense Desktop
Idioma: fr-FR
Gènere: Female
Edat: Adult

Descripció: Microsoft Hortense Desktop – French

Nom: Vocalizer Expressive Jordi Harpo 22kHz
Idioma: ca-ES
Gènere: Male
Edat: Adult

Descripció: Vocalizer Expressive Jordi Harpo 22kHz