Module_SignalProcessing_FeatureExtractors - vorcyc/Vorcyc.Mathematics GitHub Wiki
Location: Home / Signal processing / Feature extractors
The Vorcyc.Mathematics.SignalProcessing.FeatureExtractors namespace includes Mpeg7SpectralFeaturesExtractor, SpectralFeaturesExtractor, TimeDomainFeaturesExtractor, AmsExtractor, ChromaExtractor, FilterbankExtractor, LpccExtractor, LpcExtractor, MfccExtractor, PitchExtractor, PlpExtractor, PnccExtractor, SpnccExtractor, and WaveletExtractor for time-domain, spectral, cepstral, and wavelet features.
0.9: Base
FeatureExtractorprovidesComputeFrom(Signal)/ParallelComputeFrom(Signal);TimeDomainFeaturesExtractorframe path prefers zero-copySignalSegmentslices.float[]overloads remain for compatibility.
All types below are in namespace:Vorcyc.Mathematics.SignalProcessing.FeatureExtractors
📒 Contents
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi.Mpeg7SpectralFeaturesExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi.SpectralFeaturesExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi.TimeDomainFeaturesExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.AmsExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.ChromaExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.FilterbankExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.LpccExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.LpcExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.MfccExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.PitchExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.PlpExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.PnccExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.SpnccExtractor class
- 🔖 Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.WaveletExtractor class
Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi.Mpeg7SpectralFeaturesExtractor is an MPEG-7 compliant feature extractor evaluating:
- Spectral features (MPEG-7)
- Harmonic features
- Perceptual features
-
public const string FeatureSet- Full set of supported spectral features.
-
public const string HarmonicSet- Full set of supported harmonic features.
-
public override List<string> FeatureDescriptions { get; }- Gets String descriptions (or simple names) of features.
-
public Mpeg7SpectralFeaturesExtractor(MultiFeatureOptions options)- Constructs Mpeg7SpectralFeaturesExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public void IncludeHarmonicFeatures(string featureList, int peakCount = 10, Func<float[], float> pitchEstimator = null, Action<float[], int[], float[], int, float> peaksDetector = null, float lowPitch = 80, float highPitch = 400)- Adds harmonic features to extractor list.
- Parameters:
-
featureList: String names of new harmonic features. -
peakCount: Maximum harmonic peak count; default 10. -
pitchEstimator: Pitch estimator function; defaultPitch.FromSpectralPeaks. -
peaksDetector: Peak detector function; defaultHarmonic.Peaks. -
lowPitch: Lower pitch bound (Hz); default 80 Hz. -
highPitch: Upper pitch bound (Hz); default 400 Hz.
-
-
public void AddHarmonicFeature(string name, Func<float[], int[], float[], float> algorithm)- Adds user-defined harmonic features and compute routines.
- Parameters:
-
name: Feature name/description. -
algorithm: Feature compute routine.
-
-
public void SetPitchTrack(float[] pitchTrack)- Sets precomputed pitch track.
- Parameters:
-
pitchTrack: Precomputed pitch array.
-
-
public override int ComputeFrom(float[] samples, int startSample, int endSample, IList<float[]> vectors)- Computes MPEG-7 feature vectors from samples into
vectors. - Parameters:
-
samples: Sample array. -
startSample: Index of first sample to process in the array. -
endSample: Index of last sample to process in the array (exclusive). -
vectors: Preallocated sequence for result vectors.
-
- Returns: Number of feature vectors computed.
- Computes MPEG-7 feature vectors from samples into
-
public override void ProcessFrame(float[] block, float[] features)- Computes MPEG-7 features for one frame.
- Parameters:
-
block: Data block. -
features: Features computed in block (one feature vector).
-
-
public override bool IsParallelizable()- Returns false if pitch track was set manually (no parallelization); otherwise true.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute; null if not parallelizable.
The following example uses Mpeg7SpectralFeaturesExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi;
public class Mpeg7SpectralFeaturesExtractorExample
{
public static void Main()
{
// Create MultiFeatureOptions instance
var options = new MultiFeatureOptions { SamplingRate = 44100, FeatureList = "centroid, spread, flatness, noiseness, rolloff, crest, entropy, decrease, loudness, sharpness", FrameDuration = 0.025f, HopDuration = 0.01f, FftSize = 1024, PreEmphasis = 0.97f, Window = WindowType.Hamming };
// Create Mpeg7SpectralFeaturesExtractor instance
var featureExtractor = new Mpeg7SpectralFeaturesExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = featureExtractor.ComputeFrom(signal);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi.SpectralFeaturesExtractor extracts spectral features.
-
public const string FeatureSet- Full set of supported spectral features.
-
public override List<string> FeatureDescriptions { get; }- Gets String descriptions (or simple names) of features.
-
public SpectralFeaturesExtractor(MultiFeatureOptions options)- Constructs SpectralFeaturesExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public void AddFeature(string name, Func<float[], float[], float> algorithm)- Adds user-defined spectral feature and compute routine.
- Parameters:
-
name: Feature name/description. -
algorithm: Feature compute routine.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes spectral features for one frame.
- Parameters:
-
block: Data block. -
features: Features computed in block (one feature vector).
-
-
public override bool IsParallelizable()- Returns true; SpectralFeaturesExtractor is always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses SpectralFeaturesExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi;
public class SpectralFeaturesExtractorExample
{
public static void Main()
{
// Create MultiFeatureOptions instance
var options = new MultiFeatureOptions { SamplingRate = 44100, FeatureList = "centroid, spread, flatness, noiseness, rolloff, crest, entropy, decrease, c1, c2, c3, c4, c5, c6", FrameDuration = 0.025f, HopDuration = 0.01f, FftSize = 1024, PreEmphasis = 0.97f, Window = WindowType.Hamming };
// Create SpectralFeaturesExtractor instance
var featureExtractor = new SpectralFeaturesExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = featureExtractor.ComputeFrom(signal);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi.TimeDomainFeaturesExtractor extracts time-domain features (energy, RMS, ZCR, entropy).
-
public const string FeatureSet- Full set of supported time-domain features.
-
public override List<string> FeatureDescriptions { get; }- Gets String descriptions (or simple names) of features.
-
public TimeDomainFeaturesExtractor(MultiFeatureOptions options)- Constructs TimeDomainFeaturesExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public void AddFeature(string name, Func<DiscreteSignal, int, int, float> algorithm)- Adds user-defined time-domain feature and compute routine.
- Parameters:
-
name: Feature name/description. -
algorithm: Feature compute routine.
-
-
public override int ComputeFrom(float[] samples, int startSample, int endSample, IList<float[]> vectors)- Computes feature vectors from samples into vectors.
- Parameters:
-
samples: Sample array. -
startSample: Index of first sample to process in the array. -
endSample: Index of last sample to process in the array (exclusive). -
vectors: Preallocated sequence for result vectors.
-
- Returns: Number of feature vectors computed.
-
public override void ProcessFrame(float[] block, float[] features)- Processes time-domain features for one frame.
- Parameters:
-
block: Data block. -
features: Features computed in block (one feature vector).
-
- Note: Not supported; call ComputeFrom().
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses TimeDomainFeaturesExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.Multi;
public class TimeDomainFeaturesExtractorExample
{
public static void Main()
{
// Create MultiFeatureOptions instance
var options = new MultiFeatureOptions { SamplingRate = 44100, FeatureList = "energy, rms, zcr, entropy", FrameDuration = 0.025f, HopDuration = 0.01f };
// Create TimeDomainFeaturesExtractor instance
var featureExtractor = new TimeDomainFeaturesExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = featureExtractor.ComputeFrom(signal.Samples, 0, signal.Length, new List<float[]>());
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.AmsExtractor extracts amplitude modulation spectrum (AMS) features.
-
public override List<string> FeatureDescriptions { get; }- Gets String descriptions (or simple names) of features.
-
public float[][] Filterbank { get; }- Gets Filterbank matrix [filterCount * (fftSize/2 + 1)].
-
public float[][] Envelopes { get; }- Gets Signal envelopes in frequency bands.
-
public AmsExtractor(AmsOptions options)- Constructs AmsExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override List<float[]> ComputeFrom(float[] samples, int startSample, int endSample)- Computes modulation spectrum vectors from samples.
- Parameters:
-
samples: Sample array. -
startSample: Index of first sample to process in the array. -
endSample: Index of last sample to process in the array (exclusive).
-
- Returns: List of computed feature vectors.
-
public float[][] MakeSpectrum2D(float[] featureVector)- Creates 2D modulation spectrum from flat vector. Axes: [short-time freq] x [modulation freq].
- Parameters:
-
featureVector: AMS feature vector.
-
- Returns: 2D modulation spectrum.
-
public List<float[]> VectorsAtHerz(IList<float[]> featureVectors, float herz = 4)- Gets short-time spectrum sequence at given modulation frequency (default 4 Hz).
- Parameters:
-
featureVectors: AMS feature vector sequence. -
herz: Modulation frequency.
-
- Returns: Short-time spectrum sequence.
-
public override void ProcessFrame(float[] block, float[] features)- Not supported; call ComputeFrom().
- Parameters:
-
block: Data block. -
features: Features computed in block (one feature vector).
-
-
public override int ComputeFrom(float[] samples, int startSample, int endSample, IList<float[]> vectors)- Not supported; call ComputeFrom().
- Parameters:
-
samples: Sample array. -
startSample: Index of first sample to process in the array. -
endSample: Index of last sample to process in the array (exclusive). -
vectors: Preallocated sequence for result vectors.
-
The following example uses AmsExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class AmsExtractorExample
{
public static void Main()
{
// Create AmsOptions instance
var options = new AmsOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, ModulationFftSize = 1024, ModulationHopSize = 128 };
// Create AmsExtractor instance
var amsExtractor = new AmsExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = amsExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
// Get 2D modulation spectrum
var spectrum2D = amsExtractor.MakeSpectrum2D(featureVectors[0]);
Console.WriteLine("2D Modulation Spectrum:");
foreach (var row in spectrum2D)
{
Console.WriteLine(string.Join(", ", row));
}
// Get short-time spectra at modulation frequency
var vectorsAt4Hz = amsExtractor.VectorsAtHerz(featureVectors, 4);
Console.WriteLine("Vectors at 4 Hz:");
foreach (var vector in vectorsAt4Hz)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.ChromaExtractor extracts chroma features.
-
public override List<string> FeatureDescriptions { get; }- Gets String descriptions (or simple names) of features.
- If 12 chroma bins and baseC true: C, C#, D, ... B.
- If 12 bins and baseC false: A, A#, B, C, ... G#.
- Otherwise chroma1, chroma2, etc.
-
public float[][] FilterBank { get; }- Gets Filterbank [ChromaCount * (blockSize/2 + 1)].
-
public ChromaExtractor(ChromaOptions options)- Constructs ChromaExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes chroma feature vector for one frame.
- Parameters:
-
block: Data block. -
features: Chroma feature vector in block.
-
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses ChromaExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class ChromaExtractorExample
{
public static void Main()
{
// Create ChromaOptions instance
var options = new ChromaOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, FftSize = 1024, FeatureCount = 12, BaseC = true };
// Create ChromaExtractor instance
var chromaExtractor = new ChromaExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = chromaExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.FilterbankExtractor computes spectral energy in filterbank bands per frame.
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. fb0, fb1, fb2, etc.
-
public float[][] FilterBank { get; }- Gets Filterbank [filterbankSize * (blockSize/2 + 1)].
-
public FilterbankExtractor(FilterbankOptions options)- Constructs FilterbankExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes filterbank channel output vector for one frame.
- Parameters:
-
block: Data block. -
features: Features computed in block (one feature vector).
-
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses FilterbankExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class FilterbankExtractorExample
{
public static void Main()
{
// Create FilterbankOptions instance
var options = new FilterbankOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, FftSize = 1024, FilterBankSize = 20, LowFrequency = 20, HighFrequency = 20000, NonLinearity = NonLinearityType.Log10, SpectrumType = SpectrumType.Power, LogFloor = 1e-10f };
// Create FilterbankExtractor instance
var filterbankExtractor = new FilterbankExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = filterbankExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.LpccExtractor extracts linear predictive cepstral coefficients (LPCC).
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. lpcc0, lpcc1, etc.
-
public LpccExtractor(LpccOptions options)- Constructs LpccExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes LPCC vector for one frame.
- Parameters:
-
block: Data block. -
features: LPCC feature vector in block.
-
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses LpccExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class LpccExtractorExample
{
public static void Main()
{
// Create LpccOptions instance
var options = new LpccOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, FeatureCount = 13, LpcOrder = 12, LifterSize = 22, PreEmphasis = 0.97f, Window = WindowType.Hamming };
// Create LpccExtractor instance
var lpccExtractor = new LpccExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = lpccExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.LpcExtractor extracts LPC coefficients.
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. error, lpc1, lpc2, etc.
-
public LpcExtractor(LpcOptions options)- Constructs LpcExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes LPC vector for one frame.
- Parameters:
-
block: Data block. -
features: LPC feature vector in block.
-
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses LpcExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class LpcExtractorExample
{
public static void Main()
{
// Create LpcOptions instance
var options = new LpcOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, LpcOrder = 12, PreEmphasis = 0.97f, Window = WindowType.Hamming };
// Create LpcExtractor instance
var lpcExtractor = new LpcExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = lpcExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.MfccExtractor extracts mel-frequency cepstral coefficients (MFCC).
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. mfcc0, mfcc1, mfcc2, etc.
- If energy included, first feature is log_En.
-
public float[][] FilterBank { get; }- Gets Filterbank [filterbankSize * (fftSize/2 + 1)]; default mel filterbank.
-
public MfccExtractor(MfccOptions options)- Constructs MfccExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes MFCC vector for one frame.
- Parameters:
-
block: Data block. -
features: MFCC feature vector in block.
-
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses MfccExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class MfccExtractorExample
{
public static void Main()
{
// Create MfccOptions instance
var options = new MfccOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, FeatureCount = 13, FilterBankSize = 24, FftSize = 1024, LifterSize = 22, PreEmphasis = 0.97f, DctType = "2N", NonLinearity = NonLinearityType.LogE, SpectrumType = SpectrumType.Power, Window = WindowType.Hamming, LogFloor = 1e-10f, IncludeEnergy = true, LogEnergyFloor = 1e-10f };
// Create MfccExtractor instance
var mfccExtractor = new MfccExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = mfccExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.PitchExtractor extracts and tracks pitch.
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. pitch.
-
public PitchExtractor(PitchOptions options)- Constructs PitchExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes pitch feature vector for one frame.
- Parameters:
-
block: Data block. -
features: Pitch feature vector in block.
-
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses PitchExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class PitchExtractorExample
{
public static void Main()
{
// Create PitchOptions instance
var options = new PitchOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, LowFrequency = 80, HighFrequency = 400, PreEmphasis = 0.97f, Window = WindowType.Hamming };
// Create PitchExtractor instance
var pitchExtractor = new PitchExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = pitchExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.PlpExtractor extracts perceptual linear prediction (PLP-RASTA) coefficients.
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. plp0, plp1, plp2, etc.
- If energy included, first feature is log_En.
-
public float[][] FilterBank { get; }- Gets Filterbank; default Bark filterbank.
-
public PlpExtractor(PlpOptions options)- Constructs PlpExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes PLP-RASTA vector for one frame.
- Parameters:
-
block: Data block. -
features: PLP feature vector in block.
-
-
public override void Reset()- Resets extractor.
-
public override bool IsParallelizable()- Returns false when RASTA filtering active; otherwise true.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute; null if not parallelizable.
The following example uses PlpExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class PlpExtractorExample
{
public static void Main()
{
// Create PlpOptions instance
var options = new PlpOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, FeatureCount = 13, LpcOrder = 12, Rasta = 0.1f, FilterBankSize = 24, FftSize = 1024, LifterSize = 22, PreEmphasis = 0.97f, Window = WindowType.Hamming, IncludeEnergy = true, LogEnergyFloor = 1e-10f };
// Create PlpExtractor instance
var plpExtractor = new PlpExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = plpExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.PnccExtractor extracts power-normalized cepstral coefficients (PNCC).
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. pncc0, pncc1, etc.
- If energy included, first feature is log_En.
-
public int M { get; set; } = 2- Gets or setsMedian temporal power window length (2*M+1).
-
public int N { get; set; } = 4- Gets or setsSpectral smoothing window length (2*N+1).
-
public float LambdaA { get; set; } = 0.999f- Gets or setslambda_a in asymmetric noise suppression.
-
public float LambdaB { get; set; } = 0.5f- Gets or setslambda_b in asymmetric noise suppression.
-
public float LambdaT { get; set; } = 0.85f- Gets or setsForgetting factor in temporal masking.
-
public float LambdaMu { get; set; } = 0.999f- Gets or setsForgetting factor in formula.
-
public float C { get; set; } = 2- Gets or setsThreshold for voiced/unvoiced detection.
-
public float MuT { get; set; } = 0.2f- Gets or setsMultiplier in formula.
-
public float[][] FilterBank { get; }- Gets Filterbank; default Gammatone.
-
public PnccExtractor(PnccOptions options)- Constructs PnccExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes PNCC vector for one frame.
- Parameters:
-
block: Data block. -
features: PNCC feature vector in block.
-
-
public override void Reset()- Resets extractor.
The following example uses PnccExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class PnccExtractorExample
{
public static void Main()
{
// Create PnccOptions instance
var options = new PnccOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, FeatureCount = 13, FilterBankSize = 24, FftSize = 1024, PreEmphasis = 0.97f, Window = WindowType.Hamming, IncludeEnergy = true, LogEnergyFloor = 1e-10f, Power = 15 };
// Create PnccExtractor instance
var pnccExtractor = new PnccExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = pnccExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.SpnccExtractor extracts simplified PNCC (SPNCC).
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. spncc0, spncc1, etc.
- If energy included, first feature is log_En.
-
public float LambdaMu { get; set; } = 0.999f- Gets or setsForgetting factor in formula.
-
public float[][] FilterBank { get; }- Gets Filterbank; default Gammatone.
-
public SpnccExtractor(PnccOptions options)- Constructs SpnccExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes SPNCC vector for one frame.
- Parameters:
-
block: Data block. -
features: SPNCC feature vector in block.
-
-
public override void Reset()- Resets extractor.
The following example uses SpnccExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class SpnccExtractorExample
{
public static void Main()
{
// Create PnccOptions instance
var options = new PnccOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, FeatureCount = 13, FilterBankSize = 24, FftSize = 1024, PreEmphasis = 0.97f, Window = WindowType.Hamming, IncludeEnergy = true, LogEnergyFloor = 1e-10f, Power = 15 };
// Create SpnccExtractor instance
var spnccExtractor = new SpnccExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = spnccExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}Vorcyc.Mathematics.SignalProcessing.FeatureExtractors.WaveletExtractor extracts wavelet transform coefficients.
-
public override List<string> FeatureDescriptions { get; }- Gets string descriptions of features, e.g. w0, w1, w2, etc.
-
public float[][] FilterBank { get; }- Gets filterbank matrix.
-
public WaveletExtractor(WaveletOptions options)- Constructs WaveletExtractor from options.
- Parameters:
-
options: Feature extractor configuration options.
-
-
public override void ProcessFrame(float[] block, float[] features)- Computes wavelet coefficient vector for one frame.
- Parameters:
-
block: Data block. -
features: Wavelet coefficient vector in block.
-
-
public override bool IsParallelizable()- Returns true; always parallelizable.
-
public override FeatureExtractor ParallelCopy()- Creates thread-safe copy for parallel compute.
The following example uses WaveletExtractor with comments:
using System;
using Vorcyc.Mathematics.SignalProcessing;
using Vorcyc.Mathematics.SignalProcessing.FeatureExtractors;
public class WaveletExtractorExample
{
public static void Main()
{
// Create WaveletOptions instance
var options = new WaveletOptions { SamplingRate = 44100, FrameDuration = 0.025f, HopDuration = 0.01f, WaveletName = "db4", FeatureCount = 13, FwtSize = 1024, FwtLevel = 5, PreEmphasis = 0.97f, Window = WindowType.Hamming };
// Create WaveletExtractor instance
var waveletExtractor = new WaveletExtractor(options);
// Define input signal
float[] samples = { 0.5f, 0.6f, 0.55f, 0.7f, 0.65f };
var signal = new DiscreteSignal(44100, samples);
// Compute feature vectors
var featureVectors = waveletExtractor.ComputeFrom(signal.Samples, 0, signal.Length);
// Output computed feature vectors
Console.WriteLine("Feature Vectors:");
foreach (var vector in featureVectors)
{
Console.WriteLine(string.Join(", ", vector));
}
}
}