Пример #1
0
        private void MakeWaveformAndSpectrogram(string videoFileName, string targetFile, int delayInMilliseconds)
        {
            var waveFile = new WavePeakGenerator(targetFile);

            int sampleRate = Configuration.Settings.VideoControls.WaveformMinimumSampleRate; // Normally 128
            while (waveFile.Header.SampleRate % sampleRate != 0 && sampleRate < 5000)
                sampleRate++; // old sample-rate / new sample-rate must have rest = 0

            waveFile.GeneratePeakSamples(sampleRate, delayInMilliseconds); // samples per second - SampleRate

            //if (Configuration.Settings.VideoControls.GenerateSpectrogram)
            //{
            //    //Directory.CreateDirectory(_spectrogramDirectory);
            //    //SpectrogramBitmaps = waveFile.GenerateFourierData(256, _spectrogramDirectory, delayInMilliseconds); // image height = nfft / 2
            //}
            waveFile.WritePeakSamples(Main.GetPeakWaveFileName(videoFileName));
            waveFile.Close();
        }
Пример #2
0
        private void MakeWaveformAndSpectrogram(string videoFileName, string targetFile, int delayInMilliseconds)
        {
            using (var waveFile = new WavePeakGenerator(targetFile))
            {
                waveFile.GeneratePeakSamples(delayInMilliseconds);
                waveFile.WritePeakSamples(Main.GetPeakWaveFileName(videoFileName));

                if (Configuration.Settings.VideoControls.GenerateSpectrogram)
                {
                    waveFile.GenerateFourierData(256, Main.GetSpectrogramFolder(videoFileName), delayInMilliseconds); // image height = nfft / 2
                }
            }
        }