Exemple #1
0
        public LineSpectrum(Frame frame, FftSize size, BasicSpectrumProvider provider)
        {
            Frame       = frame;
            FftSize     = (int)size;
            MaxFftIndex = FftSize / 2 - 1;

            SpectrumProvider = provider;

            Amplifier = 1;

            MinimumFrequency = 20;
            MaximumFrequency = 20000;

            SpectrumResolution = MatrixPanel.Width;

            UpdateFrequencyMapping();
        }
Exemple #2
0
        private void SetupSource(ISampleSource source)
        {
            var spectrumProvider = new BasicSpectrumProvider(source.WaveFormat.Channels, source.WaveFormat.SampleRate, FftSize.Fft4096);

            Spectrum = new LineSpectrum(Frame, FftSize.Fft4096, spectrumProvider)
            {
                UseAverage      = true,
                IsXLogScale     = true,
                ScalingStrategy = ScalingStrategy.Decibel
            };

            var notificationSource = new SingleBlockNotificationStream(source);

            notificationSource.SingleBlockRead += (sender, args) => spectrumProvider.Add(args.Left, args.Right);

            Source = notificationSource.ToWaveSource(16);
        }