-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tb303filter peaks in wrong direction in example. How to solve that? #45
Comments
After some testing and research, I found the same issue you mentioned. This video is a great explanation of how a ladder filter works which I used as a reference: ECE4450 Moog Ladder Filters Analyzed (Analog Circuits for Music Synthesis, Georgia Tech course). At 1:32 in the video, Dr. Lanterman mentions something called the "quadratic roots of unity." This subject seems to be the root cause of this issue. If you take a look at the diagram in the video at this point, there is a parameter, −ωc. This is the cutoff in terms of radians per second. Maybe the Soundpipe implementation on this filter has the parameter as **+ωc instead? I'm not saying this is the cause, but it's starting to make sense. As you mentioned, the diode latter filter usually peaks when the cutoff frequency parameter is higher. I can confirm that observation by a video of a diode latter filter I found here Oakley Sound TB-303 Diode Ladder VCF. Here's an additional video with the original TB-303 Instrument too Roland TB-303 Bass Line In Action. You can tell when both of the demos turn the cutoff frequency up, the "scream" or "flutter"-- as some call it-- becomes apparent. In addition to this, I think the resonance and distortion parameters start out really high in the Cookbook example. Therefore, as soon as you try to turn the cutoff frequency down, the system will oscillate out of control. Thankfully, something shuts off the audio to save my ears. I think you are doing the right thing and looking in the right place with the Soundpipe code. That is where all the DSP code for the filter is. I'm not sure yet if adding more parameters would help, but I think I will dig deeper and look at it some more. That way, I can be sure I understand how everything works. In the meantime, @aure (creator of AudioKit) and @PaulBatchelor (creator of Soundpipe) may be able to offer additional feedback on this issue. |
It's been a while since I looked at tbvcf, but from what I recall it was never really much of an "emulation" to begin with, more of an empirically tuned biquad filter with loose associations with the tb303 filter sound. This is a filter I'd probably avoid and maybe even deprecate. Soundpipe also has sp_diode, which is based off of Will Pirkle's diode ladder filter, which should be something closer to the TB-303 filter. At the very least, it'll sound better: https://www.willpirkle.com/virtual-analog-diode-ladder-filter/ But honestly, if you're a purist looking for a real tb303 filter emulation, these may all fall short, as these are just generic filter topologies structures that are similar, and not a physical model of the actual 303 circuit. The VCS3 code mentioned above uses JUCE-specific oversampling, which wouldn't be portable. But other than that, I don't see why you couldn't make a soundpipe version of that code. However, there is no license currently for that codebase. For that code to be ported to soundpipe, a license would needed to be added and it would need to be compatible with the MIT license that Soundpipe has. |
@evan: Thanks for confirming what I had said and posting the nice research.
Yeah, the Csound examples were somewhat concerning. Been studying
electronics engineering and some more advanced maths recently, but not
comfy with terms like “biquad” yet. If adept at filter maths and available
for occasional questions, do notify. Admittedly haven’t been focused on
music as much recently because learned from experience that, although I
made one of the best songs ever (THANKFULLY), marketing sadly seems more
important for proper commercial success in some modern societies. Oh, and
also learned that spotify and other music streaming platforms either need
to pay THE ARTIST more per play or be shut down to rescue the music
industry.
@paul: Actually emailed Will a while ago asking if he could write a
replacement for the Csound tbvcf because the Csound team has admitted it’s
obviously a wrong emulation also. Somewhat ridiculously the Csound team
prefers to add a new one rather than replacing that one or merging a pull
request with an accurate emulation because “some projects may be based on
that wrong emulation”. Obviously the Csound team doesn’t seem to know how
companies like Apple have been doing things. Haha.
Anyway, haven’t gotten a reply from Will yet, so seems an engineer in the
Audiokit community that is skilled at filter maths should simply look at
various open source diode ladder filter emulations and make a functional
hybrid in a way that doesn’t infringe on any publicly posted code that was
historically on the Internet before formal FOSS licenses were a common
thing. I do imagine getting Will to approve of porting that filter
emulation would be easier than getting him to write a replacement for tbvcf
though.
By the way, a really cool feature of the original filter is how it
naturally makes rising shepard tones. That alone is enough reason to
include it and to motivate a filter maths aficionado to make a proper
emulation.
…On Fri, Jul 30, 2021 at 2:34 PM Evan Murray ***@***.***> wrote:
After some testing and research, I found the same issue you mentioned.
This video is a great explanation of how a ladder filter works which I used
as a reference: ECE4450 Moog Ladder Filters Analyzed (Analog Circuits for
Music Synthesis, Georgia Tech course) <https://youtu.be/IRxeIEeAAnU?t=92>.
At 1:32 in the video, Dr. Lanterman mentions something called the
"quadratic roots of unity." This subject seems to be the root cause of this
issue. If you take a look at the diagram in the video at this point, there
is a parameter, *−ωc*. This is the cutoff in terms of radians per second.
Maybe the Soundpipe implementation on this filter has the parameter as **
*+ωc* instead? I'm not saying this is the cause, but it's starting to
make sense.
As you mentioned, the diode latter filter usually peaks when the cutoff
frequency parameter is higher. I can confirm that observation by a video of
a diode latter filter I found here Oakley Sound TB-303 Diode Ladder VCF
<https://youtu.be/kxiHEJ_24FA?t=111>. Here's an additional video with the
original TB-303 Instrument too Roland TB-303 Bass Line In Action
<https://youtu.be/rt71d5LIV5M?t=322>. You can tell when both of the demos
turn the cutoff frequency up, the "scream" or "flutter"-- as some call it--
becomes apparent.
In addition to this, I think the resonance and distortion parameters start
out really high in the Cookbook example. Therefore, as soon as you try to
turn the cutoff frequency down, the system will oscillate out of control.
Thankfully, something shuts off the audio to save my ears.
I think you are doing the right thing and looking in the right place with
the Soundpipe code. That is where all the DSP code for the filter is. I'm
not sure yet if adding more parameters would help, but I think I will dig
deeper and look at it some more. That way, I can be sure I understand how
everything works.
In the meantime, @aure <https://github.com/aure> (creator of AudioKit)
and @PaulBatchelor <https://github.com/PaulBatchelor> (creator of
Soundpipe) may be able to offer additional feedback on this issue.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJ7JDTYZ77HFQXUOFGI44TT2L5DRANCNFSM452ZSSRA>
.
|
I got to actually give it to them on this one ... I used to use some software with a totally borked implementation of a flanger, and it was so badass - unwieldy to control, hard to tame, and would blow up, but the sound was incredible. The developer eventually 'fixed' the flanger, and well, I didn't use that software anymore. Those sounds are now stuck in the ether of that time period. I would love to still have that broken flanger around, so I can appreciate their response. |
@eljeff That is what versioning IS FOR. Haha. This is github. 21st century now. Not saying swift 1-3 was excusable, but updates that fix huge mistakes are important to do. Typing this on an apple butterfly keyboard that doesn't type some keys properly (needs to go to an apple store) and that was an apple hardware engineering fail, and CERTAINLY hope apple has upgraded that design, regardless of people that like randomly functional keyboard keys. |
I'd say this is not a cookbook issue, so I'd rather have the discussion moved to SoundpipeAudioKit. |
Been looking at that filter emulation. Would like to use it, but it has "issues". In the example in the cookbook, it peaks in the wrong direction. Basically on the actual instrument, the filter "screams" when the filter is high, not when it is low. But on the example of the emulation, it does the opposite. Maybe that is why it sounds so horribly "wrong".
Was looking at the code in this project and also the filter emulation code. Wasn't obvious how to solve that. Are there some more parameters in that filter that can be added to the init to make it more usable also?
Thanks in advance.
PS: Was looking at it now. Maybe there is a link between something in the "distortion" or resonance and the co frequency that is wrongly backwards in the filter emulation.
Update: Initial guess after tracing the issue through the source code is that the issue is located somewhere between line 87 and 109 in tbvcf.c in /Sources/soundpipe/modules/tbvcf.c located at: https://github.com/AudioKit/AudioKit/blob/b7b68ce544f5009e12ef439d56130187dedaec25/Sources/soundpipe/modules/tbvcf.c
That or the original it was converted from wasn't right either...or it's simply not compatible with soundpipe as both are currently.
This also seems to possibly be a good reference. Has some info showing that the original emulation (http://www.csounds.com/manual/html/tbvcf.html) had some issues and maybe shows useful info or workarounds.
Here is a VCS3 (also a diode ladder) filter emulation to also reference. Maybe it is better/easier also:
https://github.com/VoggLyster/DiodeLadderFilter/blob/master/Source/PluginProcessor.cpp
The text was updated successfully, but these errors were encountered: