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.
|
// Sound Fingerprinting framework
// https://code.google.com/p/soundfingerprinting/
// Code license: GNU General Public License v2
// ciumac.sergiu@gmail.com
using System;
using System.Windows.Input;
namespace DuplicateTracks
{
/// <summary>
/// Relay command class
/// </summary>
public class RelayCommand : ICommand
{
#region Fields that will actually be used to execute the code
/// <summary>
/// Method which verifies whether the command can execute
/// </summary>
private readonly Predicate<object> _canExecute;
/// <summary>
/// Method to execute
/// </summary>
private readonly Action<object> _execute;
#endregion
#region Constructors
/// <summary>
/// Relay command constructor
/// </summary>
/// <param name = "execute">Method to be executed</param>
public RelayCommand(Action<object> execute)
: this(execute, null)
{
}
/// <summary>
/// Relay command constructor
/// </summary>
/// <param name = "execute">Method to be executed</param>
/// <param name = "canExecute">Method to check whether execution is allowed</param>
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");
_execute = execute;
_canExecute = canExecute;
}
#endregion
#region ICommand Members
/// <summary>
/// Check if the method can be executed
/// </summary>
/// <param name = "parameter">Parameter</param>
/// <returns>True/False</returns>
public bool CanExecute(object parameter)
{
return _canExecute == null ? true : _canExecute.Invoke(parameter);
}
/// <summary>
/// Fires when the CanExecute status of this command changes.
/// </summary>
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
/// <summary>
/// Execute the method
/// </summary>
/// <param name = "parameter">Parameter for execution</param>
public void Execute(object parameter)
{
_execute(parameter);
}
#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.
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.