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;
namespace DuplicateTracks.Fingerprinting
{
/// <summary>
/// Incremental random stride
/// </summary>
public class IncrementalRandomStride : IStride
{
/// <summary>
/// Random stride
/// </summary>
private static readonly Random Random = new Random(unchecked((int) DateTime.Now.Ticks));
private readonly int _firstStride;
/// <summary>
/// Incremental random stride constructor
/// </summary>
/// <param name = "min">Min step in samples</param>
/// <param name = "max">Max step in samples</param>
/// <param name = "samplesPerFingerprint">Samples per fingerprint</param>
public IncrementalRandomStride(int min, int max, int samplesPerFingerprint)
{
Min = min;
Max = max;
SamplesPerFingerprint = samplesPerFingerprint;
_firstStride = 0;
}
/// <summary>
/// Minimal step between consecutive strides
/// </summary>
public int Min { get; set; }
/// <summary>
/// Maximal step between consecutive strides
/// </summary>
public int Max { get; set; }
/// <summary>
/// Number of samples per fingerprint
/// </summary>
public int SamplesPerFingerprint { get; set; }
#region IStride Members
/// <summary>
/// Get stride size
/// </summary>
/// <returns>Gets the stride</returns>
public int GetStride()
{
return -SamplesPerFingerprint + Random.Next(Min, Max);
}
/// <summary>
/// Get starting stride
/// </summary>
/// <returns>Stride</returns>
public int GetFirstStride()
{
return _firstStride;
}
#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.