Basic Usage
Core Functionality
Authenticate
The first step is to initialize the SDK client with the credentials that have been provided to you:
# AUTHENTICATE CLIENT
client = pex.PexSearchClient("CLIENT_ID", "CLIENT_SECRET")// AUTHENTICATE CLIENT
client, err := pex.NewPexSearchClient("clientID", "clientSecret")
if err != nil {
panic(err)
}
defer client.Close()// AUTHENTICATE CLIENT
$client = new Pex\PexSearchClient(CLIENT_ID, CLIENT_SECRET);// AUTHENTICATE CLIENT
let client = new pex.PexSearchClient(CLIENT_ID, CLIENT_SECRET)
await client.connect()Generate Fingerprint
Before performing any searches you need to generate a fingerprint from a media file:
# CREATE AN AUDIO FINGERPRINT FROM MEDIA FILE
ft = client.fingerprint_file(
"/path/to/file.mp3",
pex.FingerprintType.AUDIO
)
# CREATE A MELODY + PHONETIC FINGERPRINT FROM MEDIA FILE
ft = client.fingerprint_file(
"/path/to/file.mp3",
pex.FingerprintType.MELODY | pex.FingerprintType.PHONETIC
)
# CREATE A CLASSIFICATION FINGERPRINT FROM MEDIA FILE
ft = client.fingerprint_file(
"/path/to/file.mp3",
pex.FingerprintType.CLASSIFICATION
)// CREATE AN AUDIO FINGERPRINT FROM MEDIA FILE
ft, err := client.FingerprintFile(
inputFile,
pex.FingerprintTypeAudio,
)
// CREATE A MELODY + PHONETIC FINGERPRINT FROM MEDIA FILE
ft, err := client.FingerprintFile(
inputFile,
pex.FingerprintTypeMelody|pex.FingerprintTypePhonetic,
)
// CREATE A CLASSIFICATION FINGERPRINT FROM MEDIA FILE
ft, err := client.FingerprintFile(
inputFile,
pex.FingerprintTypeClassification,
)Alternatively, a fingeprint can be created from a byte buffer holding a media file
Search Functionality
Initiate Search (With Fingerprint)
Once the fingerprint has been generated, you are ready to initiate a search:
Initiate Search (With ISRC)
If you know the ISRC of the query file you would like to search with, you can prepare a search with the ISRC instead of a fingerprint. If a corresponding asset is found associated with the ISRC, the search will initiate as usual.
Retrieve Search Results
Once a search is complete, you can retrieve the results of the search:
Interpret Search Results
To view details on what's contained in a search response, please see the following section: Search Response
Last updated