iammordaty/musly-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

iammordaty/musly-php

Composer 安装命令:

composer require iammordaty/musly-php

包简介

PHP wrapper around the `musly` command

README 文档

README

musly-php is a simple PHP wrapper around the musly command-line tool.

Musly is a fast and high-quality audio music similarity library written in C/C++.

-- Musly website

Installation

It is recommended to install musly-php via Composer.

$ composer require iammordaty/musly-php

Requirements

You may also be interested in iammordaty/musly fork, which allows you to calculate the distance between similar tracks (see PR #51 for more information).

Basic usage

use Musly\Musly;

$musly = new Musly();

$musly->initializeCollection();
$musly->analyze('/path/to/dir/or/track.mp3');

$similarTracks = $musly->getSimilarTracks('/path/to/track.mp3');

Advanced usage

use Musly\Collection;
use Musly\Exception\FileNotFoundException;
use Musly\Exception\FileNotFoundInCollectionException;
use Musly\Exception\MuslyProcessFailedException;
use Musly\Musly;

$collection = new Collection([
    'pathname' => '/path/to/collection.musly',
    'similarityMethod' => Collection::SIMILARITY_METHOD_TIMBRE,
    'jukeboxPathname' => '/path/to/collection.jbox',
]);

// ... or
// $collection = new Collection('/path/to/collection.musly');
// $collection->setSimilarityMethod(Collection::SIMILARITY_METHOD_TIMBRE);
// $collection->setJukeboxPathname('/path/to/collection.jbox');

$musly = new Musly([ 'binary' => '/path/to/musly/binary' ]);

try {
    if (!$collection->isInitialized()) {
        $musly->initializeCollection($collection);
    }

    $musly->setCollection($collection);
    $musly->analyze('/path/to/dir/', 'mp3');
    $musly->analyze('/path/to/track.mp3');

    $similarTracks = $musly->getSimilarTracks('/path/to/track.mp3', 20);
    $collectionTracks = $musly->getAllTracks();
}
catch (FileNotFoundException | FileNotFoundInCollectionException $e) {
    // handle exception
}
catch (MuslyProcessFailedException $e) {
    // handle exception
}

See the musly command-line tool help for more information.

Tests

Copy the phpunit.xml.dist file to phpunit.xml, then use PHPUnit to run the tests:

$ ./vendor/bin/phpunit

Further information

License

iammordaty/musly-php is licensed under the MIT License.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固