Beispiel #1
0
        private void ReadWaveFile(string targetFile, int delayInMilliseconds)
        {
            labelProgress.Text = Configuration.Settings.Language.AddWaveform.GeneratingPeakFile;
            Refresh();

            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)
            {
                labelProgress.Text = Configuration.Settings.Language.AddWaveform.GeneratingSpectrogram;
                Refresh();
                Directory.CreateDirectory(_spectrogramDirectory);
                SpectrogramBitmaps = waveFile.GenerateFourierData(256, _spectrogramDirectory, delayInMilliseconds); // image height = nfft / 2
            }
            WavePeak = waveFile;
            waveFile.Close();

            labelPleaseWait.Visible = false;
        }
Beispiel #2
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();
        }
        private void ReadWaveFile(string targetFile, int delayInMilliseconds)
        {
            labelProgress.Text = Configuration.Settings.Language.AddWaveform.GeneratingPeakFile;
            Refresh();

            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)
            {
                labelProgress.Text = Configuration.Settings.Language.AddWaveform.GeneratingSpectrogram;
                Refresh();
                Directory.CreateDirectory(_spectrogramDirectory);
                SpectrogramBitmaps = waveFile.GenerateFourierData(256, _spectrogramDirectory, delayInMilliseconds); // image height = nfft / 2
            }
            WavePeak = waveFile;
            waveFile.Close();

            labelPleaseWait.Visible = false;
        }
        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();
        }