{"id":26105369,"url":"https://github.com/willwade/sherpaonnxazuresapi-installer","last_synced_at":"2025-04-12T18:26:28.374Z","repository":{"id":281072338,"uuid":"904458298","full_name":"willwade/SherpaOnnxAzureSAPI-installer","owner":"willwade","description":"SAPI interface for sherpa-onnx","archived":false,"fork":false,"pushed_at":"2025-03-08T03:42:47.000Z","size":435,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T12:46:52.033Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willwade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-16T23:41:21.000Z","updated_at":"2025-03-07T19:26:40.000Z","dependencies_parsed_at":"2025-03-07T20:38:53.357Z","dependency_job_id":null,"html_url":"https://github.com/willwade/SherpaOnnxAzureSAPI-installer","commit_stats":null,"previous_names":["willwade/sherpaonnsttssapiinstaller","willwade/sherpaonnxazuresapi-installer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willwade%2FSherpaOnnxAzureSAPI-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willwade%2FSherpaOnnxAzureSAPI-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willwade%2FSherpaOnnxAzureSAPI-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willwade%2FSherpaOnnxAzureSAPI-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willwade","download_url":"https://codeload.github.com/willwade/SherpaOnnxAzureSAPI-installer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248611976,"owners_count":21133218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-09T21:06:38.168Z","updated_at":"2025-04-12T18:26:28.344Z","avatar_url":"https://github.com/willwade.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TTS Installer\n\nThis project contains a complete installer for TTS voices, integrating with Sherpa ONNX and Azure TTS, downloading models dynamically, and registering them with SAPI5.\n\n## Features\n- Downloads the latest `merged_models.json` dynamically from the web\n- Handles MMS and non-MMS models differently during installation\n- Registers the TTS voices with correct language codes (LCIDs) for SAPI5\n- Uses Sherpa ONNX for offline TTS audio generation\n- Supports Azure TTS for cloud-based high-quality voices with styles and roles\n- Provides interactive voice selection for both Sherpa ONNX and Azure TTS\n- Supports configuration file for storing Azure credentials securely\n\n## Prerequisites\n1. Install [.NET 6.0](https://dotnet.microsoft.com/en-us/download) or later\n2. Install [WiX Toolset v4](https://wixtoolset.org/docs/intro/)\n3. Install WiX .NET CLI Tool:\n   ```bash\n   dotnet tool install --global wix\n   ```\n4. Ensure the `dotnet` CLI is available in your system PATH\n5. For Azure TTS: An Azure subscription with Speech Service resource\n\n## Building the Project\n\n**Note**: Building the WiX installer requires administrative privileges. Run your terminal/PowerShell as Administrator.\n\n1. **Clean and Restore**:\n   ```bash\n   dotnet clean TTSInstaller.csproj\n   dotnet restore TTSInstaller.csproj\n   ```\n\n2. **Build the TTS Project**:\n   ```bash\n   dotnet build TTSInstaller.csproj -c Release\n   ```\n\n3. **Sign the Sherpa-ONNX Assembly (if needed)**:\n   If you encounter strong name signing errors, you'll need to sign the sherpa-onnx assembly:\n   \n   a. Generate a strong name key:\n   ```bash\n   dotnet build KeyGenerator/KeyGenerator.csproj -t:GenerateKeyFile\n   ```\n   \n   b. Sign the assembly:\n   ```bash\n   dotnet run --project SignAssembly/SignAssembly.csproj\n   ```\n\n## Installing Voices\n\n### Interactive Mode\nRun the installer without arguments to enter interactive mode:\n```bash\ndotnet run --project TTSInstaller.csproj\n```\n\nThis will present a menu with options to:\n1. Install Sherpa ONNX voice\n2. Install Azure TTS voice\n3. Uninstall all voices\n4. Exit\n\n### Command Line Installation - Sherpa ONNX\n```bash\ndotnet run --project TTSInstaller.csproj -- install \u003cmodel-id\u003e\n```\n   \nAvailable model IDs include:\n- `piper-en-joe-medium` - Male English voice\n- `piper-en-amy-medium` - Female English voice\n\n### Command Line Installation - Azure TTS\n```bash\ndotnet run --project TTSInstaller.csproj -- install-azure \u003cvoice-name\u003e --key \u003csubscription-key\u003e --region \u003cregion\u003e [--style \u003cstyle\u003e] [--role \u003crole\u003e]\n```\n\nExample:\n```bash\ndotnet run --project TTSInstaller.csproj -- install-azure en-US-GuyNeural --key YOUR_SUBSCRIPTION_KEY --region eastus\n```\n\n### Listing Available Azure Voices\nTo see all available Azure voices for your subscription:\n```bash\ndotnet run --project TTSInstaller.csproj -- list-azure-voices --key \u003csubscription-key\u003e --region \u003cregion\u003e\n```\n\n### Saving Azure Configuration\nTo save your Azure credentials for future use:\n```bash\ndotnet run --project TTSInstaller.csproj -- save-azure-config --key \u003csubscription-key\u003e --region \u003cregion\u003e [--secure \u003ctrue|false\u003e]\n```\n\nThis will save your Azure credentials to a configuration file, which will be used automatically when no key or region is provided in subsequent commands.\n\n### Uninstalling Voices\nTo uninstall all voices:\n```bash\ndotnet run --project TTSInstaller.csproj -- uninstall all\n```\n\nTo uninstall a specific voice:\n```bash\ndotnet run --project TTSInstaller.csproj -- uninstall \u003cvoice-name\u003e\n```\n\n**Note**: Installation requires administrative privileges to register COM components.\n\n## Testing the Installation\n```bash\ndotnet run --project SimpleTest/SimpleTest.csproj\n```\n   \nThis will:\n- List all available voices (Sherpa ONNX, Azure TTS, and standard voices)\n- Test speech synthesis with installed voices\n- For Azure voices, test style and role features if available\n\n## Azure TTS Integration\n\n### Azure Key Management\nAzure subscription keys are managed in the following ways:\n\n1. **Configuration file**:\n   ```bash\n   dotnet run --project TTSInstaller.csproj -- save-azure-config --key \u003csubscription-key\u003e --region \u003cregion\u003e\n   ```\n   This saves your Azure credentials to a configuration file at `%APPDATA%\\OpenSpeech\\azure_config.json`.\n   \n   By default, the subscription key is encrypted for security. You can disable encryption with:\n   ```bash\n   dotnet run --project TTSInstaller.csproj -- save-azure-config --key \u003csubscription-key\u003e --region \u003cregion\u003e --secure false\n   ```\n\n2. **Command-line parameters**:\n   ```bash\n   dotnet run --project TTSInstaller.csproj -- install-azure \u003cvoice-name\u003e --key \u003csubscription-key\u003e --region \u003cregion\u003e\n   ```\n   Command-line parameters override any settings in the configuration file.\n\n3. **Interactive prompts**:\n   When using interactive mode, you'll be prompted to enter your subscription key and region.\n   If a configuration file exists, you can press Enter to use the saved credentials.\n\n4. **Registry storage**:\n   Keys are stored in the registry during voice installation, allowing the voices to work without re-entering the key.\n\n### Azure Voice Features\n\n#### Styles and Roles\nMany Azure voices support styles and roles for more expressive speech:\n\n- **Styles**: Different speaking styles like cheerful, sad, excited, etc.\n- **Roles**: Different character roles the voice can portray\n\nTo use a style or role:\n```bash\ndotnet run --project TTSInstaller.csproj -- install-azure \u003cvoice-name\u003e --key \u003csubscription-key\u003e --region \u003cregion\u003e --style \u003cstyle\u003e --role \u003crole\u003e\n```\n\nExample with style:\n```bash\ndotnet run --project TTSInstaller.csproj -- install-azure en-US-AriaNeural --key YOUR_KEY --region eastus --style cheerful\n```\n\n### SSML Requirement for Azure Voices\n\n**Important Note**: Azure TTS voices require SSML (Speech Synthesis Markup Language) to work properly. This means:\n\n1. In applications that support SSML, Azure voices will work correctly.\n2. In applications that only use the standard `SelectVoice()` method without SSML, Azure voices may not work.\n\nThis is a limitation of how Azure TTS integrates with SAPI, as Azure voices require additional parameters (subscription key, region, etc.) that are only accessible through SSML.\n\nFor developers integrating with these voices, we recommend using SSML for all Azure voice interactions:\n\n```csharp\n// Example SSML for Azure voice\nstring ssml = $@\"\u003cspeak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'\u003e\n    \u003cvoice name='Microsoft Server Speech Text to Speech Voice (en-GB, OliverNeural)'\u003e\n        This is a test of the Azure voice.\n    \u003c/voice\u003e\n\u003c/speak\u003e\";\n\n// Use SSML with the speech synthesizer\nspeechSynthesizer.SpeakSsml(ssml);\n```\n\n### Security Considerations\n- Azure subscription keys are stored in the Windows Registry and/or configuration file\n- Keys in the configuration file are encrypted by default using Windows DPAPI\n- Keys are only accessible to administrators and the SYSTEM account\n- Consider using environment variables for keys in sensitive environments\n- The installer validates keys before installation to ensure they work\n\n## Publishing and Distribution\n\n### Publish the TTS Application\n```bash\ndotnet publish TTSInstaller.csproj -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true\n```\n\n### Build the WiX Installer (requires admin privileges)\n```bash\nwix build TTSInstaller.wxs -o TTSInstaller.msi -b .\n```\n\n## Installation\n\n### For End Users\n- Double-click the generated `TTSInstaller.msi`\n- Or run from command line:\n  ```bash\n  msiexec /i TTSInstaller.msi\n  ```\n\n### For Development/Testing\nManual COM registration (if needed):\n```bash\n\u0026 \"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\regasm.exe\" \"publish\\OpenSpeechTTS.dll\" /codebase\n```\n\n### Uninstallation\nTo uninstall:\n- Use Windows Control Panel\n- Or run from command line:\n  ```bash\n  msiexec /x TTSInstaller.msi\n  ```\n\n## Troubleshooting\n\n### Common Issues and Solutions\n\n#### Strong Name Signing Errors\nIf you see errors like:\n```\nCould not load file or assembly 'sherpa-onnx, Version=1.9.12.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required.\n```\n\nFollow the signing steps in the \"Building the Project\" section to sign the sherpa-onnx assembly.\n\n#### Voice Not Appearing in SAPI Applications\n1. Verify the COM registration:\n   ```bash\n   reg query \"HKLM\\SOFTWARE\\Microsoft\\SPEECH\\Voices\\Tokens\\\u003cvoice-name\u003e\" /s\n   ```\n   \n2. Check the registry entries for the voice attributes:\n   ```bash\n   reg query \"HKLM\\SOFTWARE\\Microsoft\\SPEECH\\Voices\\Tokens\\\u003cvoice-name\u003e\\Attributes\" /s\n   ```\n\n3. Ensure the COM DLL is properly registered:\n   ```bash\n   \u0026 \"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\regasm.exe\" \"C:\\Program Files\\OpenAssistive\\OpenSpeech\\OpenSpeechTTS.dll\" /codebase\n   ```\n\n4. For Azure voices, remember they require SSML to work properly. Applications that don't use SSML may not be able to use Azure voices.\n\n#### Azure TTS Specific Issues\n\n##### Invalid Subscription Key or Region\nIf you see \"Error: Invalid Azure subscription key or region\":\n1. Verify your subscription key is correct\n2. Ensure the region is valid (e.g., eastus, westus, etc.)\n3. Check that your Azure subscription is active\n4. Verify the Speech Service resource is properly set up in Azure\n\n##### Azure Voice Not Found\nIf you see \"Error: Azure voice 'X' not found\":\n1. Use the `list-azure-voices` command to see all available voices\n2. Ensure you're using the correct voice name format (e.g., en-US-GuyNeural)\n3. Check if the voice is available in your selected region\n\n##### Style or Role Not Available\nIf you see \"Warning: Style/Role 'X' not available for this voice\":\n1. Not all voices support all styles and roles\n2. Use the `list-azure-voices` command to see available styles and roles\n3. Check the Azure documentation for voice capabilities\n\n##### Azure Voice Not Working in Applications\nIf Azure voices don't work in certain applications:\n1. Check if the application supports SSML - Azure voices require SSML to work properly\n2. Try using the voice with SSML in our SimpleTest application to verify it works\n3. For applications that don't support SSML, Azure voices may not be usable\n\n##### Configuration File Issues\nIf you're having issues with the configuration file:\n1. Check if the file exists at `%APPDATA%\\OpenSpeech\\azure_config.json`\n2. Try recreating the configuration file with the `save-azure-config` command\n3. If encryption issues occur, try saving without encryption using `--secure false`\n\n##### Network Issues\nIf you experience timeouts or connection errors:\n1. Check your internet connection\n2. Verify your firewall isn't blocking connections to Azure\n3. Try a different Azure region that might be closer to your location\n\n#### Debugging Logs\nCheck the log files at:\n- `C:\\OpenSpeech\\sherpa_debug.log` - General debug information\n- `C:\\OpenSpeech\\sherpa_error.log` - Error details\n- `C:\\OpenSpeech\\azure_debug.log` - Azure TTS debug information\n\n## License\nThis project is licensed under Apache 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillwade%2Fsherpaonnxazuresapi-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillwade%2Fsherpaonnxazuresapi-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillwade%2Fsherpaonnxazuresapi-installer/lists"}