Voltar ao ranking

AddictedCS/soundfingerprinting

C#emysound.com

Open source audio fingerprinting in .NET. An efficient algorithm for acoustic fingerprinting written purely in C#.

audiofingerprintsalgorithmacoustic-fingerprintsrecognitionlocality-sensitive-hashingnearest-neighbor-searchshazamc-sharpaudio-processing
Crescimento de estrelas
Estrelas
1k
Forks
206
Crescimento semanal
Issues
11
5001k
out. de 2012mai. de 2017dez. de 2021jul. de 2026
README

Audio/Video fingerprinting and recognition in .NET

Join the chat at https://gitter.im/soundfingerprinting/Lobby .NET Core MIT License NuGet

soundfingerprinting is a C# framework designed for companies, enthusiasts, researchers in the fields of digital signal processing, data mining and audio/video recognition. It implements an efficient algorithm which provides fast insert and retrieval of acoustic and video fingerprints with high precision and recall rate.

Documentation

Full documentation is available on the Wiki page.

Below code snippet shows how to extract acoustic fingerprints from an audio file and later use them as identifiers to recognize unknown audio query. These fingerprints will be stored in a configurable datastore.

private readonly IModelService modelService = new InMemoryModelService(); // store fingerprints in RAM
private readonly IAudioService audioService = new SoundFingerprintingAudioService(); // default audio library

public async Task StoreForLaterRetrieval(string file)
{
    var track = new TrackInfo("GBBKS1200164", "Skyfall", "Adele");

    // create fingerprints
    var avHashes = await FingerprintCommandBuilder.Instance
                                .BuildFingerprintCommand()
                                .From(file)
                                .UsingServices(audioService)
                                .Hash();
								
    // store hashes in the database for later retrieval
    modelService.Insert(track, avHashes);
}

Querying

Once you've inserted the fingerprints into the datastore, later you might want to query the storage in order to recognize the song those samples you have. The origin of query samples may vary: file, URL, microphone, radio tuner, etc. It's up to your application, where you get the samples from.


public async Task<TrackData?> GetBestMatchForSong(string file)
{
    int secondsToAnalyze = 10; // number of seconds to analyze from query file
    int startAtSecond = 0; // start at the begining
	
    // query the underlying database for similar audio sub-fingerprints
    var queryResult = await QueryCommandBuilder.Instance.BuildQueryCommand()
                                         .From(file, secondsToAnalyze, startAtSecond)
                                         .UsingServices(modelService, audioService)
                                         .Query();

    return queryResult.BestMatch?.Audio.Track;
}

Fingerprints Storage

The default storage, which comes bundled with soundfingerprinting NuGet package, is a plain in-memory storage, available via InMemoryModelService class. If you plan to use an external persistent storage for fingerprints Emy is the preferred choice. Emy provides a community version which is free for non-commercial use. More about Emy can be found on wiki page.

Supported audio/video formats

Read Supported Media Formats page for details about processing different file formats or realtime streams.

Video fingerprinting support since version 8.0.0

Since v8.0.0 video fingerprinting support has been added. Similarly to audio fingerprinting, video fingerprints are generated from video frames, and used to insert and later query the datastore for exact and similar matches. You can use SoundFingerprinting to fingerprint either audio or video content or both at the same time. More details about video fingerprinting are available here.

Spectral-profile path bridging since version 15.0.0

Since v15.0.0 an optional per-second spectral profile (SFM + relative power) can be captured at ingest and consumed at query time to bridge regions where hashes don't match across recordings — broadband intros (e.g. ocean waves), fade-outs, atmospheric silence. The mechanism is invisible by default; opt in per-query by setting QueryConfiguration.SfmMatchStrategy to one of the built-in strategies. The setter cascades through to FingerprintConfiguration.ComputeSpectralProfile so the profile is captured during query-time fingerprinting automatically.

var queryResult = await QueryCommandBuilder.Instance.BuildQueryCommand()
    .From(file)
    .WithQueryConfig(config =>
    {
        // covers both broadband and silent regions in one pass
        config.Audio.SfmMatchStrategy = CompositeBridgingStrategy.BroadbandOrSilent;
        return config;
    })
    .UsingServices(modelService, audioService)
    .Query();

Available strategies: NoBridgingStrategy (default — no change vs. v14), BroadbandNoiseBridgingStrategy (per-second SFM > 0.70 on both sides), SilentRegionBridgingStrategy (per-second power < 5% on both sides — replaces the removed TreatSilenceAsSignal flag), SimilarProfileBridgingStrategy (tight |Δsfm| < 0.10 tolerance, capped to min(10s, 0.30 × queryLength) to keep speech-vs-speech merges safe), and CompositeBridgingStrategy for safe unions. Bridging is bounded by a universal 70% cumulative-bridged-seconds sanity cap and reported back via Coverage.BridgedSeconds. Synthetics are structurally indistinguishable from real matches downstream — no wire-format changes to MatchedWith. Tracks without a stored profile short-circuit cleanly to no-bridging (behavior identical to v14).

Version Matrix

If you are using FFmpegAudioService as described in the wiki, follow the below version matrix.

SoundFingerprinting SoundFingerprinting.Emy FFmpeg
8.x 8.x 4.x
9.x 9.x 5.x
10.x 10.x 6.x
11.x 11.x 6.x
12.x 12.x 7.x
13.x 13.x 7.x
14.x 14.x 8.x
15.x 15.x 8.x

FAQ

  • Can I apply this algorithm for speech recognition purposes?

No. The granularity of one fingerprint is roughly ~1.46 seconds.

  • Can the algorithm detect exact query position in resulted track?

Yes.

  • Can I use SoundFingerprinting to detect ads in radio streams?

Yes. Actually this is the most frequent use-case where SoundFingerprinting was successfully used.

  • How many tracks can I store in InMemoryModelService?

100 hours of content with DefaultFingerprintingConfiguration will consume ~5GB of RAM.

Get it on NuGet

Install-Package SoundFingerprinting

How it works

Audio Fingerprinting.

Video Fingerprinting.

Demo

My description of the algorithm alogside with the demo project can be found on CodeProject. The article is from 2011, and may be outdated. The demo project is a Audio File Duplicates Detector. Its latest source code can be found here. Its a WPF MVVM project that uses the algorithm to detect what files are perceptually very similar.

Contribute

If you want to contribute you are welcome to open issues or discuss on issues page. Feel free to contact me for any remarks, ideas, bug reports etc.

License

The framework is provided under MIT license agreement.

© Soundfingerprinting, 2010-2025, sergiu@emysound.com

Repositórios relacionados
huggingface/transformers

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

PythonPyPIApache License 2.0nlpnatural-language-processing
huggingface.co/transformers
162.8k34k
FFmpeg/FFmpeg

Mirror of https://git.ffmpeg.org/ffmpeg.git

COtherffmpegvideo
ffmpeg.org
62.3k14k
mpv-player/mpv

🎥 Command line media player

COthermpvmplayer
mpv.io
36.1k3.4k
OpenBMB/VoxCPM

VoxCPM2: Tokenizer-Free TTS for Multilingual Speech Generation, Creative Voice Design, and True-to-Life Cloning

PythonPyPIApache License 2.0audiodeeplearning
voxcpm.com
34k3.9k
ossrs/srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181, with codec support for H.264, H.265, AV1, VP9, AAC, Opus, and G.711.

C++MIT Licensertmplive-streaming
ossrs.io
29.1k5.7k
Anjok07/ultimatevocalremovergui

GUI for a Vocal Remover that uses Deep Neural Networks.

PythonPyPIMIT Licensevocal-removerpytorch
25.5k1.9k
goldfire/howler.js

Javascript audio library for the modern web.

JavaScriptnpmMIT Licensejavascriptaudio
howlerjs.com
25.3k2.3k
ExistentialAudio/BlackHole

BlackHole is a modern macOS audio loopback driver that allows applications to pass audio to other applications with zero additional latency.

COtheraudiodriver
19.4k828
modelscope/FunASR

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

PythonPyPIMIT Licensepytorchspeech-recognition
modelscope.github.io/FunASR/
19.4k1.9k
kyleneideck/BackgroundMusic

Background Music, a macOS audio utility: automatically pause your music, set individual apps' volumes and record system audio.

C++GNU General Public License v2.0audioaudio-utility
19.2k775
alyssaxuu/screenity

The free and privacy-friendly screen recorder with no limits 🎥

JavaScriptnpmGNU General Public License v3.0screen-capturescreencast
screenity.io
18.4k1.5k
mahmoud/awesome-python-applications

💿 Free software that works great, and also happens to be open-source Python.

Jupyter Notebookpythonapplication
ftp//you:relookin@it
17.9k2.7k