guitarix icon indicating copy to clipboard operation
guitarix copied to clipboard

Built in NAM plugin uses 2x CPU as NAM-LV2 in jalv or Carla

Open Rippert opened this issue 4 months ago • 16 comments

On a Raspberry Pi 4, I cannot use the NAM plugin in guitarix because it loads the CPU core at close to 100%. Using the NAM-LV2 plugin in Jalv or Carla uses under 50%. I can't load the NAM-LV2 plugin in guitarix, I assume it is incompatible.

I can use the builtin NAM plugin on a RPI5, but it occasionally gives bursts of xruns.

I would rather use the builtin guitarix NAM plugins because it fits my work-flow much better.

Is there anything that can be done about this?

Rippert avatar Sep 01 '25 23:09 Rippert

Thanks @Rippert. I was just about to open the same issue when I saw this.

I'll add some more info about my setup...

  • rpi 4b 4GB
  • Guitarix w/gui
  • Bookworm w/pipewire
  • scarlet 2i2 interface
  • running guitarix with "pw-jack -p 256 guitarix" (also tried higher period values)
  • compiled latest source today since 0.47 says parallel processes for NAM and recent commits to optimize on pi. Thought that might fix it, but didn't

Standard-size models are garbled with xruns and one CPU core at 100%. I tried removing everything else from the signal chain. I can run tiny and feather NAM models in guitarix w/o problem but they're not as good as standard.

On the same pi the standard models run fine in Carla with the Ratatouille LV2 plugin at about 50-60% DSP.

As the OP mentioned, I'd like to run the standard NAM models in Guitarix for its better workflow, MIDI control, etc, compared to Carla.

Thanks @brummer10 - You're making great stuff!

fivenote avatar Sep 02 '25 00:09 fivenote

We've just receive a contribution from @kidproquo implementing better pi detection https://github.com/brummer10/guitarix/pull/227

It's merged in the latest git, please try if it helps. I'm myself didn't have a Pi so I can't really check what is needed.

brummer10 avatar Sep 02 '25 03:09 brummer10

Thanks @brummer10

I rebuilt with the latest commits and still see the same problem. I’m loading the same NAM and IR. Guitarix pegs the one core at 85-100% while Ratatouille uses 50-60% of the one core. FWIW, I set the CPU to “performance”.

Is there a fundamental difference between how Guitarix and Ratatouille run the NAM models that would account for the big difference in CPU load?

Could the Ratatouille LV2 plugin run in Guitarix? It’s in /usr/lib/lv2 but Guitarix does not include in the list of available LV2 plugins.

fivenote avatar Sep 02 '25 13:09 fivenote

No, there is no difference between guitarix and ratatouille related to the NAM player. And yes, guitarix can't use ratatouille because guitarix didn't support atom ports in the LV2 implementation. I guess there are some optimisation is missing when build guitarix for the PI. Could you post the INFO and CXXFLAGS output from make on Ratatouille and for comparison from ./waf configure --prefix=/usr --includeresampler --includeconvolver --optimization from guitarix, the output for OS CPU version C++ flags

I forget to mention, when you rebuild guitarix, run ./waf clean before so that the included libraries gets build with the new flags.

brummer10 avatar Sep 05 '25 04:09 brummer10

guitarix...

==================
GUITARIX II 0.47.0

OS : linux CPU version : Cortex-A72 C++ flags : -Wall -DGSEAL_ENABLE -O3 -DNDEBUG -mcpu=native -march=native -mtune=native -fomit-frame-pointer -ftree-loop-linear -fno-math-errno -fno-signed-zeros -fstrength-reduce -pipe -std=c++20 -DDSP_SAMPLE_FLOAT -DNAM_SAMPLE_FLOAT -Dneural_amp_modeler_EXPORTS -DRTNEURAL_DEFAULT_ALIGNMENT=32 -DRTNEURAL_USE_EIGEN=1 -DRTNEURAL_NAMESPACE=RTNeural

Ratatouille...

for Linux with cc using ld Using ld with LDEMULATION=aarch64elf -z noexecstack Submodule up to date

=================== DONE ======================= INFO: optimised for -march=armv8-a INFO: build with g++ 12 INFO: using -std=c++20 INFO: Stand-alone with JACK support ================== CXXFLAGS ===================== -march=armv8-a -std=c++20 -MMD -flto=auto -fPIC -DPIC -O3 -Wall -funroll-loops -Wno-sign-compare -Wno-reorder -Wno-infinite-recursion -DUSE_ATOM -fomit-frame-pointer -fstack-protector -fvisibility=hidden -Wno-pessimizing-move -fdata-sections -I. -I./ -I./zita-resampler-1.1.0 -I../FFTConvolver/ -DNDEBUG -DRTNEURAL_DEFAULT_ALIGNMENT=32 -DRTNEURAL_USE_EIGEN=1 -DRTNEURAL_NAMESPACE=RTNeural -DDSP_SAMPLE_FLOAT -DNAM_SAMPLE_FLOAT -Dneural_amp_modeler_EXPORTS -fstrength-reduce -fno-fat-lto-objects -Wno-deprecated-declarations =================== BUILD ======================= Create Ratatouille.lv2 Copy MOD UI to Ratatouille.lv2 build finish, . . . =================== DONE =======================

fivenote avatar Sep 05 '25 18:09 fivenote

I get the same thing on my RPi4. I tried to look up the help for waf but got an error. Might be related to why the new optimization code for RPI doesn't seem to be working. I have previously seen that using native for the compiler directives ends up using a generic profile good for all RPI versions rather than the specific one for that models CPU.

./waf --help Traceback (most recent call last): File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Scripting.py", line 122, in waf_entry_point run_commands() File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Scripting.py", line 181, in run_commands parse_options() File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Scripting.py", line 168, in parse_options ctx.parser.print_help() File "/usr/lib/python3.11/argparse.py", line 2601, in print_help self._print_message(self.format_help(), file) ^^^^^^^^^^^^^^^^^^ File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Options.py", line 19, in format_help return super(ArgParser,self).format_help() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 2585, in format_help return formatter.format_help() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 286, in format_help help = self._root_section.format_help() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in format_help item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in format_help item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 543, in _format_action help_text = self._expand_help(action) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 640, in _expand_help return self._get_help_string(action) % params ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ TypeError: %d format: a real number is required, not dict

Rippert avatar Sep 05 '25 20:09 Rippert

I have seen guides that ask you to leave it at native and let the compiler select the best options for the Pi model it's running on. Maybe that's not working. I can try model specific flags in the waf config and test (I have models 4 and 3b+). Can you provide the details on the exact NAM models you are using to test? I will use the same.

On Fri, Sep 5, 2025, 1:16 PM Rippert @.***> wrote:

Rippert left a comment (brummer10/guitarix#228) https://github.com/brummer10/guitarix/issues/228#issuecomment-3259639409

I get the same thing on my RPi4. I tried to look up the help for waf but got an error. Might be related to why the new optimization code for RPI doesn't seem to be working. I have previously seen that using native for the compiler directives ends up using a generic profile good for all RPI versions rather than the specific one for that models CPU.

./waf --help Traceback (most recent call last): File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Scripting.py", line 122, in waf_entry_point run_commands() File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Scripting.py", line 181, in run_commands parse_options() File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Scripting.py", line 168, in parse_options ctx.parser.print_help() File "/usr/lib/python3.11/argparse.py", line 2601, in print_help self._print_message(self.format_help(), file) ^^^^^^^^^^^^^^^^^^ File "/home/tedrippert/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Options.py", line 19, in format_help return super(ArgParser,self).format_help() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 2585, in format_help return formatter.format_help() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 286, in format_help help = self._root_section.format_help() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in format_help item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in format_help item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 217, in item_help = join([func(*args) for func, args in self.items]) ^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 543, in _format_action help_text = self._expand_help(action) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/argparse.py", line 640, in _expand_help return self._get_help_string(action) % params

TypeError: %d format: a real number is required, not dict

—
Reply to this email directly, view it on GitHub
<https://github.com/brummer10/guitarix/issues/228#issuecomment-3259639409>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADEKVS2RZPD2RNCLOGJA2L3RHVTDAVCNFSM6AAAAACFLR6VIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENJZGYZTSNBQHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>

kidproquo avatar Sep 05 '25 20:09 kidproquo

How native is handled may be distribution dependent. I am using Manjaro linux ARM.

The NAM profile I usually use is called AmpegBa210HFonUltrLowOnEdgeOfCone.nam. I just searched on Tone3000 and can't find it. It was from 2023. I don't think the particular profile matters for this issue, but if you have a particular one you would like to use as a standard that is from Tone3000 or otherwise available I can download that and try it.

Rippert avatar Sep 05 '25 21:09 Rippert

Here’s a good example of a standard model that works for me in Carla/ratatouille but not guitarix/nam…

https://www.tone3000.com/tones/fender-bassman-50-052-1882

fivenote avatar Sep 05 '25 22:09 fivenote

I've fixed the ./waf --help issue. I've as well implemented a check for CORTEX-A53/A72 CPU's setting the -march flag to armv8-a That is the only diff I see between Ratatouille and guitarix build flags related to performance. Please check if that helps.

Otherwise, when you would check more optimisation flags, there is the --cxxflags configure switch were you could put your own flags for optimisation, you could use it instead the automatic --optimisation switch. When you found some more related flags, let me know so that I could implement them in the --optimisation flag.

brummer10 avatar Sep 06 '25 05:09 brummer10

I did a fresh git clone, but can't get past the configure. TO make sure my system is OK, i also pulled the latest Release tar.gz and can configure and build that.

Am I missing a new dependency?

Here's what I get...

Checking for 'liblo' : yes Checking for 'eigen3' : yes Checking for program 'ld' : /usr/bin/ld Checking for 'cairo' : yes Checking for library X11 : not found The configuration failed (complete log in /home/pi/src/guitarix/trunk/build/config.log)

From config.log...

[1/2] Compiling ESC[32mbuild/.conf_check_d898f4b75af88b143e83ebdb0caf255e/test.cppESC[0m

['/usr/bin/g++', '-Wall', '-DGSEAL_ENABLE', '-O3', '-DNDEBUG', '-march=armv8-a', '-mtune=cortex-a72', '-mfpu=neon-fp-armv8', '-mfloat-abi=hard', '-fomit-frame-pointer', '-ftree-loop-linear', '-fno-math-errno', '-fno-signed-zeros', '-fstrength-reduce', '-pipe', '-std=c++20', '-DDSP_SAMPLE_FLOAT', '-DNAM_SAMPLE_FLOAT', '-Dneural_amp_modeler_EXPORTS', '-DRTNEURAL_DEFAULT_ALIGNMENT=32', '-DRTNEURAL_USE_EIGEN=1', '-DRTNEURAL_NAMESPACE=RTNeural', '-DIS_LINUX="linux"', '-DLOCALEDIR="/usr/share/locale"', '-DGETTEXT_PACKAGE="guitarix"', '-DENABLE_NLS=1', '-DHAVE_SNDFILE=1', '-DHAVE_FFTW3_H=1', '-DHAVE_FFTW3=1', '-DHAVE_JACK=1', '-DHAVE_GMODULE_EXPORT=1', '-DHAVE_CURL=1', '-DHAVE_GTHREAD=1', '-DHAVE_GLIBMM=1', '-DHAVE_GTK2=1', '-DHAVE_GTKMM=1', '-DHAVE_GIOMM=1', '-DHAVE_LADSPA_H=1', '-DHAVE_LRDF=1', '-DHAVE_LILV=1', '-DZITA_CONVOLVER_VERSION=3', '-DGX_STYLE_DIR="/usr/share/gx_head/skins"', '-DGX_FACTORY_DIR="/usr/share/gx_head/factorysettings"', '-DGX_SOUND_DIR="/usr/share/gx_head/sounds"', '-DGX_SOUND_BPB_DIR="/usr/share/gx_head/sounds/bands"', '-DGX_SOUND_BPA_DIR="/usr/share/gx_head/sounds/amps"', '-DGX_BUILDER_DIR="/usr/share/gx_head/builder"', '-DGX_ICON_DIR="/usr/share/guitarix/icons"', '-DGX_PIXMAPS_DIR="/usr/share/pixmaps"', '-DGX_METAINFO_DIR="/usr/share/metainfo"', '-DGX_VERSION="0.47.0"', '-DOS_64_BIT=1', '-DHAVE_SIGC=1', '-DHAVE_LV2CORE=1', '-DGX_LV2_STYLE_DIR="/usr/share/gx_head/skins/LV2"', '-DNOOPT=1', '-DHAVE_AVAHI_GOBJECT=1', '-DHAVE_AVAHI_GLIB=1', '-DHAVE_AVAHI_CLIENT=1', '-DHAVE_AVAHI=1', '-DHAVE_BLUEZ=1', '-DHAVE_LIBLO=1', '-DHAVE_EIGEN3=1', '-DHAVE_CAIRO=1', '../test.cpp', '-c', '-o/home/pi/src/guitarix/trunk/build/.conf_check_d898f4b75af88b143e83ebdb0caf255e/testbuild/test.cpp.1.o'] err: g++: error: unrecognized command-line option ‘-mfpu=neon-fp-armv8’ g++: error: unrecognized command-line option ‘-mfloat-abi=hard’

from /home/pi/src/guitarix/trunk/src/LV2/xputty: Test does not build: Traceback (most recent call last): File "/home/pi/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Configure.py", line 337, in run_build bld.compile() File "/home/pi/src/guitarix/trunk/.waf3-2.1.6-6a38d8c49406d2fef32d6f6600c8f033/waflib/Build.py", line 176, in compile raise Errors.BuildError(self.producer.error) waflib.Errors.BuildError: Build failed -> task in 'testprog' failed with exit status 1 (run with -v to display more information)

not found from /home/pi/src/guitarix/trunk/src/LV2/xputty: The configuration failed

fivenote avatar Sep 06 '25 15:09 fivenote

I've removed the last commit which added the -mfpu=neon-fp-armv8 and -mfloat-abi=hard flags, please try again.

brummer10 avatar Sep 06 '25 15:09 brummer10

The build worked, but i get the same results with a standard model from https://github.com/brummer10/guitarix/issues/url. All xruns, one core maxed-out and choppy sound. FWIW... I eliminated everything else from the signal chain

fivenote avatar Sep 06 '25 16:09 fivenote

hm. Maybe @kidproquo found something which we could do, I'm reach the end of my knowledge with this.

@fivenote when you need a neural model loader with MIDI support, you could try NeuralRack https://github.com/brummer10/NeuralRack

when using the stand alone version with jack it supports preset loading via MIDI program change messages. So you could save your presets and switch between them as needed.

brummer10 avatar Sep 07 '25 10:09 brummer10

Good idea. I have NeuralRack. Works good. Also been routing Ratatouille into gx_head.

I also discovered the buffer switch in Ratatouille. It cut DSP even more without bad latency. If the cpu flags are the same in guitarix, is it something like buffers that’s different and making guitarix nam use too much DSP?

fivenote avatar Sep 07 '25 15:09 fivenote

I tried -march=archv8-a on my Pi4 and don't see any difference - 1 core gets loaded to 100% and lots of xruns.

Image

We could try different flags on our respective Pis to see if anything works better. The main challenge is that most of the online docs refer to obsolete flags - that's why I had just settled on native.

Anyways, if you guys are interested, grab this version of trunk/waftools/cpu_optimization.py, edit line 145, to add flags, e.g: cxxflags.extend (["-mcpu=cortex-a72", "-march=armv8-a", "-mtune=cortex-a72"]) (it's a Python list of strings, each flag is a string). Rerun the ./waf configure step, verify the flags show up in the output, build and install.

kidproquo avatar Sep 07 '25 18:09 kidproquo