pub struct AudioSegmentFingerprint {
pub bytes: Vec<u8>,
pub sample_count: usize,
pub sample_rate: u32,
}Expand description
A compact fingerprint for an audio segment based on sub-band energy ratios.
The fingerprint is computed by:
- Dividing the audio into short frames (default 64 ms)
- Computing the energy in each of 8 frequency sub-bands
- Encoding the sign of inter-band energy differences as bits
This produces a bit-string that is robust to small amplitude changes and can be compared with Hamming distance for near-duplicate detection.
Fields§
§bytes: Vec<u8>Raw fingerprint bytes (1 byte per analysis frame).
sample_count: usizeNumber of audio samples analysed.
sample_rate: u32Sample rate used during fingerprinting.
Implementations§
Source§impl AudioSegmentFingerprint
impl AudioSegmentFingerprint
Sourcepub fn hamming_distance(&self, other: &Self) -> usize
pub fn hamming_distance(&self, other: &Self) -> usize
Hamming distance between two fingerprints (proportional to byte length difference).
Sourcepub fn similarity(&self, other: &Self) -> f64
pub fn similarity(&self, other: &Self) -> f64
Similarity in [0.0, 1.0].
Sourcepub fn is_similar(&self, other: &Self, threshold: f64) -> bool
pub fn is_similar(&self, other: &Self, threshold: f64) -> bool
Returns true if similarity ≥ threshold.
Trait Implementations§
Source§impl Clone for AudioSegmentFingerprint
impl Clone for AudioSegmentFingerprint
Source§fn clone(&self) -> AudioSegmentFingerprint
fn clone(&self) -> AudioSegmentFingerprint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AudioSegmentFingerprint
impl Debug for AudioSegmentFingerprint
impl Eq for AudioSegmentFingerprint
Source§impl PartialEq for AudioSegmentFingerprint
impl PartialEq for AudioSegmentFingerprint
Source§fn eq(&self, other: &AudioSegmentFingerprint) -> bool
fn eq(&self, other: &AudioSegmentFingerprint) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AudioSegmentFingerprint
Auto Trait Implementations§
impl Freeze for AudioSegmentFingerprint
impl RefUnwindSafe for AudioSegmentFingerprint
impl Send for AudioSegmentFingerprint
impl Sync for AudioSegmentFingerprint
impl Unpin for AudioSegmentFingerprint
impl UnsafeUnpin for AudioSegmentFingerprint
impl UnwindSafe for AudioSegmentFingerprint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more