v1.1.0
Release Notes: v1.1.0
New features
Text-to-Speech (TTS) API Integration
- Added support for GroqCloud's Text-to-Speech API
- Implemented the
Speechclass with a fluent interface for easy configuration - Added a new
speech()method to theAudioclass - Added support for both English and Arabic TTS models
Implementation details
- Models: Added support for
playai-tts(English) andplayai-tts-arabic(Arabic) - Parameters:
model(): Set the TTS model to useinput(): Define text to convert to speechvoice(): Set voice identifier (e.g., "Bryan-PlayAI")responseFormat(): Define output format (default: "wav")
- Methods:
create(): Returns audio content as streamsave($filePath): Saves audio directly to a file
Example usage
// Save audio to file
$result = $groq->audio()->speech()
->model('playai-tts')
->input('Hello, this text will be converted to speech')
->voice('Bryan-PlayAI')
->responseFormat('wav')
->save('output.wav');
// Get as stream (e.g., to send to browser)
$audioStream = $groq->audio()->speech()
->model('playai-tts')
->input('This is another example text')
->voice('Bryan-PlayAI')
->create();
header('Content-Type: audio/wav');
header('Content-Disposition: inline; filename="speech.wav"');
echo $audioStream;Documentation
Updated README.md to include comprehensive documentation about the new TTS functionality.
Additional notes
- Text-to-Speech requires acceptance of terms of use in the GroqCloud console
- For more detailed examples, see
examples/audio-speech.php