Skip to content

v1.1.0

Choose a tag to compare

@lucianotonet lucianotonet released this 13 Apr 01:29
· 45 commits to main since this release

Release Notes: v1.1.0

New features

Text-to-Speech (TTS) API Integration

  • Added support for GroqCloud's Text-to-Speech API
  • Implemented the Speech class with a fluent interface for easy configuration
  • Added a new speech() method to the Audio class
  • Added support for both English and Arabic TTS models

Implementation details

  • Models: Added support for playai-tts (English) and playai-tts-arabic (Arabic)
  • Parameters:
    • model(): Set the TTS model to use
    • input(): Define text to convert to speech
    • voice(): Set voice identifier (e.g., "Bryan-PlayAI")
    • responseFormat(): Define output format (default: "wav")
  • Methods:
    • create(): Returns audio content as stream
    • save($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