Ejemplo n.º 1
0
    unlink($filewav);
}
if (file_exists($filemp3)) {
    unlink($filemp3);
}
require 'vendor/autoload.php';
use Lame\Lame;
use Lame\Settings;
// perform TTS using pico2wave
try {
    exec('/usr/bin/pico2wave -l=' . $lng . ' -w=' . $filewav . ' "' . $msg . '"');
} catch (\RuntimeException $e) {
    var_dump($e->getMessage());
}
// encoding type
$encoding = new Settings\Encoding\Preset();
$encoding->setType(Settings\Encoding\Preset::TYPE_STANDARD);
// lame settings
$settings = new Settings\Settings($encoding);
// lame wrapper
$lame = new Lame('/usr/bin/lame', $settings);
// convert wav - mp3 using lame
try {
    $lame->encode($filewav, $filemp3);
} catch (\RuntimeException $e) {
    var_dump($e->getMessage());
}
// send the converted mp3 back to the client
if (file_exists($filemp3)) {
    header('Content-Transfer-Encoding: binary');
    header('Content-Type: audio/mpeg');
Ejemplo n.º 2
0
 /**
  *
  * @depends testGetOptionsHasPresetOption 
  */
 public function testPresetValueInGetOptionsEqualsGetType($preset)
 {
     $this->assertEquals($this->encoding->getType(), $preset);
 }