1. Go to this page and download the library: Download b7s/fluentvox library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
b7s / fluentvox example snippets
$result = FluentVox::make()
->text('Hello, world! This is FluentVox speaking.')
->generate();
return [
'python_path' => '/path/to/venv/bin/python', // Linux/macOS
// or
'python_path' => 'C:\\path\\to\\venv\\Scripts\\python.exe', // Windows
// ...
];
use B7s\FluentVox\FluentVox;
$result = FluentVox::make()
->text('Hello, world! This is FluentVox speaking.')
->generate();
echo "Audio saved to: " . $result->outputPath;
echo "Duration: " . $result->getFormattedDuration();
$result = FluentVox::make()
->text('Hello, I sound just like the reference!')
->voiceFrom('/path/to/reference.wav')
->generate();
use B7s\FluentVox\Enums\Language;
$result = FluentVox::make()
->multilingual()
->text('Bonjour le monde!')
->language(Language::French)
->generate();
$result = FluentVox::make()
->text('Wow, this is absolutely amazing!')
->expressive()
->slow()
->generate();
// Generate audio at CD quality (44.1kHz)
$result = FluentVox::make()
->text('High quality audio output')
->sampleRate(44100)
->generate();
// Professional audio (48kHz)
$result = FluentVox::make()
->text('Professional quality')
->sampleRate(48000)
->generate();
// Standard English model (500M params)
FluentVox::make()->standard() // Best for general use with emotion controls
// Turbo model - faster, with paralinguistic tags (350M params)
FluentVox::make()->turbo() // Fastest, supports [laugh], [cough] tags
// Multilingual model - 23+ languages (500M params)
FluentVox::make()->multilingual() // For non-English languages
// Clone voice from reference audio
->voiceFrom('/path/to/reference.wav') // Use this person's voice
// Alias
->cloneVoice('/path/to/reference.wav')
// Use default voice
->defaultVoice() // Use model's built-in voice
use B7s\FluentVox\Enums\Language;
->language(Language::French)
->language(Language::Japanese)
->language(Language::Portuguese)
// Shortcuts for common languages
->english()
->french()
->spanish()
->german()
->portuguese()
->japanese()
->chinese()
// Temperature (0.05-5.0, default=0.8)
->temperature(0.6)
// Presets
->deterministic() // 0.3 - Consistent, predictable output
->creative() // 1.2 - More varied, spontaneous speech
// Seed for reproducibility (0 = random)
->seed(42) // Use same seed to get identical results
// Trim silence from reference audio
->trimSilence() // Remove silence/noise from voice sample
// Keep silence (default)
->keepSilence() // Use reference audio as-is
// Auto-detect best device (default)
->autoDevice() // Automatically selects CUDA > MPS > CPU
// Force CUDA (NVIDIA GPU)
->cuda() // Use NVIDIA GPU (Linux/Windows)
// Force MPS (Apple Silicon)
->mps() // Use Apple Metal (M1/M2/M3 Macs)
// Force CPU
->cpu() // Use CPU only (slower but always available)
// Set output path
->saveTo('/path/to/output.wav') // Save to specific location
->output('/path/to/output.wav') // alias
// Set sample rate (Hz)
->sampleRate(44100) // Resample to 44.1kHz (CD quality)
->sampleRate(48000) // Resample to 48kHz (professional audio)
->nativeSampleRate() // Use model's native rate (24kHz, default)
// Set timeout (seconds)
->timeout(600) // Maximum time to wait for generation
// Enable verbose output
->verbose() // Show detailed generation logs
// Progress callback
->onProgress(function (string $output, bool $isError) {
echo $output; // Monitor generation progress in real-time
})
// Generate and save to file
$result = FluentVox::make()
->text('Hello!')
->generate(); // Returns GenerationResult object
// Generate and get raw audio data
$audioData = FluentVox::make()
->text('Hello!')
->generateRaw(); // Returns raw WAV bytes as string