How to Implement an FIR Filter in C++ [DSP #15]

Поділитися
Вставка

КОМЕНТАРІ • 34

  • @WolfSoundAudio
    @WolfSoundAudio  2 роки тому

    Have I helped you with this video? If yes, please, consider buying me a ☕ coffee at www.buymeacoffee.com/janwilczek
    Thanks! 🙂

  • @MoXyiD
    @MoXyiD 2 роки тому +4

    Good shit bro! I needed to get re-upped on my convolution and you provided GREAT easy to understand (from an engineers perspective) content.

  • @asthasingh7267
    @asthasingh7267 9 місяців тому

    Thanks for putting this up! Great help😊

  • @nickst2797
    @nickst2797 Рік тому

    Thanks! Can you do an IIR tutorial as well?

  • @MatkatMusic
    @MatkatMusic 2 роки тому +3

    Why not use std::vector instead of raw C-style arrays?

    • @WolfSoundAudio
      @WolfSoundAudio  2 роки тому +2

      Hi, Matkat Music, thanks for the question. Since in the filtering function we don't do any memory management, std::vector would be an unnecessary detail. However, if you look into the source code I linked to, you will see that these raw array pointers are initialized with std::vector::data() so they use vectors under the hood :)

    • @wrongitstea
      @wrongitstea 2 роки тому

      for up-to-date cpp, std::span would be better idea.

    • @OMNI_INFINITY
      @OMNI_INFINITY 4 місяці тому +1

      @@wrongitstea Sigh...another reason why there should only be C and Assembly programming languages.

  • @AndriiAndrosovych-u8e
    @AndriiAndrosovych-u8e 2 місяці тому

    Hello! Does it make any sense to write it in assembly? Will we have any increase in performance or will this task be too complex and difficult?I mean standard x64 architecture - a usual laptop (not DSP or MCU)

  • @alexeykononov5596
    @alexeykononov5596 9 місяців тому

    very thorough explanation, thanks 👍 I wish you well in your marketing agenda (it is much more complex than FIN Filter in C++ I presume 🤣)

  • @isaiahclemons1860
    @isaiahclemons1860 2 роки тому

    If I wanted to create an FIR low pass filter at a specific frequency how could I change this code to implement a desired corner frequency?

  • @velvetsound
    @velvetsound 2 роки тому +2

    This was fantastic, thank you. 😀

  • @robc3863
    @robc3863 2 роки тому +2

    Interesting that you used the sound response of a room to somehow make the music match. I think this needs a more generalised explanation because most non DSP mathematicians won't have understood IMO :)

  • @sadewosat
    @sadewosat Рік тому +1

    Can you explain Hilbert transform in c++ too?

  • @athuldas44
    @athuldas44 Рік тому

    How are u implementing sound with the code please can I know this is not domain i am intrested please any one ???

  • @danmiller4091
    @danmiller4091 2 роки тому +1

    Super helpful video thank you very much!!

  • @przekladanki
    @przekladanki 2 роки тому +1

    Nice look with this shirt 🙃

  • @arunaideepan293
    @arunaideepan293 2 роки тому +1

    Useful 👍

  • @farhatibrahim4034
    @farhatibrahim4034 2 роки тому +2

    Also it is a fundamental filter for Video coding ;)

    • @WolfSoundAudio
      @WolfSoundAudio  2 роки тому +1

      Yes, of course! And I want to leave talking about image and video FIR filters to more knowledgeable people :)

  • @bigmistqke
    @bigmistqke 2 роки тому +1

    Damn, that's a pretty crazy result for such a simple filter. I am a bit puzzled how we get from the impulse response to the coefficient list (dsp noob here), but will look into your code to figure out those details.

    • @bigmistqke
      @bigmistqke 2 роки тому

      So, after a bit of thinking, are the coefficients just the magnitudes of each sample of that audio wave? Because an impulse is only 1 sample, all the other sound we hear is a result of convolution, w decaying size over time. Ok, little eye opener over here.

    • @bigmistqke
      @bigmistqke 2 роки тому +1

      It's so bizarre and extremely fascinating how delay, reverberation and filtering are all one and the same thing. Makes sense in one way, twists around my head in the other.

    • @danmiller4091
      @danmiller4091 2 роки тому +1

      @@bigmistqke The coefficients are calculated by multiplying the ideal impulse response of the filter with a windowing function. The textbook DSP A practical Approach by E C. Ifeachor and B. W. Jerwis has a nice examples if you are interested.

    • @bigmistqke
      @bigmistqke 2 роки тому

      @@danmiller4091 thanks for answering my question! I am glossing over it right now, this dsp-literature is quite dense lol. But if i understand it correctly, this multiplying the audio-file of the impulse response by the windowing function is because we are interested in the energy of the signal, right? Makes sense, as it turns the waveform into how the volume changes over time, and that's what the coefficients are. And then from this generated buffer we would take sample #0 and this would be a(0), sample #1 a(1), ..., sample #n a(n)? I assume this is what they describe in the book as the 'direct method'.

    • @WolfSoundAudio
      @WolfSoundAudio  2 роки тому +2

      So the coefficients are just a reversed impulse response with some zero padding for the ease of implementation ;) If we want to use an impulse response of a room as a filter, we don't have to preprocess it :) Windowing is only used when we design the filter in the frequency domain. Thanks for your feedback; my videos are here exactly to make the DSP literature more approachable!

  • @heddshot87
    @heddshot87 Рік тому

    6:58 I thought you were playing Nokia ringtone