public void TestFeatureUtility()
        {
            var arraySoundSignalReader = new ArraySignalReader(new float[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
            var filteredSignal = new PreemphasisFilter(arraySoundSignalReader, 0.95f);

            VoiceActivitySignalReader fu = new VoiceActivitySignalReader(filteredSignal, 5);
            float[] frame1;
            float[] frame2;
            float[] frame3;
            bool isVoice;
            fu.Read( 5, 2, out frame1,out isVoice);
            fu.Read(5, 2, out frame2, out isVoice);
            fu.Read(5, 2, out frame3, out isVoice);

            var arraySoundSignalReader1 = new ArraySignalReader(new float[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
            var filteredSignal1 = new PreemphasisFilter(arraySoundSignalReader1, 0.95f);

            float[] frame4 = new float[5];
            float[] frame5 = new float[5];
            //float[] frame6 = new float[5];

            filteredSignal1.Read(frame4, 0, 5);
            filteredSignal1.Read(frame5, 0, 5);
        }
        private void ExtractFeaturesInternalUsingVad(ISoundSignalReader signal, Action<List<double[]>> featureExtracted,
            SignalVisitor voiceVisitor)
        {
            var featureProvider = FeaturesProviderFactory.GetProvider(ProviderParameters, signal);

            var frameSize = (int) Math.Floor(signal.SampleRate*FrameSizeMiliseconds/1000.0);
            var stepSize = (int) Math.Floor(signal.SampleRate*StepSizeMiliseconds/1000.0);
            var filteredSignal = new PreemphasisFilter(signal, 0.95f);
            float[] frame;

            var voiceStream = new VoiceActivitySignalReader(filteredSignal, frameSize, 8);
            if (voiceVisitor != null)
            {
                voiceStream.Accept(voiceVisitor);
            }

            int index = 0, silentSamples = 0, noOfItems = ProviderParameters.NumberOfCoeff - 1;
            var observables = new List<double[]>();

            bool isVoice;
            while (voiceStream.Read(frameSize, stepSize, out frame, out isVoice))
            {
                if (isVoice)
                {
                    bool isEmpty;
                    var features = featureProvider.Extract(frame, out isEmpty);

                    silentSamples = 0;
                    observables.Add(features);
                    if (featureProvider.ComputeDelta)
                    {
                        ComputeDelta(observables, index - 1, 1, noOfItems);
                        ComputeDelta(observables, index - 2, noOfItems + 1, noOfItems, true);
                    }

                    index++;
                }
                else if (observables.Count > 0 && silentSamples > SilenceThreshHold)
                {
                    if (index >= MinWordLength)
                    {
                        if (featureProvider.ComputeDelta)
                        {
                            ComputeDelta(observables, index - 1, 1, noOfItems);
                            ComputeDelta(observables, index - 2, noOfItems + 1, noOfItems, true);
                            ComputeDelta(observables, index - 1, noOfItems + 1, noOfItems, true);
                        }

                        featureExtracted(observables);
                    }

                    observables = new List<double[]>();
                    index = 0;
                }
                else
                {
                    silentSamples++;
                }
            }
        }