Click here to Skip to main content
15,884,473 members
Articles / Desktop Programming / WPF

Duplicate songs detector via audio fingerprinting

Rate me:
Please Sign up or sign in to vote.
4.96/5 (337 votes)
23 Jun 2020MIT44 min read 1.3M   20.4K   533  
Explains sound fingerprinting algorithm, with a practical example of detecting duplicate files on the user's local drive.
The aim of this article is to show an efficient algorithm of signal processing which will allow one to have a competent system of sound fingerprinting and signal recognition. I'll try to come with some explanations of the article's algorithm, and also speak about how it can be implemented using the C# programming language. Additionally, I'll try to cover topics of digital signal processing that are used in the algorithm, thus you'll be able to get a clearer image of the entire system. And as a proof of concept, I'll show you how to develop a simple WPF MVVM application.
namespace Soundfingerprinting.SoundTools.BassResampler
{
    partial class WinBassResampler
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WinBassResampler));
            this._tbPathToFile = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this._btnResample = new System.Windows.Forms.Button();
            this._nudSampleRate = new System.Windows.Forms.NumericUpDown();
            ((System.ComponentModel.ISupportInitialize)(this._nudSampleRate)).BeginInit();
            this.SuspendLayout();
            // 
            // _tbPathToFile
            // 
            this._tbPathToFile.Location = new System.Drawing.Point(12, 25);
            this._tbPathToFile.Name = "_tbPathToFile";
            this._tbPathToFile.Size = new System.Drawing.Size(288, 20);
            this._tbPathToFile.TabIndex = 0;
            this._tbPathToFile.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TbPathToFileMouseDoubleClick);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(13, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(119, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Select a file to resample";
            // 
            // _btnResample
            // 
            this._btnResample.Location = new System.Drawing.Point(225, 48);
            this._btnResample.Name = "_btnResample";
            this._btnResample.Size = new System.Drawing.Size(75, 23);
            this._btnResample.TabIndex = 2;
            this._btnResample.Text = "Resample";
            this._btnResample.UseVisualStyleBackColor = true;
            this._btnResample.Click += new System.EventHandler(this.BtnResampleClick);
            // 
            // _nudSampleRate
            // 
            this._nudSampleRate.Location = new System.Drawing.Point(12, 51);
            this._nudSampleRate.Maximum = new decimal(new int[] {
            44000,
            0,
            0,
            0});
            this._nudSampleRate.Name = "_nudSampleRate";
            this._nudSampleRate.Size = new System.Drawing.Size(120, 20);
            this._nudSampleRate.TabIndex = 3;
            this._nudSampleRate.Value = new decimal(new int[] {
            5512,
            0,
            0,
            0});
            // 
            // WinBassResampler
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(309, 82);
            this.Controls.Add(this._nudSampleRate);
            this.Controls.Add(this._btnResample);
            this.Controls.Add(this.label1);
            this.Controls.Add(this._tbPathToFile);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MaximumSize = new System.Drawing.Size(325, 120);
            this.MinimumSize = new System.Drawing.Size(325, 120);
            this.Name = "WinBassResampler";
            this.Text = "Bass resampler";
            ((System.ComponentModel.ISupportInitialize)(this._nudSampleRate)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox _tbPathToFile;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button _btnResample;
        private System.Windows.Forms.NumericUpDown _nudSampleRate;
    }
}

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 MIT License


Written By
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.

Comments and Discussions