![]() |
![]() ![]() ![]() ![]() ![]()
|
next newest topic | next oldest topic |
Author | Topic: Filter Co-efficients |
cristian_vogel Member |
![]() ![]() ![]() I was checking out the FIR filter sound, and set me wondering about how to generate the co-efficients -I don't really understand what they are , or how they change the way a sound is filtered? how do filter co-efficients work, and how to go about generating them from the filter characteristics of an impulse response? and how to think about co-efficients in Waveshaping? Are they points on an input->output map or what? there isn't really anything about co-efficients in the book, so a little guide would be useful ot help grasp what is audibly a very powerful and unique way of shaping sound [This message has been edited by cristian_vogel (edited 19 July 2006).] IP: Logged |
pete Member |
![]() ![]() ![]() Hi Cristian You can think of it as a multi tap delay line but where all the taps are right next to each other. The co-efficients are like the levels of each tap. So if you had 1 1 1 1 1 it would be like playing the signal 5 times each time delayed by one sample. In this case you would probably over load and clip the signal as a lo frequency signal could become amplified five times. A hi frequency signal would be smeared and the plus and minus would tend to cancel a bit and hence get attenuated. This would be a very basic lo pass filter. If instead you put in {1/5} {1/5} {1/5} {1/5} {1/5} then you would get the same thing but without the clipping. If you now put in 1 {-1/4} {-1/4} {-1/4} {-1/4} you can see that a lo frequency will tend to average out to zero and hence get cut quite a lot, but a hi frequency is more likely to get through. This is a very basic hi pass filter. This is a very basic description of a huge subject and I'm sure there are plenty of filter design experts that will tell you all the floors and disadvantages of using the figures I've given, but it might give you a taste of something the you could end up reading about for years. hope this helps Pete IP: Logged |
SSC Administrator |
![]() ![]() ![]() For the FIR, the coefficients are the amplitudes of the taps. Think of each coefficient as a fader on a delayed signal. The order number of the coefficient is the number of samples delay at that tap. For the Waveshaper, a rule of thumb is that even numbered coefficients control the amplitude of even-numbered harmonics in the distortion and odd-numbered coefficients control the amplitude of odd-numbered harmonics in the distortion. In this case the coefficients are like faders on increasing powers of the Input signal that are all mixed together to form the output. For example, using ^ to mean raised-to-the-power-of, we have: (a0 * Input^0) + (a1 * Input^1) + (a2 * Input^2) + .. + (an * Input^n) Anything raised to the zeroeth power is 1, so the first fader, a0, controls DCOffset. Anything raised to the first power is just itself, so the second fader a1 controls the Input. A signal multiplied by itself is ring modulated so a2 is a fader on the difference frequency (0) and the sum frequency (2f or one octave higher), etc. IP: Logged |
cristian_vogel Member |
![]() ![]() ![]() thanks for the replies..
The inverse solution to a Fourier transform is well known: it is simply the inverse Fourier transform. So the coefficients for an FIR filter can be calculated simply by taking the inverse Fourier transform of the desired frequency response. Here is a recipe for calculating FIR filter coefficients: decide upon the desired frequency response
IP: Logged |
cristian_vogel Member |
![]() ![]() ![]() its so hot, i can't sleep...! instead, trawling the web, I find... and I've been reading about IIR and FIR digital filters and how they are defined by co-efficients - I understand it a bit more now - of course, within Kyma, it is possible to make interpolated time-varying Impulse Responses , which makes things really interesting. I'm still keen to find out if an inverse FFT can be used to analyse an impulse response into co-efficients, to experiment with modeling various analog filters, by sampling them and using the result to generate a set of co-efficients... will explore more IP: Logged |
cristian_vogel Member |
![]() ![]() ![]() and one more little reader on FIR filters, and also IIR ... realtively straightforward and easy to understand, I thought... apart from page 2 that got a bit complicated for my limited maths knowledge... http://www.dspguru.com/info/faqs/fir/basics.htm
[This message has been edited by cristian_vogel (edited 20 July 2006).] IP: Logged |
pete Member |
![]() ![]() ![]() Hi Cristian " I'm still keen to find out if an inverse FFT can be used to analyse an impulse response into co-efficients" No it's actually much simpler than that. If you play a single pulse (one sample wide) into a filter and record the output, that recording is the impulse response without any need for FFT. i.e. the first sample of the recording is the first co-effecient the second sample is the second co-effecient etc. What they meant by the inverse FFT method is that if you didn't have a filter to test in the first place you could make one with manuel control over the spectrum. Imagine if you was to put this recorded response into an FFT (non inverse), then you could see the spectrum of the filter, well sort of as the levels could be in the real or the imaginary parts and could be positive or negative. But this still represents the filters spectrum. Obviously if you did an inverse FFT on this you would get back the response you had in the first place. So what they are saying is that if you didn't have a filter in the first place you could draw a spectrum by hand, and then do the inverse FFT on that, and the resulting output could be used as the response (stream of co-efficients) for an FIR filter that would match the spectrum you drew. Did you realize that the crossfilter module is a very big FIR but instead of typing in all the co-effecients, you load them in in the form of the response signal. A one second response is like 44100 co-effecients (if thats the sample rate you are using). hope it helps Pete IP: Logged |
SSC Administrator |
![]() ![]() ![]() As a side note, there is a drawback to using the inverse FFT to get the impulse response of a "hand-drawn" filter: nearly all of the time the resulting impuse response is made up of complex numbers (i.e. a real and an imaginary part). There is no way to translate these complex numbers into tap values. What is normally done is to go back and forth between frequency and time using FFTs, changing the values slightly each time until you end up with an impulse response that contains only real numbers. Another alternative is to look up the formulas for a standard form filter (like a Butterworth low pass filter). What Pete is suggesting (using the CrossFilter) is probably the best way for having a changing impulse response. IP: Logged |
pete Member |
![]() ![]() ![]() If you just hand drew into the real in the time domain wouldn't both the resulting outputs Real and imaginary both contain the same harmonic content as the spectrum, all be it in different phases and that either could be used as a response so long as it had been windowed? IP: Logged |
SSC Administrator |
![]() ![]() ![]() Yes, you could throw away the imaginary part, but you would not get the same filter as you originally drew. One of the problems with the inverse-FFT method of FIR filter design is that you can control the frequency response of the filter at the spectrum points in the FFT, but you cannot easily control the response in-between those points. For example, if you make a perfect lowpass filter using this method, the resulting filter will have very large ripples in the frequency response. [This message has been edited by SSC (edited 21 July 2006).] IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() ![]() |
This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.