Soundfingerprinting is a C# framework designed for developers and researchers in the fields of audio processing, data mining, digital signal processing. It implements an efficient algorithm of signal processing which will allow one to have a competent system of audio fingerprinting and signal recognition.
See the Wiki page with the operational details and information
Following is a code sample that shows how you would generate from an audio file sound fingerprints, that can be stored and used later for recognition purposes.
public List<byte[]> CreateFingerprintSignaturesFromFile(string pathToAudioFile)
{
FingerprintUnitBuilder fingerprintBuilder = new FingerprintUnitBuilder();
return fingerprintBuilder.BuildFingerprints()
.On(pathToAudioFile)
.With<DefaultFingerprintingConfiguration>()
.RunAlgorithmWithHashing()
.Result;
}
After generating the fingerprint signatures you might want to store them for later retrieval. Below is shown a code snippet for saving them to the default underlying storage, using ModelService
class. Default storage is an MSSQL database those initialization script can be find here.
public void StoreFingeprintSignaturesForTrack(List<byte[]> fingerprintSignatures, Track track)
{
ModelService modelService = new ModelService();
List<SubFingerprint> fingerprintsToStore = new List<SubFingerprint>();
foreach (var fingerprint in fingerprintSignatures)
{
fingerprintsToStore.Add(new SubFingerprint(fingerprint, track.Id));
}
modelService.InsertSubFingerprint(fingerprintsToStore);
}
Once you've inserted the fingerprints into the database, 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 Track GetBestMatchForSong(String queryAudioFile)
{
FingerprintQueryBuilder fingerprintQueryBuilder = new FingerprintQueryBuilder();
return fingerprintQueryBuilder.BuildQuery()
.From(queryAudioFile)
.With<DefaultFingerprintingConfiguration, DefaultQueryConfiguration>()
.Query()
.Result
.BestMatch;
}
The code is still in pre-release phase, thus the signatures of the above used classes might change.
git clone git@github.com:AddictedCS/soundfingerprinting.git
In order to build latest version of the SoundFingerprinting
assembly run the following command from repository root
.\build.cmd
Install-Package SoundFingerprinting -Pre
My description of the algorithm alogside with the demo project can be found on CodeProject 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.
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.
The framework is provided under GPLv3 licence agreement.
The framework implements the algorithm from Content Fingerprinting Using Wavelets paper.
© Soundfingerprinting, 2010-2013, ciumac.sergiu@gmail.com