#include <stdint.h>
Go to the source code of this file.
|
CHROMAPRINT_API const char * | chromaprint_get_version (void) |
|
CHROMAPRINT_API ChromaprintContext * | chromaprint_new (int algorithm) |
|
CHROMAPRINT_API void | chromaprint_free (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_get_algorithm (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_set_option (ChromaprintContext *ctx, const char *name, int value) |
|
CHROMAPRINT_API int | chromaprint_get_num_channels (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_get_sample_rate (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_get_item_duration (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_get_item_duration_ms (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_get_delay (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_get_delay_ms (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_start (ChromaprintContext *ctx, int sample_rate, int num_channels) |
|
CHROMAPRINT_API int | chromaprint_feed (ChromaprintContext *ctx, const int16_t *data, int size) |
|
CHROMAPRINT_API int | chromaprint_finish (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_get_fingerprint (ChromaprintContext *ctx, char **fingerprint) |
|
CHROMAPRINT_API int | chromaprint_get_raw_fingerprint (ChromaprintContext *ctx, uint32_t **fingerprint, int *size) |
|
CHROMAPRINT_API int | chromaprint_get_raw_fingerprint_size (ChromaprintContext *ctx, int *size) |
|
CHROMAPRINT_API int | chromaprint_get_fingerprint_hash (ChromaprintContext *ctx, uint32_t *hash) |
|
CHROMAPRINT_API int | chromaprint_clear_fingerprint (ChromaprintContext *ctx) |
|
CHROMAPRINT_API int | chromaprint_encode_fingerprint (const uint32_t *fp, int size, int algorithm, char **encoded_fp, int *encoded_size, int base64) |
|
CHROMAPRINT_API int | chromaprint_decode_fingerprint (const char *encoded_fp, int encoded_size, uint32_t **fp, int *size, int *algorithm, int base64) |
|
CHROMAPRINT_API int | chromaprint_hash_fingerprint (const uint32_t *fp, int size, uint32_t *hash) |
|
CHROMAPRINT_API void | chromaprint_dealloc (void *ptr) |
|
◆ CHROMAPRINT_API
◆ CHROMAPRINT_VERSION_MAJOR
#define CHROMAPRINT_VERSION_MAJOR 1 |
◆ CHROMAPRINT_VERSION_MINOR
#define CHROMAPRINT_VERSION_MINOR 4 |
◆ CHROMAPRINT_VERSION_PATCH
#define CHROMAPRINT_VERSION_PATCH 2 |
◆ ChromaprintContext
◆ ChromaprintMatcherContext
◆ ChromaprintAlgorithm
Enumerator |
---|
CHROMAPRINT_ALGORITHM_TEST1 | |
CHROMAPRINT_ALGORITHM_TEST2 | |
CHROMAPRINT_ALGORITHM_TEST3 | |
CHROMAPRINT_ALGORITHM_TEST4 | |
CHROMAPRINT_ALGORITHM_TEST5 | |
CHROMAPRINT_ALGORITHM_DEFAULT | |
◆ chromaprint_clear_fingerprint()
Clear the current fingerprint, but allow more data to be processed.
This is useful if you are processing a long stream and want to many smaller fingerprints, instead of waiting for the entire stream to be processed.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- 0 on error, 1 on success
◆ chromaprint_dealloc()
Free memory allocated by any function from the Chromaprint API.
- Parameters
-
ptr | pointer to be deallocated |
◆ chromaprint_decode_fingerprint()
CHROMAPRINT_API int chromaprint_decode_fingerprint |
( |
const char * |
encoded_fp, |
|
|
int |
encoded_size, |
|
|
uint32_t ** |
fp, |
|
|
int * |
size, |
|
|
int * |
algorithm, |
|
|
int |
base64 |
|
) |
| |
Uncompress and optionally base64-decode an encoded fingerprint
The caller is responsible for freeing the returned pointer using chromaprint_dealloc().
- Parameters
-
[in] | encoded_fp | pointer to an encoded fingerprint |
[in] | encoded_size | size of the encoded fingerprint in bytes |
[out] | fp | pointer to a pointer, where the decoded raw fingerprint (array of 32-bit integers) will be stored |
[out] | size | Number of items in the returned raw fingerprint |
[out] | algorithm | Chromaprint algorithm version which was used to generate the raw fingerprint |
[in] | base64 | Whether the encoded_fp parameter contains binary data or base64-encoded ASCII data. If 1, it will base64-decode the data before uncompressing the fingerprint. |
- Returns
- 0 on error, 1 on success
◆ chromaprint_encode_fingerprint()
CHROMAPRINT_API int chromaprint_encode_fingerprint |
( |
const uint32_t * |
fp, |
|
|
int |
size, |
|
|
int |
algorithm, |
|
|
char ** |
encoded_fp, |
|
|
int * |
encoded_size, |
|
|
int |
base64 |
|
) |
| |
Compress and optionally base64-encode a raw fingerprint
The caller is responsible for freeing the returned pointer using chromaprint_dealloc().
- Parameters
-
[in] | fp | pointer to an array of 32-bit integers representing the raw fingerprint to be encoded |
[in] | size | number of items in the raw fingerprint |
[in] | algorithm | Chromaprint algorithm version which was used to generate the raw fingerprint |
[out] | encoded_fp | pointer to a pointer, where the encoded fingerprint will be stored |
[out] | encoded_size | size of the encoded fingerprint in bytes |
[in] | base64 | Whether to return binary data or base64-encoded ASCII data. The compressed fingerprint will be encoded using base64 with the URL-safe scheme if you set this parameter to 1. It will return binary data if it's 0. |
- Returns
- 0 on error, 1 on success
◆ chromaprint_feed()
Send audio data to the fingerprint calculator.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
[in] | data | raw audio data, should point to an array of 16-bit signed integers in native byte-order |
[in] | size | size of the data buffer (in samples) |
- Returns
- 0 on error, 1 on success
◆ chromaprint_finish()
Process any remaining buffered audio data.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- 0 on error, 1 on success
◆ chromaprint_free()
Deallocate the Chromaprint context.
Note that when Chromaprint is compiled with FFTW, this function is not reentrant and you need to call it only from one thread at a time. This is not a problem when using FFmpeg or vDSP.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
◆ chromaprint_get_algorithm()
Return the fingerprint algorithm this context is configured to use.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- current algorithm version
◆ chromaprint_get_delay()
Get the duration of internal buffers that the fingerprinting algorithm uses.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- duration in samples
◆ chromaprint_get_delay_ms()
Get the duration of internal buffers that the fingerprinting algorithm uses.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- duration in milliseconds
◆ chromaprint_get_fingerprint()
Return the calculated fingerprint as a compressed string.
The caller is responsible for freeing the returned pointer using chromaprint_dealloc().
- Parameters
-
[in] | ctx | Chromaprint context pointer |
[out] | fingerprint | pointer to a pointer, where a pointer to the allocated array will be stored |
- Returns
- 0 on error, 1 on success
◆ chromaprint_get_fingerprint_hash()
Return 32-bit hash of the calculated fingerprint.
See chromaprint_hash_fingerprint() for details on how to use the hash.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
[out] | hash | pointer to a 32-bit integer where the hash will be stored |
- Returns
- 0 on error, 1 on success
◆ chromaprint_get_item_duration()
Get the duration of one item in the raw fingerprint in samples.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- duration in samples
◆ chromaprint_get_item_duration_ms()
Get the duration of one item in the raw fingerprint in milliseconds.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- duration in milliseconds
◆ chromaprint_get_num_channels()
Get the number of channels that is internally used for fingerprinting.
- Note
- You normally don't need this. Just set the audio's actual number of channels when calling chromaprint_start() and everything will work. This is only used for certain optimized cases to control the audio source.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- number of channels
◆ chromaprint_get_raw_fingerprint()
Return the calculated fingerprint as an array of 32-bit integers.
The caller is responsible for freeing the returned pointer using chromaprint_dealloc().
- Parameters
-
[in] | ctx | Chromaprint context pointer |
[out] | fingerprint | pointer to a pointer, where a pointer to the allocated array will be stored |
[out] | size | number of items in the returned raw fingerprint |
- Returns
- 0 on error, 1 on success
◆ chromaprint_get_raw_fingerprint_size()
Return the length of the current raw fingerprint.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
[out] | size | number of items in the current raw fingerprint |
- Returns
- 0 on error, 1 on success
◆ chromaprint_get_sample_rate()
Get the sampling rate that is internally used for fingerprinting.
- Note
- You normally don't need this. Just set the audio's actual number of channels when calling chromaprint_start() and everything will work. This is only used for certain optimized cases to control the audio source.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
- Returns
- sampling rate
◆ chromaprint_get_version()
Return the version number of Chromaprint.
◆ chromaprint_hash_fingerprint()
CHROMAPRINT_API int chromaprint_hash_fingerprint |
( |
const uint32_t * |
fp, |
|
|
int |
size, |
|
|
uint32_t * |
hash |
|
) |
| |
Generate a single 32-bit hash for a raw fingerprint.
If two fingerprints are similar, their hashes generated by this function will also be similar. If they are significantly different, their hashes will most likely be significantly different as well, but you can't rely on that.
You compare two hashes by counting the bits in which they differ. Normally that would be something like POPCNT(hash1 XOR hash2), which returns a number between 0 and 32. Anthing above 15 means the hashes are completely different.
- Parameters
-
[in] | fp | pointer to an array of 32-bit integers representing the raw fingerprint to be hashed |
[in] | size | number of items in the raw fingerprint |
[out] | hash | pointer to a 32-bit integer where the hash will be stored |
- Returns
- 0 on error, 1 on success
◆ chromaprint_new()
Allocate and initialize the Chromaprint context.
Note that when Chromaprint is compiled with FFTW, this function is not reentrant and you need to call it only from one thread at a time. This is not a problem when using FFmpeg or vDSP.
- Parameters
-
algorithm | the fingerprint algorithm version you want to use, or CHROMAPRINT_ALGORITHM_DEFAULT for the default algorithm |
- Returns
- ctx Chromaprint context pointer
◆ chromaprint_set_option()
Set a configuration option for the selected fingerprint algorithm.
DO NOT USE THIS FUNCTION IF YOU ARE PLANNING TO USE THE GENERATED FINGERPRINTS WITH THE ACOUSTID SERVICE.
Possible options:
- silence_threshold: threshold for detecting silence, 0-32767
- Parameters
-
[in] | ctx | Chromaprint context pointer |
[in] | name | option name |
[in] | value | option value |
- Returns
- 0 on error, 1 on success
◆ chromaprint_start()
Restart the computation of a fingerprint with a new audio stream.
- Parameters
-
[in] | ctx | Chromaprint context pointer |
[in] | sample_rate | sample rate of the audio stream (in Hz) |
[in] | num_channels | numbers of channels in the audio stream (1 or 2) |
- Returns
- 0 on error, 1 on success