Hi, I'm coding a synthesizer for musical purposes. DSP is not my major, so I'm hitting a kind of road block here. I'm modulating a filter cutoff at audio rate, (audio input signal is a saw tooth and the modulator is a sine wave). At high resonance, the modulation seams to produce side-bands around the frequency of the modulator. If I sweep the filter cutoff manually and approach those side bands, the filter overloads/self oscillates badly. This increases as I increase the amount of modulation depth or resonance of the filter. These overloads happen in and out as the filter cutoff is swept manually producing unpleasant high gain beeping sounds. I've tried to search and experiment for a solution for this to no gain. Any ideas? --------------------------------------- Posted through http://www.DSPRelated.com
Filter FM and sideband overload
Started by ●January 26, 2016
Reply by ●January 26, 20162016-01-26
On Tuesday, January 26, 2016 at 2:30:46 PM UTC+1, S0lo wrote:> Hi, I'm coding a synthesizer for musical purposes. DSP is not my major, so > I'm hitting a kind of road block here. > > I'm modulating a filter cutoff at audio rate, (audio input signal is a saw > tooth and the modulator is a sine wave).What's the frequency of your sine compared to the audio rate?> At high resonance, the modulation seams to produce side-bands around the > frequency of the modulator. If I sweep the filter cutoff manually and > approach those side bands, the filter overloads/self oscillates badly.What does "approach those side bands" mean here? What kind of filter implementation are you using?> This increases as I increase the amount of modulation depth or resonance > of the filter. These overloads happen in and out as the filter cutoff is > swept manually producing unpleasant high gain beeping sounds. > > I've tried to search and experiment for a solution for this to no gain. > Any ideas?TBH, I don't really know what exactly it is you're doing and what your observations are, but maybe this response is still useful: If you're using a higher order filter make sure to implement it as a chain of small order filters (second order sections). AFAIK, this will be more stable when changing the filter parameters than other realizations. You could also try oversampling (working internally at twice or four times the sampling rate and downsample prior audio output). This is usually done to make IIR filters such as lowpass filters behave more like their analogue equivalents if the cutoff/resonance frequency is rather high. It also helps in keeping the audible band clean(er) if you do "nonlinear" stuff such as amplitude or frequency modulation. Cheers! sg
Reply by ●January 26, 20162016-01-26
S0lo <111575@DSPRelated> wrote:>I'm modulating a filter cutoff at audio rate, (audio input signal is a saw >tooth and the modulator is a sine wave).You do not say whether this is a digital or analog filter.>At high resonance, the modulation seams to produce side-bands around the >frequency of the modulator. If I sweep the filter cutoff manually and >approach those side bands, the filter overloads/self oscillates badly. >This increases as I increase the amount of modulation depth or resonance >of the filter. These overloads happen in and out as the filter cutoff is >swept manually producing unpleasant high gain beeping sounds.>I've tried to search and experiment for a solution for this to no gain. >Any ideas?If it's a digital filter, The first thing I would investigate is whether this is a precision issue. That is to say, the undesired effects might be due to overflow, underflow, saturation, or truncation in the arithmetic. The alternative is that the filter, even if implemented in high precision, would still have these artifacts. So in the first case, you need to improve the precision; in the second case, the filter topology is not suited to your applications. Good luck Steve
Reply by ●January 26, 20162016-01-26
On Tue, 26 Jan 2016 15:34:31 +0000, Steve Pope wrote:> S0lo <111575@DSPRelated> wrote: > >>I'm modulating a filter cutoff at audio rate, (audio input signal is a >>saw tooth and the modulator is a sine wave). > > You do not say whether this is a digital or analog filter. > >>At high resonance, the modulation seams to produce side-bands around the >>frequency of the modulator. If I sweep the filter cutoff manually and >>approach those side bands, the filter overloads/self oscillates badly. >>This increases as I increase the amount of modulation depth or resonance >>of the filter. These overloads happen in and out as the filter cutoff is >>swept manually producing unpleasant high gain beeping sounds. > >>I've tried to search and experiment for a solution for this to no gain. >>Any ideas? > > If it's a digital filter, The first thing I would investigate is whether > this is a precision issue. That is to say, the undesired effects might > be due to overflow, underflow, saturation, or truncation in the > arithmetic. > > The alternative is that the filter, even if implemented in high > precision, would still have these artifacts. > > So in the first case, you need to improve the precision; in the second > case, the filter topology is not suited to your applications.I wonder also if the OP hasn't managed to reinvent the parametric amplifier in digital form. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●January 27, 20162016-01-27
Thanks so much to every one here!!. I will try to explain further to answer your questions, Basically I'm programming a software synthesizer. The frequency of the sine (modulator) is any thing from 1KHz to 20Khz. Audio can be any thing from 1Hz to 20Khz. I'm using a typical 2 pole biquad (digital ofcourse). The cut-off frequency of the filter is fed from a knob (on screen) and the sine modulator. Both values are added together. There is also a knob that controls the depth of the modulation, this value is multiplied by the sin. Here is exactly what i'm seeing in my spectrum analyzer. Once modulation begins. a few side bands (notch like harmonics) appear on the left and right of the modulator frequency, this is while cutoff is bellow that frequency (I can see the cutoff freq. because of the high resonance). This is no problem, it sounds good. But as I increase the cutoff, the side bands separate further and further from the modulator frequency. The right side band goes to higher frequencies (no problem with that for now), but the left side band goes lower in frequency approaching the cutoff as I increase it. When those two get too close, a sudden jump (resonation) happens, they merge together into a single very high gain notch, which is my problem. As I increase the cutoff further, the big notch dismantles again into the two notches (one side band, and one from filter resonance). Increasing cutoff further and further, the same thing happens again and again as the cutoff approaches another side band then departs away. I tried oversampling but that doesn't seem to help. Some how I can't seem to find any information about this. There are many guides to do FM with oscillator pitch but not with filter cutoff. I tried doing the same thing with an analog synthesizer, no problem what so ever, the modulation is smooth. There are also other software synthesizers doing the same thing smoothly. I'm so sorry for not being technical about this, It's just that its the first time I do DSP. --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●January 27, 20162016-01-27
S0lo <111575@DSPRelated> wrote:> [snip] > I'm using a typical 2 pole biquad (digital ofcourse). > [snip]"Biquad" does not specify the filter topology. I suspect a different topology than you are using will work better. It sounds like, assuming you have eliminated possible precision issues, as you sweep the sine wave, under some conditions the filter coefficients exhibit a step function rather than continuously varying with the input sweep. If so, this can probably be avoided with the right topology. (Others here may have more exact recommendations.) Or you could try adding a post-smoother for the coefficients, or both. Also the fact that it functions properly with an analog filter may point you in the direction of a better topology for the digital filter, i.e. use a digital filter the signal flow for which looks similar to that of your analog filter. Steve
Reply by ●January 27, 20162016-01-27
On Wed, 27 Jan 2016 22:37:44 +0000, Steve Pope wrote:> S0lo <111575@DSPRelated> wrote: > >> [snip] >> I'm using a typical 2 pole biquad (digital ofcourse). >> [snip] > > "Biquad" does not specify the filter topology. I suspect a different > topology than you are using will work better. > It sounds like, assuming you have eliminated possible precision issues, > as you sweep the sine wave, under some conditions the filter > coefficients exhibit a step function rather than continuously varying > with the input sweep. > > If so, this can probably be avoided with the right topology. (Others > here may have more exact recommendations.) Or you could try adding a > post-smoother for the coefficients, or both.Even without step changes in the coefficients, some filter topologies will cause larger transients in the output that depend on the values in the state variables, while some will cause smaller ones. Think of the difference between a 1st-order low-pass filter that post- multiplies by (1 - pole) vs. one that pre-multiplies. Since the OP is changing coefficients at a rate comparable to the signals he's filtering, this effect can't be ignored.> Also the fact that it functions properly with an analog filter may point > you in the direction of a better topology for the digital filter, i.e. > use a digital filter the signal flow for which looks similar to that of > your analog filter.The issue I mention would exist with an analog filter, too, so I can only second that suggestion. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●January 27, 20162016-01-27
Thanks, here is basically what I'm using: http://www.dsprelated.com/showthread/comp.dsp/334192-1.php Which I modified heavily to be much less CPU intensive.>"Biquad" does not specify the filter topology. I suspect >a different topology than you are using will work better. >It sounds like, assuming you have eliminated possible >precision issues, as you sweep the sine wave, under some >conditions the filter coefficients exhibit a step function >rather than continuously varying with the input sweep. > >If so, this can probably be avoided with the right topology. >(Others here may have more exact recommendations.) Or you could >try adding a post-smoother for the coefficients, or both. >The coefficients movement (which are derived from knob positions) are smoothed because the knob movement it self is smoothed using something similar to exponential decay. Regarding the filter type, whats puzzling me more now is that I just tried the same test with a very simple low pass filter based on the following: Parameters: resofreq = resonation frequency (must be < SR/4) r = 0..1, but not 1 Init: c = 2-2*cos(2*pi*resofreq / samplerate) pos = 0 speed = 0 Loop: speed = speed + (input(t) - pos) * c pos = pos + speed speed = speed * r output(t) = pos The results are the same!!. same sudden very high jumps in gain. There also another thing, I just tried the same test but without any audio input. Same thing again, high self oscillation in and out as I move the cutoff.>Also the fact that it functions properly with an analog filter >may point you in the direction of a better topology for the >digital filter, i.e. use a digital filter the signal flow >for which looks similar to that of your analog filter. > >SteveI'll make a note of that sure, I was using a Doepfer A-102 Diode Low pass. --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●January 27, 20162016-01-27
Sorry, I posted the wrong link, here is the one: http://shepazu.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●January 27, 20162016-01-27
On Wed, 27 Jan 2016 18:10:48 -0600, S0lo wrote:> Thanks, here is basically what I'm using: > http://www.dsprelated.com/showthread/comp.dsp/334192-1.php Which I > modified heavily to be much less CPU intensive. > >>"Biquad" does not specify the filter topology. I suspect a different >>topology than you are using will work better. >>It sounds like, assuming you have eliminated possible precision issues, >>as you sweep the sine wave, under some conditions the filter >>coefficients exhibit a step function rather than continuously varying >>with the input sweep. >> >>If so, this can probably be avoided with the right topology. (Others >>here may have more exact recommendations.) Or you could try adding a >>post-smoother for the coefficients, or both. >> >> > The coefficients movement (which are derived from knob positions) are > smoothed because the knob movement it self is smoothed using something > similar to exponential decay. Regarding the filter type, whats puzzling > me more now is that I just tried the same test with a very simple low > pass filter based on the following: > > Parameters: > resofreq = resonation frequency (must be < SR/4) > r = 0..1, but not 1 > > Init: > c = 2-2*cos(2*pi*resofreq / samplerate) > pos = 0 speed = 0 > > Loop: > speed = speed + (input(t) - pos) * c pos = pos + speed speed = > speed * r output(t) = pos > > The results are the same!!. same sudden very high jumps in gain. There > also another thing, I just tried the same test but without any audio > input. Same thing again, high self oscillation in and out as I move the > cutoff. > >>Also the fact that it functions properly with an analog filter may point >>you in the direction of a better topology for the digital filter, i.e. >>use a digital filter the signal flow for which looks similar to that of >>your analog filter. >> >>Steve > > I'll make a note of that sure, I was using a Doepfer A-102 Diode Low > pass.Are you saying that you used a fixed frequency low-pass filter? Or are you wazulating the resonant frequency with your sine wave? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com