ZoomRx Audio is a PHP wrapper package for audio manipulation and Speech-To-Text operations.
SpeechToText provides a simple and convenient way to utilize the Speech-to-Text services offered by Google, OpenAI, and AssemblyAI. This package serves as a wrapper for the respective APIs, allowing developers to easily transcribe speech audio files into text in their PHP applications.
- Supports three major Speech-to-Text service providers: Google, OpenAI, and AssemblyAI.
- Offers customizable settings for transcribing audio files, such as language,
- Provides error handling and response parsing for easy integration into PHP applications.
- PHP 7.4 or above
- cURL extension enabled
- API key or credentials for the respective Speech-to-Text service providers (Google, OpenAI-Whisper, and AssemblyAI)
- Python for audio manipulation
- Python pydub module
- Python jiwer module
- ffmpeg CLI
To use SpeechToText-PHP in your PHP application, follow these steps:
- Instantiate the SpeechToText class with the desired provider (Google, OpenAI, or AssemblyAI), and pass in the required authentication credentials:
use ZoomRx\Audio\SpeechToText\SpeechToTextFactory; $speechToTextObj = SpeechToTextFactory::create(SpeechToTextFactory::ASSEMBLYAI); $speechToTextObj->setCredentials([ 'api_credential' => 'YOUR-API-KEY' ]);
- Set configurations such as language, punctuate, etc,:
$speechToTextObj->setConfigurations([ 'language' => 'en-US', 'speaker_labels' => true, 'speakers_expected' => 2, 'word_time' => true, 'punctuate' => true ]);
- Invoke transcribe function along with the file path and get results:
$speechToTextResult = $speechToTextObj->transcribe($infile); $transcription = $speechToTextResult->getTranscription();