Download the PHP package nosun/edge-tts without Composer
On this page you can find all versions of the php package nosun/edge-tts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nosun/edge-tts
More information about nosun/edge-tts
Files in nosun/edge-tts
Package edge-tts
Short Description edge-tts is a laravel package that allows you to use Microsoft Edge's online text-to-speech service from within your laravel code
License MIT
Informations about the package edge-tts
Edge TTS for Laravel
edge-tts is a Laravel package that allows you to use Microsoft Edge's online text-to-speech service from within your Laravel code. No Azure API Key required - this package uses the free Edge Read Aloud API.
Features
- 🎤 Text to Speech: Convert text to natural-sounding speech using Microsoft's neural voices
- 🌍 Multi-language Support: Support for 100+ languages and locales
- ⚡ Speech Customization: Adjust rate, pitch, and volume
- 💾 Flexible Storage: Save to local file or Laravel Storage
- 🎮 Artisan Commands: Command-line interface for quick usage
- 🔄 Streaming Support: Stream audio data in real-time
- 📝 Metadata Support: Word and sentence boundary metadata for subtitle generation
- 🔧 Smart Text Processing: Automatic text splitting and special character handling
- 🛡️ Robust Error Handling: Detailed exception types and automatic retry mechanisms
Requirements
- PHP >= 8.1
- Laravel >= 10.0 || >= 11.0
- ext-json
Installation
You can install the package via Composer:
Configuration
The package works with default configuration out of the box. If you want to customize the settings, publish the config file:
This will create config/edge-tts.php with the following options:
Usage
Using Facade
Customizing Speech Parameters
Streaming Audio with Metadata
Voice Management
Using Dependency Injection
Artisan Commands
List Available Voices
Synthesize Text to Speech
Popular Voices
Here are some popular voices you can use:
| Voice Name | Language | Gender | Description |
|---|---|---|---|
en-US-JennyNeural |
English (US) | Female | Warm, professional |
en-US-GuyNeural |
English (US) | Male | Deep, confident |
zh-CN-XiaoxiaoNeural |
Chinese (Mandarin) | Female | Natural Chinese |
zh-CN-YunxiNeural |
Chinese (Mandarin) | Male | Clear Chinese |
en-GB-SoniaNeural |
English (UK) | Female | British accent |
ja-JP-NanamiNeural |
Japanese | Female | Japanese |
ko-KR-SunHiNeural |
Korean | Female | Korean |
fr-FR-DeniseNeural |
French | Female | French |
de-DE-KatjaNeural |
German | Female | German |
es-ES-ElviraNeural |
Spanish | Female | Spanish |
Run php artisan edge-tts:voices to see the complete list.
Speech Parameters
Rate
Controls the speaking speed.
- Format:
±X%(e.g.,+50%,-30%) - Range: Approximately
-100%to+100% - Default:
+0%
Pitch
Controls the voice pitch.
- Format:
±XHz(e.g.,+10Hz,-5Hz) - Or relative:
high,low,default - Default:
+0Hz
Volume
Controls the audio volume.
- Format:
±X%(e.g.,+50%,-20%) - Range:
-100%to+100% - Default:
+0%
Output Formats
audio-24khz-96kbitrate-mono-mp3(Default)audio-24khz-48kbitrate-mono-mp3audio-16khz-128kbitrate-mono-mp3audio-16khz-64kbitrate-mono-mp3audio-16khz-32kbitrate-mono-mp3
Examples
Controller Example
Job Example
Testing
Run the package tests:
Generate code coverage report:
Important Notes
API Limitations
- This package uses Microsoft Edge's free Read Aloud API
- There may be rate limits or usage restrictions
- The API could change at any time (Microsoft controls this)
Network Requirements
- Requires HTTPS/WebSocket connectivity to Microsoft servers
- Firewall must allow outbound connections to
speech.platform.bing.com
Long Text
- For very long text, consider splitting into smaller chunks
- Streaming is recommended for long texts to reduce memory usage
Troubleshooting
Connection Issues
- Check your internet connection
- Verify firewall allows WebSocket connections
- Try increasing the timeout in config
Authentication Issues
- This is usually caused by clock skew between your server and Microsoft's servers
- The package includes automatic clock skew detection and retry
- If persistent, check your server's system clock
Voice Not Found
- Run
php artisan edge-tts:voicesto see available voices - Use the exact
ShortNamevalue
No Audio Received
- Verify your text is not empty
- Check if the voice supports the language of your text
- Review network connectivity
Unexpected Response
- This indicates the service returned an unexpected format
- Check if Microsoft has updated their API
- Ensure you're using the latest version of this package
SSL/TLS Issues
Ensure your PHP installation has proper SSL certificates configured.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Nosun
- All Contributors
This package is inspired by:
- rany2/edge-tts - Python implementation
- ericc-ch/edge-tts - TypeScript implementation
License
The MIT License (MIT). Please see License File for more information.
All versions of edge-tts with dependencies
ext-json Version *
laravel/framework Version ^10.0|^11.0
textalk/websocket Version ^1.6