rana-tuhin/laravel-voice-ai

AI Voice / Speech Processing package for Laravel

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/rana-tuhin/laravel-voice-ai

dev-main 2025-10-18 20:20 UTC

This package is auto-updated.

Last update: 2025-10-18 20:20:14 UTC


README

Laravel Voice AI

Laravel Voice AI

AI Voice / Speech Processing package for Laravel
Simulate Speech-to-Text (STT) and Text-to-Speech (TTS) operations, with optional AI provider integration.

Installation

Install via Composer:

composer require rana-tuhin/laravel-voice-ai:@dev

Laravel will auto-discover the package.

Publish Configuration

To customize default settings, publish the package config:

php artisan vendor:publish --tag=config

This will create config/voiceai.php in your Laravel project.

Usage

Using the Facade

use VoiceAI;

// Convert audio file to text
$text = VoiceAI::speechToText('storage/audio/sample.wav');

// Convert text to audio
$audioFile = VoiceAI::textToSpeech('Hello world!', 'en-US', 'female');

Using the Service Class Directly

use RanaTuhin\VoiceAI\Services\VoiceService;

// Initialize service
$voice = new VoiceService();

// Convert audio to text
$text = $voice->speechToText('storage/audio/sample.wav');
echo $text; 
// Output: [Simulated] Transcribed text from audio file: storage/audio/sample.wav

// Convert text to audio
$audioFile = $voice->textToSpeech('Hello world!', 'en-US', 'female');
echo $audioFile; 
// Output: [Simulated] Audio file for 'Hello world!' in en-US (female)

Class & Method Reference

Class Method Description Parameters Returns
VoiceService speechToText(string $audioFilePath) Converts audio file to text (simulated) $audioFilePath – path to audio file string
VoiceService textToSpeech(string $text, string $language = 'en-US', string $voice = 'female') Converts text to audio file (simulated) $text, $language, $voice string
VoiceAI (Facade) speechToText(string $audioFilePath) Same as VoiceService::speechToText - string
VoiceAI (Facade) textToSpeech(string $text, string $language = 'en-US', string $voice = 'female') Same as VoiceService::textToSpeech - string