podcasthosting/audiowaveform-php-client

PHP包装器,用于方便地访问BBC项目audiowaveform客户端。

v0.1.3 2024-09-10 09:33 UTC

This package is auto-updated.

Last update: 2024-09-10 09:43:38 UTC


README

该项目易于使用。它实现了命令行audiowaveform命令的所有参数作为方法。脚本调用shell命令。因此,必须安装audiowaveform才能使此脚本工作。

创建一个新的AudiowaveformClient类的实例以使用它。它将自动尝试检测audiowaveform命令的安装位置。

$ac = new AudiowaveformClient();

获取已安装的audiowaveform版本

echo $ac->getVersion();

__constructor() 方法调用名为 detectAndSetPath() 的方法来查找 audiowaveform 二进制文件。

您可以使用setter方法 setBinaryName(string $binaryName) 来覆盖二进制文件的名称。

所有参数都有自己的setter方法

  • setColors(string $color)
  • setWaveformColor(string $color)
  • setBorderColor(string $color)
  • setBackgroundColor(string $color)
  • setAxisLabelColor(string $color)
  • setInputFilename(string $name)
  • setInputFormat(string $name)
  • setOutputFilename(string $name)
  • setSplitChannels()
  • setPixelsPerSecond(Int $pixels)
  • setBits(Int $bits)
  • setStart(Int $start)
  • setEnd(Int $end)
  • setWidth(Int $width)
  • setHeight(Int $height)
  • setNoAxisLabels()
  • setWithAxisLabels()
  • setAmplitudeScale(Float $scale)
  • setCompression(Int $level)
  • setCompression(Int $level)
  • setQuiet()
  • 等等

setInputFilename()setOutputFilename() 是必需的。

设置所有参数后,您必须调用 execute() 方法来运行程序,例如:

$ac = new AudiowaveformClient()
$ac->setInputFilename('my-audio-file.mp3');
$ac->setBackgroundColor('000000');
$ac->setPixelsPerSecond(300);
$ac->setOutputFilename('my-audio-file.dat');
$ac->execute();

您还可以将所有setter链接起来

(new AudiowaveformClient)->setInputFilename('other-audio.wav')setColors('ff9900')->setPixelsPerSecond(300)->setOutputFilename('my-audio-file.dat')->execute();