public Chord[] GetPredictionWithBorderDetection(float[] samples, int sampleRate, int windowSizeInMs, int offsetInMs, IProgress <int> progress) { return(LongAudioProfiling .PredictionWithBorderDetection(sampleRate, samples, windowSizeInMs, offsetInMs, progress, (sampleRateLambda, samplesLambda) => GetPredictionWithChord(samplesLambda, sampleRateLambda))); }
public Chord[] GetPredictionsWithChords(float[] samples, int sampleRate, int windowInMs, IProgress <int> progress) { return(LongAudioProfiling .PredictionWithProgressReportAndCustomPredictionWithChords(sampleRate, samples, windowInMs, progress, (sampleRateLambda, samplesLambda) => GetPredictionWithChord(samplesLambda, sampleRateLambda))); }
public (int, float[]) GetSamplesAtPositionGivenWindowInMs(int position, int windowInMs) { var newSampleSize = LongAudioProfiling.GetNumberOfSamplesGivenWindowInMs(sampleRate, windowInMs); var expectedSampleSize = newSampleSize; var isLastChunkIncomplete = samples.Length % newSampleSize != 0; var isLastChunk = (position + 1) * newSampleSize > samples.Length; if (isLastChunk && isLastChunkIncomplete) { newSampleSize = samples.Length % newSampleSize; } var samplesReturned = new float[newSampleSize]; for (var i = 0; i < newSampleSize; i++) { samplesReturned[i] = samples[position * expectedSampleSize + i]; } return(sampleRate, samplesReturned); }