定制 jasny/audio 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jasny/audio

最新稳定版本:v0.1.1

Composer 安装命令:

composer require jasny/audio

包简介

Process audio files using SoX

关键字:

README 文档

README

Process audio files using SoX

Waveform

With the Jasny\Audio\Waveform class you can create a waveform as PNG like:

waveform

$waveform = new Waveform($filename, $options);
$waveform->output();

Alternatively you can request a set of samples. This can be used to set draw a waveform in JavaScript (see waveform.js).

Options

option default unit description
width 1800 pixels Image width
height 280 pixels Image height
color 000000 hex or rgba Color of the graph
axis null hex or rgba Color of the x axis
level null The max amplitute (y axis)
offset null seconds Starting point. Negative counts from end
duration null seconds Duration of the track of chart

Track statistics

$track = new Track($filename);
$track->getStats();
{
    channels: "1",
    dc_offset: "0.000016",
    min_level: "-0.162134",
    max_level: "0.153157",
    pk_lev: "-15.80",
    rms_lev: "-33.56",
    rms_pk: "-24.31",
    rms_tr: "-55.44",
    crest_factor: "7.72",
    flat_factor: "0.00",
    pk_count: "2",
    bit_depth: "30/32",
    length: "1.935601",
    scale_max: "1.000000",
    window: "0.050",
    samples: "42680",
    scaled_by: "2147483647.0",
    maximum_amplitude: "0.153157",
    minimum_amplitude: "-0.162134",
    midline_amplitude: "-0.004489",
    mean_norm: "0.010709",
    mean_amplitude: "0.000016",
    rms_amplitude: "0.020990",
    maximum_delta: "0.115579",
    minimum_delta: "0.000000",
    mean_delta: "0.003656",
    rms_delta: "0.008325",
    rough_frequency: "1391",
    volume_adjustment: "6.168",
    sample_rate: "22050"
}

Convert track

Convert a track to a different format. Uses avconv (or ffmpeg).

$track = new Track("sometrack.wav");
$track->convert("sometrack.mp3");

Combine tracks

Combine two tracks. Uses sox --combine.

Available methods

  • concatenate
  • merge
  • mix
  • mix-power
  • multiply
  • sequence
$track = new Track($track1);
$track->combine($method, $track2, $outputFilename);

统计信息

  • 总下载量: 4.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 52
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 51
  • Watchers: 10
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-22