コード例 #1
0
 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)));
 }
コード例 #2
0
 public Chord[] GetPredictionsWithChords(float[] samples, int sampleRate, int windowInMs, IProgress <int> progress)
 {
     return(LongAudioProfiling
            .PredictionWithProgressReportAndCustomPredictionWithChords(sampleRate,
                                                                       samples, windowInMs, progress,
                                                                       (sampleRateLambda, samplesLambda) =>
                                                                       GetPredictionWithChord(samplesLambda, sampleRateLambda)));
 }
コード例 #3
0
        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);
        }