2017 © Pedro Peláez
 

library musly-php

PHP wrapper around the `musly` command

image

iammordaty/musly-php

PHP wrapper around the `musly` command

  • Wednesday, July 25, 2018
  • by iammordaty
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

iammordaty/musly-php

musly-php is simple PHP wrapper around the musly commandline tool., (*1)

Musly is a fast and high-quality audio music similarity library written in C/C++., (*2)

-- Musly website, (*3)

Installation

It's recommended that you use Composer to install musly-php., (*4)

$ composer require iammordaty/musly-php

Requirements

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

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 commandline tool help for more information., (*6)

Tests

Copy phpunit.xml.dist file to phpunit.xml and use PHPUnit to run tests:, (*7)

$ ./vendor/bin/phpunit

Further information

License

iammordaty/musly-php is licensed under the MIT License., (*8)

The Versions

25/07 2018

dev-master

9999999-dev

PHP wrapper around the `musly` command

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar iammordaty

php library wrapper musly music-similarity