C# Класс AcoustID.ChromaContext

The main Chromaprint API.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Version string

Открытые методы

Метод Описание
ChromaContext ( ) : AcoustID.Audio

Initializes a new instance of the ChromaContext class.

ChromaContext ( AcoustID.Chromaprint.ChromaprintAlgorithm algorithm ) : AcoustID.Audio

Initializes a new instance of the ChromaContext class.

ChromaContext ( AcoustID.Chromaprint.ChromaprintAlgorithm algorithm, IFFTService fftService ) : AcoustID.Audio

Initializes a new instance of the ChromaContext class.

ChromaContext ( IFFTService fftService ) : AcoustID.Audio

Initializes a new instance of the ChromaContext class.

DecodeFingerprint ( byte encoded_fp, bool base64, int &algorithm ) : int[]

Uncompress and optionally base64-decode an encoded fingerprint.

EncodeFingerprint ( int fp, int algorithm, bool base64 ) : byte[]

Compress and optionally base64-encode a raw fingerprint.

Feed ( short data, int size ) : void

Send audio data to the fingerprint calculator.

Finish ( ) : void

Process any remaining buffered audio data and calculate the fingerprint.

GetFingerprint ( ) : string

Return the calculated fingerprint as a compressed string.

GetFingerprintHash ( ) : int

Return 32-bit hash of the calculated 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.

GetRawFingerprint ( ) : int[]

Return the calculated fingerprint as an array of 32-bit integers.

SetOption ( string name, int value ) : bool

Set a configuration option for the selected fingerprint algorithm.

NOTE: 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

Start ( int sample_rate, int num_channels ) : bool

Restart the computation of a fingerprint with a new audio stream

Описание методов

ChromaContext() публичный Метод

Initializes a new instance of the ChromaContext class.
public ChromaContext ( ) : AcoustID.Audio
Результат AcoustID.Audio

ChromaContext() публичный Метод

Initializes a new instance of the ChromaContext class.
public ChromaContext ( AcoustID.Chromaprint.ChromaprintAlgorithm algorithm ) : AcoustID.Audio
algorithm AcoustID.Chromaprint.ChromaprintAlgorithm The algorithm to use, see (default = TEST2)
Результат AcoustID.Audio

ChromaContext() публичный Метод

Initializes a new instance of the ChromaContext class.
public ChromaContext ( AcoustID.Chromaprint.ChromaprintAlgorithm algorithm, IFFTService fftService ) : AcoustID.Audio
algorithm AcoustID.Chromaprint.ChromaprintAlgorithm The algorithm to use, see (default = TEST2)
fftService IFFTService The FFT service.
Результат AcoustID.Audio

ChromaContext() публичный Метод

Initializes a new instance of the ChromaContext class.
public ChromaContext ( IFFTService fftService ) : AcoustID.Audio
fftService IFFTService The FFT service.
Результат AcoustID.Audio

DecodeFingerprint() публичный статический Метод

Uncompress and optionally base64-decode an encoded fingerprint.
public static DecodeFingerprint ( byte encoded_fp, bool base64, int &algorithm ) : int[]
encoded_fp byte Pointer to an encoded fingerprint
base64 bool 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.
algorithm int Chromaprint algorithm version which was used to generate the raw /// fingerprint
Результат int[]

EncodeFingerprint() публичный статический Метод

Compress and optionally base64-encode a raw fingerprint.
public static EncodeFingerprint ( int fp, int algorithm, bool base64 ) : byte[]
fp int pointer to an array of 32-bit integers representing the raw fingerprint to be encoded
algorithm int Chromaprint algorithm version which was used to generate the raw fingerprint
base64 bool 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.
Результат byte[]

Feed() публичный Метод

Send audio data to the fingerprint calculator.
public Feed ( short data, int size ) : void
data short raw audio data, should point to an array of 16-bit /// signed integers in native byte-order
size int size of the data buffer (in samples)
Результат void

Finish() публичный Метод

Process any remaining buffered audio data and calculate the fingerprint.
public Finish ( ) : void
Результат void

GetFingerprint() публичный Метод

Return the calculated fingerprint as a compressed string.
public GetFingerprint ( ) : string
Результат string

GetFingerprintHash() публичный Метод

Return 32-bit hash of the calculated 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.
public GetFingerprintHash ( ) : int
Результат int

GetRawFingerprint() публичный Метод

Return the calculated fingerprint as an array of 32-bit integers.
public GetRawFingerprint ( ) : int[]
Результат int[]

SetOption() публичный Метод

Set a configuration option for the selected fingerprint algorithm.
NOTE: 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
public SetOption ( string name, int value ) : bool
name string option name
value int option value
Результат bool

Start() публичный Метод

Restart the computation of a fingerprint with a new audio stream
public Start ( int sample_rate, int num_channels ) : bool
sample_rate int sample rate of the audio stream (in Hz)
num_channels int numbers of channels in the audio stream (1 or 2)
Результат bool

Описание свойств

Version публичное статическое свойство

Return the version number of Chromaprint.
public static string Version
Результат string