I did something similar in a project which generates a complete LV2 plugin from a collection of impulse audio files. The faust does a _ : ba.selectoutn : <many>, <filters>... : ba.selectn : _. I *think* this approach avoids the overhead of running every filter, so only the selected filter is consuming CPU.
The project is dormant currently as I don't think the conv implementation is as CPU efficient as modern DFT->multiply->IDFT approaches, and that showed in the performance of the generated plugins. If faust provided an optimized frequency domain implementation of fi.conv I would resurrect this project (I don't have the ability to do it myself). Also if convolution values could come from some kind of loaded table instead of inline values that would make loading different filters much easier :) On Tue, Feb 15, 2022 at 10:47 AM Robin Rosenberger <robin.rosenber...@gmx.de> wrote: > Hi faust users! > > This might be a very low-level question, but I've been struggling with > this for a long time now, so I hope you might be able to help me out. I'm > trying to build a guitar amp simulator in pure faust which is basically > using two impulse responses to set the profile > > > _ : fi.conv(pre_ir) : some_amp_stuff : fi.conv(post_ir) : _ > > > In order to utilize different amp profiles I need to change pre_ir and > post_ir, which are about a hundred decimal values each, at runtime. I don't > want to add any additional control code for portability reasons (should run > on different platforms and hardware sooner or later), and because I am not > a good programmer in any language but bash and hopefully faust soon ;) > > Since I could not find a way to change the variables at runtime, I > currently use parallel channels to achieve this, so for the convolution > gets replaced by this > > profile_pre = _<:fi.conv(pre_ir_0)*(chan==0) > ,fi.conv(pre_ir_1)*(chan==1) > ,fi.conv(pre_ir_2)*(chan==2) > ,fi.conv(pre_ir_3)*(chan==3) > ,fi.conv(pre_ir_4)*(chan==4) > ,fi.conv(pre_ir_5)*(chan==5) > ,fi.conv(pre_ir_6)*(chan==6) > :>_; > > Alternatively I tried a serial approach, bypassing the unneeded > convolutions: > > profile_pre = > ba.bypass1((chan!=0),fi.conv(pre_ir_0)):ba.bypass1((chan!=1),fi.conv(pre_ir_1)); > > > where chan is a variable setting the selected channel, obviously. Both > approaches work quite ok on my PC, but both of them seem to actually > calculate at least some of the parallel/bypassed filters all the time. > Because of that I get higher CPU load when using different profiles, and > buffer underruns whenever I try to use it on lower-grade hardware such as > Teensy or Bela, which is basically the goal of this project. Single > convolution filters work fine on both. > > Is there a better way of doing this? > > Really looking forward to any hints! > > Best regards, > > Robin Rosenberger > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users >
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users