How would I go about implementing a band-pass filter in c#? I'm using a custom MediaStreamSource in Silverlight and am using additive synthesis to produce sound. My audio stream is a continuous stream of int16 shorts:
//over-simplified example:
short sample = oscillator.GetNextSample();
memoryStream.WriteByte((byte)(sample & 0xFF));
memoryStr开发者_StackOverfloweam.WriteByte((byte)(sample >> 8));
...where "sample" is a function of a sine calculation (or some other complex combination of waveforms) ranging from short.MinValue to short.MaxValue.
I have no idea where to start with a band-pass filter. How would I go about implementing it?
Ah, this is what I'm looking for:
Low pass filter software?
I haven't tried it yet, but that is the raw calculation example I was hoping to find. It looks like I'll need to revise that code to work with Int16's instead of doubles, and it also looks like I have a lot of dirty work ahead of me for defining the particular constants/coefficients I'll need, but it should get me started in the right direction.
See the answers to this question, in particular you might find Jacob's answer useful.
puhh this is math , isn´t it ;-) So I guess its System.Math and read this free book
精彩评论