Accord-NET icon indicating copy to clipboard operation
Accord-NET copied to clipboard

Low pass filter not working

Open dipincluster opened this issue 2 years ago • 0 comments

  • [x] question
  • [x] bug report

I am trying to Use low pass filter but the output is same as the original signal, only difference is the volume/gain or amplitude is less when I play the output wav file.

I have generated a sin wave 4KHz .wav file using NAudio library now I am trying to pass it through a Low Pass Filter using Accord.Audio.Filters LPF implementation.

I am getting the resulting wav file but still the sin wave signal is present after passing through LPF only difference is the volume/gain or amplitude is less when I play the output wav file.

Below is my implementation

is there anything wrong in the code?

            var inSignal = Signal.FromFile("filteroutput.wav");
            LowPassFilter accordFilter = new LowPassFilter(1, inSignal.SampleRate);
            var outSignal = accordFilter.Apply(inSignal);

            MemoryStream destinationStream = new MemoryStream();
            //var fileStream = new FileStream("filteroutput1.wav", FileMode.CreateNew, FileAccess.ReadWrite);
            
            // Create a encoder for the destination stream
            WaveEncoder encoder = new WaveEncoder("filteroutput1.wav");

            // Encode the signal to the destination stream
            encoder.Encode(outSignal);

dipincluster avatar Apr 12 '22 12:04 dipincluster