Go
Go SDK installation and usage
The Go SDK currently only supports Linux and macOS
The SDK only offers to identify the content of a specified section of the file, identifying all the content of the entire file requires traversing the entire file
Obtain SDK
Visit https://github.com/acrcloud/acrcloud_sdk_golang to choose the suitable version according to your needs
Adding dynamic libraries
1. Add the path where the dynamic library is located to the environment variable (temporary)
2. Place the dynamic library in the same directory as your generated go binary program (temporary)
The most convenient way
3. Adding dynamic libraries to the system (permanently)
The following commands all require root privileges to run
Use go get to get the SDK
Initialization
First go to ACRCloud Developer Platform Console > Audio & Video Recognition to get Access Key, Access Secret and Host.
The obtained configuration information is then imported into ACRCloudRecognizer and initialized.
Method
RecognizeByFile(filePath string, startSeconds int, lenSeconds int, userParams map[string]string)
Identify the specified location of multimedia files
params
description
filePath
string,Multimedia file path
startSeconds
int,Recognition start position (unit: second)
lenSeconds
int,Identification length (in seconds, default is 10, maximum is 12)
userParams
map[string]string,Search parameters (only humming search is useful)
Sample code:
RecognizeByFileBuffer(data []byte, startSeconds int, lenSeconds int, userParams map[string]string)
Identify the specified location of the read multimedia file
params
description
data
[]byte,Buffer of the multimedia file to be read
startSeconds
int,Recognition start position (unit: second)
lenSeconds
int,Identification length (in seconds, default is 10, maximum is 12)
userParams
map[string]string,Search parameters (only humming search is useful)
Sample code:
RecognizeByFpBuffer(data []byte, startSeconds int, lenSeconds int, userParams map[string]string)
Identify the location of the fingerprint file that has been read
The usage and detail for generating fingerprint files can be found in the TOOLS > Audio File Fingerprinting Tool
params
description
data
[]byte,Buffer of the fingerprint file
startSeconds
int,Recognition start position (unit: second)
lenSeconds
int,Identification length (in seconds, default is 10, maximum is 12)
userParams
map[string]string,Search parameters (only humming search is useful)
Sample Code:
GetDurationMsByFile(filePath string)
Get the length of the multimedia file
params
description
filePath
string,Multimedia file path
Sample Code:
GetDurationMsByFpBuffer(fpBufferData []byte)
Get the length of the fingerprint file
params
description
fpBufferData
Buffer of the fingerprint file
Sample Code:
Last updated