\AJDurant\ACRCloudACRCloud

The ACRCloud class

Summary

Methods
Properties
Constants
__construct()
identify()
No public properties found
No constants found
getWavData()
apiPost()
No protected properties found
N/A
No private methods found
$access_key
$access_secret
$base_url
$api_version
$ffmpeg_path
N/A

Properties

$access_key

$access_key : string

Type

string — The API key for calls to ACRCloud

$access_secret

$access_secret : string

Type

string — The API secret for calls to ACRCloud

$base_url

$base_url : string

Type

string — The API url for ACRCloud

$api_version

$api_version : string

Type

string — The API version uri for ACRCloud

$ffmpeg_path

$ffmpeg_path : string

Type

string — The path to the ffmpeg executable on the system

Methods

__construct()

__construct(  $access_key,   $access_secret, string|null  $base_url = null, string|null  $ffmpeg_path = null) 

Constructs the ACRCloud library class for use.

Parameters

$access_key
$access_secret
string|null $base_url

The API url for ACRCloud

string|null $ffmpeg_path

The path to the ffmpeg executable on the system

identify()

identify(string  $file_path, integer  $start = 5, integer  $duration = 20) : array

Fingerprints audio files returning track data

Parameters

string $file_path

System file path for the track to identify

integer $start

Seconds from start to trim for fingerprinting

integer $duration

Length in seconds for trimming for fingerprinting

Returns

array —

ACRCloud metadata response

getWavData()

getWavData(string  $file_path, integer  $start, integer  $duration) : string

Trims down input file to PCM data using ffmpeg

Using ffmpeg to transcode to wav and dump a fragment to stdout then reading it with popen() example command: ffmpeg -i "somefile.mp3" -ac 1 -ar 8000 -f wav -ss 5 -t 10 - 2>/dev/null

Parameters

string $file_path

System file path for the track to identify

integer $start

Seconds from start to trim for fingerprinting

integer $duration

Length in seconds for trimming for fingerprinting

Returns

string —

PCM data as a string

apiPost()

apiPost(string  $data) : array

POST audio data to the ACRCloud server for identification

Parameters

string $data

Audio data as a string

Returns

array —

ACRCloud server response