Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Duplicate songs detector via audio fingerprinting

, 20 Jun 2013
Explains sound fingerprinting algorithm, with a practical example of detecting duplicate files on the user's local drive.
DuplicatesDetector.zip
DuplicatesDetector
Bass.Net.dll
encog-core-cs.dll
Microsoft.DirectX.DirectSound.dll
NAudio.dll
Ninject.dll
Ninject.pdb
perms.csv
SoundFingerprinting.dll
SoundFingerprinting.DuplicatesDetector.exe
SoundFingerprinting.DuplicatesDetector.pdb
SoundFingerprinting.pdb
WPFToolkit.dll
x64
bass.dll
basscd.dll
bassenc.dll
bassflac.dll
bassmidi.dll
bassmix.dll
basswma.dll
bass_fx.dll
libfftw3-3.dll
libfftw3f-3.dll
libfftw3l-3.dll
tags.dll
x86
bass.dll
bassenc.dll
bassflac.dll
bassmix.dll
basswma.dll
bass_fx.dll
libfftw3-3.dll
libfftw3f-3.dll
libfftw3l-3.dll
tags.dll
release.zip
release2.zip
release3.zip
Release3
bass.dll
Bass.Net.dll
bassflac.dll
bassmix.dll
bass_fx.dll
DuplicateTracks.exe
perms.csv
tags.dll
WPFToolkit.dll
release4.zip
Release5.zip
Release5
bass.dll
Bass.Net.dll
bassflac.dll
bassmix.dll
bass_fx.dll
encog-core-cs.dll
Microsoft.DirectX.DirectSound.dll
Ninject.dll
perms.csv
Soundfingerprinting.dll
Soundfingerprinting.DuplicatesDetector.exe
tags.dll
WPFToolkit.dll
sources.zip
DuplicateTracks
.svn
all-wcprops
entries
prop-base
props
text-base
DuplicateTracks.sln.svn-base
tmp
prop-base
props
text-base
DuplicateTracks
.svn
all-wcprops
entries
prop-base
Application.ico.svn-base
props
text-base
App.xaml.cs.svn-base
App.xaml.svn-base
Application.ico.svn-base
DuplicateTracks.csproj.svn-base
MainWindow.xaml.cs.svn-base
MainWindow.xaml.svn-base
MainWindowResourceDictionary.xaml.svn-base
RelayCommand.cs.svn-base
tmp
prop-base
props
text-base
Application.ico
Audio
.svn
all-wcprops
entries
prop-base
props
text-base
BassProxy.cs.svn-base
IAudio.cs.svn-base
tmp
prop-base
props
text-base
DataAccess
.svn
all-wcprops
entries
prop-base
props
text-base
Hashes.cs.svn-base
HashType.cs.svn-base
IPermutations.cs.svn-base
IStorage.cs.svn-base
LocalPermutations.cs.svn-base
RamStorage.cs.svn-base
Repository.cs.svn-base
tmp
prop-base
props
text-base
Fingerprinting
.svn
all-wcprops
entries
prop-base
props
text-base
CSVWriter.cs.svn-base
FingerprintManager.cs.svn-base
IncrementalRandomStride.cs.svn-base
IncrementalStaticStride.cs.svn-base
IStride.cs.svn-base
MinHash.cs.svn-base
RandomStride.cs.svn-base
StaticStride.cs.svn-base
tmp
prop-base
props
text-base
MathUtils
.svn
all-wcprops
entries
prop-base
props
text-base
Complex.cs.svn-base
ComplexF.cs.svn-base
Fourier.cs.svn-base
FourierDirection.cs.svn-base
HaarWavelet.cs.svn-base
HanningWindow.cs.svn-base
IWaveletDecomposition.cs.svn-base
IWindowFunction.cs.svn-base
tmp
prop-base
props
text-base
Images
.svn
all-wcprops
entries
prop-base
icon.png.svn-base
props
text-base
icon.png.svn-base
tmp
prop-base
props
text-base
icon.png
Model
.svn
all-wcprops
entries
prop-base
props
text-base
HashSignature.cs.svn-base
Item.cs.svn-base
ResultItem.cs.svn-base
Track.cs.svn-base
tmp
prop-base
props
text-base
Properties
.svn
all-wcprops
entries
prop-base
props
text-base
AssemblyInfo.cs.svn-base
tmp
prop-base
props
text-base
Services
.svn
all-wcprops
entries
prop-base
props
text-base
FolderBrowserDialogService.cs.svn-base
IFolderBrowserDialogService.cs.svn-base
IGenericViewWindow.cs.svn-base
IMessageBoxService.cs.svn-base
IOpenFileDialogService.cs.svn-base
ISaveFileDialogService.cs.svn-base
IWindowService.cs.svn-base
MessageBoxService.cs.svn-base
OpenFileDialogService.cs.svn-base
SaveFileDialogService.cs.svn-base
ServiceContainer.cs.svn-base
ServiceInjector.cs.svn-base
WindowService.cs.svn-base
tmp
prop-base
props
text-base
Themes
.svn
all-wcprops
entries
prop-base
props
text-base
Brushes.xaml.svn-base
Converters.xaml.svn-base
Datagrid.xaml.svn-base
ProgressBar.xaml.svn-base
RoundedButton.xaml.svn-base
TextBlock.xaml.svn-base
tmp
prop-base
props
text-base
View
ViewModel
.svn
all-wcprops
entries
prop-base
props
text-base
BooleanToVisibilityConverter.cs.svn-base
GenericViewModel.cs.svn-base
Helper.cs.svn-base
MainWindowViewModel.cs.svn-base
PathListViewModel.cs.svn-base
ReportViewModel.cs.svn-base
RepositoryGateway.cs.svn-base
ViewModelBase.cs.svn-base
tmp
prop-base
props
text-base
.svn
all-wcprops
entries
prop-base
props
text-base
GenericView.xaml.cs.svn-base
GenericView.xaml.svn-base
PathListView.xaml.cs.svn-base
PathListView.xaml.svn-base
ReportView.xaml.cs.svn-base
ReportView.xaml.svn-base
tmp
prop-base
props
text-base
NativeLibs
.svn
all-wcprops
entries
prop-base
bass.dll.svn-base
bassflac.dll.svn-base
bassmix.dll.svn-base
bass_fx.dll.svn-base
tags.dll.svn-base
props
text-base
bass.dll.svn-base
bassflac.dll.svn-base
bassmix.dll.svn-base
bass_fx.dll.svn-base
tags.dll.svn-base
tmp
prop-base
props
text-base
bass.dll
bassflac.dll
bassmix.dll
bass_fx.dll
tags.dll
Permutations
.svn
all-wcprops
entries
prop-base
props
text-base
perms.csv.svn-base
tmp
prop-base
props
text-base
perms.csv
sources2.zip
Application.ico
icon.png
bass.dll
bassflac.dll
bassmix.dll
bass_fx.dll
tags.dll
perms.csv
sources3.zip
Application.ico
icon.png
bass.dll
bassflac.dll
bassmix.dll
bass_fx.dll
tags.dll
perms.csv
sources4.zip
Externals
bass.dll
Bass.Net.dll
bassflac.dll
bassmix.dll
bass_fx.dll
encog-core-cs.dll
Microsoft.DirectX.DirectSound.dll
Ninject.dll
perms.csv
tags.dll
Sources
DuplicateTracks
DuplicateTracks
Application.ico
DataAccess
Images
icon.png
Infrastructure
Model
Properties
Services
Themes
View
ViewModel
SoundfingerprintingLib
SoundfingerprintingLib
AudioProxies
Strides
DbStorage
Entities
Utils
Fingerprinting
ConstantQ
FFT
Wavelets
Windows
Hashing
NeuralHashing
ActivationFunctions
Ensemble
Learning
MMI
NeuralTrainer
Utils
Properties
SoundTools
BassResampler
DbFiller
DrawningTool
FFMpegResampler
FilePermutations
Misc
NetworkEnsembling
NetworkTrainer
PermutationGenerator
Properties
Settings.settings
QueryDb
Resources
2-Music.ico
WaveletDecomposition
sources5.zip
src
Externals
bass.dll
Bass.Net.dll
bassflac.dll
bassmix.dll
bass_fx.dll
encog-core-cs.dll
Microsoft.DirectX.DirectSound.dll
Ninject.dll
tags.dll
WPFToolkit.dll
Scripts
Soundfingerprinting
Soundfingerprinting.DuplicatesDetector
Application.ico
DataAccess
Images
icon.png
Infrastructure
Model
Permutations
perms.csv
Properties
Services
Themes
View
ViewModel
Soundfingerprinting.SoundTools
BassResampler
DbFiller
DrawningTool
FFMpegResampler
FilePermutations
Misc
NetworkEnsembling
NetworkTrainer
PermutationGenerator
Properties
Settings.settings
QueryDb
Resources
2-Music.ico
WaveletDecomposition
AudioProxies
Strides
DbStorage
Entities
Utils
Fingerprinting
ConstantQ
FFT
Wavelets
Windows
Hashing
NeuralHashing
ActivationFunctions
Ensemble
Learning
MMI
NeuralTrainer
Utils
Properties
// Sound Fingerprinting framework
// https://code.google.com/p/soundfingerprinting/
// Code license: GNU General Public License v2
// ciumac.sergiu@gmail.com
using System;
using System.Diagnostics;

namespace SoundfingerprintingLib.DbStorage.Entities
{
    /// <summary>
    ///   Track entity object
    /// </summary>
    [Serializable]
    [DebuggerDisplay("Title={_title}, Artist={_artist}")]
    public class Track
    {
        #region Private fields

        /// <summary>
        ///   Album id of the track
        /// </summary>
        [DebuggerBrowsable(DebuggerBrowsableState.Never)] private Int32 _albumId;

        /// <summary>
        ///   Artist of the track
        /// </summary>
        [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string _artist;

        /// <summary>
        ///   Title of the track
        /// </summary>
        [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string _title;

        /// <summary>
        ///   Track length
        /// </summary>
        [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int _trackLength;

        #endregion

        #region Constructors

        /// <summary>
        ///   Parameter less Constructor
        /// </summary>
        public Track()
        {
            Id = Int32.MinValue;
        }

        /// <summary>
        ///   Track constructor
        /// </summary>
        /// <param name="id">Id of the track</param>
        /// <param name = "artist">Artist's name</param>
        /// <param name = "title">Title</param>
        /// <param name = "albumId">Album's identifier</param>
        public Track(int id, string artist, string title, Int32 albumId) 
        {
            Id = id;
            Artist = artist;
            Title = title;
            AlbumId = albumId;
        }

        /// <summary>
        ///   Track constructor
        /// </summary>
        /// <param name="id">Id of the track</param>
        /// <param name = "artist">Artist's name</param>
        /// <param name = "title">Title</param>
        /// <param name = "albumId">Album's identifier</param>
        /// <param name = "trackLength">Track length</param>
        public Track(int id, string artist, string title, Int32 albumId, int trackLength)
            : this(id, artist, title, albumId)
        {
            TrackLength = trackLength;
        }

        #endregion

        #region Properties

        /// <summary>
        ///   Track's id
        /// </summary>
        /// <remarks>
        /// Once inserted into the database the object will be given a unique identifier
        /// </remarks>
        public Int32 Id
        {
            get;
            set;
        }

        /// <summary>
        ///   Artist's name
        /// </summary>
        public string Artist
        {
            get { return _artist; }
            set
            {
                if (value.Length > 255)
                    throw new FingerprintEntityException("Artist's length cannot exceed a predefined value. Check the documentation");
                _artist = value;
            }
        }

        /// <summary>
        ///   Track's title
        /// </summary>
        public string Title
        {
            get { return _title; }
            set
            {
                if (value.Length > 255)
                    throw new FingerprintEntityException("Title's length cannot exceed a predefined value. Check the documentation");
                _title = value;
            }
        }

        /// <summary>
        ///   Album's Id, in which the track is included
        /// </summary>
        public Int32 AlbumId
        {
            get { return _albumId; }
            set { _albumId = value; }
        }

        /// <summary>
        ///   Track's Length
        /// </summary>
        public int TrackLength
        {
            get { return _trackLength; }
            set
            {
                if (value < 0)
                    throw new FingerprintEntityException("Track's Length cannot be less than 0");
                _trackLength = value;
            }
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

About the Author

Ciumac Sergiu
Software Developer
Moldova (Republic Of) Moldova (Republic Of)
Interested in computer science, math, research, and everything that relates to innovation. Fan of agnostic programming, don't mind developing under any platform/framework if it explores interesting topics. In search of a better programming paradigm.
Follow on   Twitter   LinkedIn

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 20 Jun 2013
Article Copyright 2011 by Ciumac Sergiu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid