mikeoliphant / neural-amp-modeler-lv2

Neural Amp Modeler LV2 plugin implementation
GNU General Public License v3.0
227 stars 28 forks source link

Plugin doesn't load model after Carla restart. #14

Closed rusk911 closed 1 year ago

rusk911 commented 1 year ago

Expected behavior: load plugin into Carla, load model into plugin, save Carla's preset, close and reopen Carla, load saved Carla's preset, the sound should be the same as before closing Carla.

Actual behavior: after restarting Carla sound is always clean, I need to load the model again.

Carla v. 2.4.1 Linux Mint 20.3

mikeoliphant commented 1 year ago

Strange. It is working for me in Ardour. Can't think why it would work in one DAW but not another.

Can you try using another plugin that uses a path parameter with Carla and see if you have the same problem? This one, for example: https://github.com/x42/convoLV2

rusk911 commented 1 year ago

I can confirm. NAM in Ardour is working. But in Carla no. convoLV2 restores its state. NAM restores only volume knobs but not model file loaded.

mikeoliphant commented 1 year ago

I'm having a hard time reproducing, as I can't get audio working on Carla at all (on Windows - my linux environment is headless). I also haven't been able to get Carla to show me a log.

If you can manage to get the LV2 log information from Carla when saving/loading the plugin, that would be helpful.

mikeoliphant commented 1 year ago

I was able to find LV2 logging in Ardour, and confirm that the saving/loading path is definitely working as expected there.

rusk911 commented 1 year ago

When opening a model file from NAM log shows:

LV2 file path to send: '/home/dima/Neural Amp Modeler/Friedman-BE-04-full-rig-e7cd9ae7221532f339f608464532cccc.nam'

When opening a Carla preset after restart log shows it's loading, but the sound is still clean.

Mapping abstractPath 'Friedman-BE-04-full-rig-e7cd9ae7221532f339f608464532cccc.nam' relative to targetDir '/home/dima/Carla/Neural Amp Modeler'

By the way, second log line shows symlink path, while first one shows direct path to model file. When I open a new model not loaded yet the log shows a symlink creation on preset save:

LV2 file path to send: '/home/dima/Neural Amp Modeler/DS1_maxg_t5-6cf8b700401406ae60ed395d030bac92.nam' Creating symlink for '/home/dima/Neural Amp Modeler/DS1_maxg_t5-6cf8b700401406ae60ed395d030bac92.nam' in '/home/dima/Carla/Neural Amp Modeler'

As you can see model loaded is high gain. I have to reopen model file to get the expected sound. So it's a plugin bug. I can help with debugging and testing if you don't have working Linux. LV2 logs appeared in Carla log tab only in case I start Carla from terminal.

rusk911 commented 1 year ago

I think the best advice you can get directly from Carla maintainer @falkTX, he did a lot for Linux sound community.

falkTX commented 1 year ago

on windows you can get carla logs by running it through any command-line shell.

why things dont work, cant say. But I heavily recommend to try in more than just Ardour and Carla. Sadly on Windows the lv2 host options are quite limited, and Reaper doesnt support what is needed to load files.

falkTX commented 1 year ago

btw, freeing the path pointers should be done with the path free extension, so that it works on windows too. that being http://lv2plug.in/ns/ext/state#freePath

mikeoliphant commented 1 year ago

btw, freeing the path pointers should be done with the path free extension, so that it works on windows too.

Thanks - saw that, but haven't had a chance to implement it yet.

And thanks for the tip on getting the Carla log window to show - that should help a lot to track this down.

mikeoliphant commented 1 year ago

@falkTX It looks to me like Carla might not be mapping paths correctly - at least on Windows?

When saving in Carla, I get this (the lines with "**" are lv2 logging from my plugin):

** calling abstract_path with: C:/Users/oliph/AppData/Roaming/GuitarSim/NAM/JCM2000Crunch.nam
[carla] File::createSymbolicLink failed, unsupported
[carla] Creating symlink for 'C:/Users/oliph/AppData/Roaming/GuitarSim/NAM/JCM2000Crunch.nam' in 'C:\Share\Audio-Video\Carla-2.5.3-win64\Carla\Carla\Neural Amp Modeler'

When loading back, I get:

[carla] Mapping abstractPath 'JCM2000Crunch.nam' relative to targetDir 'C:\Share\Audio-Video\Carla-2.5.3-win64\Carla\Carla\Neural Amp Modeler'
** result of absolute_path is C:\Share\Audio-Video\Carla-2.5.3-win64\Carla\Carla\Neural Amp Modeler\JCM2000Crunch.nam

It looks like Carla is maybe trying to symlink the path to a local folder, but it fails? The folder "C:\Share\Audio-Video\Carla-2.5.3-win64\Carla\Carla\Neural Amp Modeler" gets created, but there is nothing in it.

falkTX commented 1 year ago

right, windows doesnt support symbolic links like other OSes do, and I don't use it myself so didnt test this much or at all. Carla relies on these symbolic links for building, since it saves a lot of space vs copying files around, but makes it a pain to build under windows too...

best to ignore lv2 path stuff on carla + windows for now, try on macOS, Linux, BSD or other non windows system if you can.

mikeoliphant commented 1 year ago

By the way, second log line shows symlink path, while first one shows direct path to model file. When I open a new model not loaded yet the log shows a symlink creation on preset save:

LV2 file path to send: '/home/dima/Neural Amp Modeler/DS1_maxg_t5-6cf8b700401406ae60ed395d030bac92.nam' Creating symlink for '/home/dima/Neural Amp Modeler/DS1_maxg_t5-6cf8b700401406ae60ed395d030bac92.nam' in '/home/dima/Carla/Neural Amp Modeler'

@rusk911 Can you verify that the symlinks to your .nam files are getting created correctly in '/home/dima/Carla/Neural Amp Modeler'`? Thanks!

mikeoliphant commented 1 year ago

Ok - I think I've got this fixed. @rusk911 can you verify on your end? If nothing else, there should be a better error message on failure.

rusk911 commented 1 year ago

Ok - I think I've got this fixed. @rusk911 can you verify on your end? If nothing else, there should be a better error message on failure.

It's working now in Carla but crashing Ardour with segfault when I try to load NAM plugin. NAM build log https://pastebin.com/TaFz04en Ardour shows Segmentation fault in terminal log and crashes without any additional info.

I think fixes and updates better works with isolated feature branches. I've got 2 updates in main branch and not sure which one of them caused segfault in Ardour.

rusk911 commented 1 year ago

By the way, second log line shows symlink path, while first one shows direct path to model file. When I open a new model not loaded yet the log shows a symlink creation on preset save: LV2 file path to send: '/home/dima/Neural Amp Modeler/DS1_maxg_t5-6cf8b700401406ae60ed395d030bac92.nam' Creating symlink for '/home/dima/Neural Amp Modeler/DS1_maxg_t5-6cf8b700401406ae60ed395d030bac92.nam' in '/home/dima/Carla/Neural Amp Modeler'

@rusk911 Can you verify that the symlinks to your .nam files are getting created correctly in '/home/dima/Carla/Neural Amp Modeler'`? Thanks!

yes, symlinks are correct in Carla.

mikeoliphant commented 1 year ago

It's working now in Carla but crashing Ardour with segfault when I try to load NAM plugin.

Hmm. It works fine in Ardour for me - but I'm running it on Windows.

rusk911 commented 1 year ago

It's working now in Carla but crashing Ardour with segfault when I try to load NAM plugin.

Hmm. It works fine in Ardour for me - but I'm running it on Windows.

Here is GDB backtrace: https://pastebin.com/1yjwU2fk

mikeoliphant commented 1 year ago

Here is GDB backtrace: https://pastebin.com/1yjwU2fk

Thanks - that definitely shows the crash in the plugin state restore.

I've add a few more checks to the code to make sure the required path mapping functions are supported. Nothing that should really make a difference in this case, though, as Ardour supports them (unless maybe you're running an old version of Ardour?)

rusk911 commented 1 year ago

Not latest, Ardour 6.9, not too old though. I'm trying to add a new instance of plugin in a new Ardour session, i beleave there's nothing to restore at the moment, probably this is the reason?

mikeoliphant commented 1 year ago

Restoring with no model shouldn't be a problem. I have no issues adding a new plugin instance to a new session in Ardour.

rusk911 commented 1 year ago

Audacity also doesn't want to load the plugin. Screenshot at 2023-04-12 09-08-37

rusk911 commented 1 year ago

Qtractor for some reason shows 2x restore call in the log and does not restore model state after reopen.

Restoring model '(null)'
Missing model_Path
Restoring model '(null)'
Missing model_Path
mikeoliphant commented 1 year ago

Audacity also doesn't want to load the plugin.

I just tested Audacity (on Windows) and it loaded the plugin fine - although Audacity (at least the version I have) does not seem to support atom:Path parameters (no way to select the model).

Just to be clear - I'm definitely not questioning that you are seeing a problem on your end. I'm just having trouble reproducing it so far.

mikeoliphant commented 1 year ago

Qtractor for some reason shows 2x restore call in the log and does not restore model state after reopen.

Having multiple restores seems not uncommon, and shouldn't be a problem. The "Missing model_Path", though, indicates that the model path was not saved correctly. Anything interesting in the log when you save the plugin state?

rusk911 commented 1 year ago

Qtractor for some reason shows 2x restore call in the log and does not restore model state after reopen.

Having multiple restores seems not uncommon, and shouldn't be a problem. The "Missing model_Path", though, indicates that the model path was not saved correctly. Anything interesting in the log when you save the plugin state?

Nothing interesting. At least I haven't found a way to debug it as I did with Ardour.

Just to be clear - I'm definitely not questioning that you are seeing a problem on your end.

I'm just reacting to Filipe's suggestion to test it everywhere. I don't use those programs, only Ardour and Carla.

I'm just having trouble reproducing it so far.

Can you try Ubuntu studio live USB stick? Both Ardour and Carla are in repos, I don't know if it's preinstalled in live image, but should be easy to install using software center. No need to install OS itself, just boot from USB stick.

mikeoliphant commented 1 year ago

Can you try Ubuntu studio live USB stick? Both Ardour and Carla are in repos, I don't know if it's preinstalled in live image, but should be easy to install using software center. No need to install OS itself, just boot from USB stick.

I was trying to get Ardour to run under WSL. Got it working except for audio, so it won't fully start.

I'm running Linux on a Raspberry Pi, but it is headless. I've had X11 forwarding to Windows working before, though, so I should be able to get that set up.

mikeoliphant commented 1 year ago

Ok, I got X11 forwarding working from my Raspberry Pi.

Ardour: Plugin installs fine, but I can't interact with plugin options window (for NAM plugin, or any other). Probably an X11 forwarding bug.

Audactiy: Plugin installs fine, but Audacity doesn't support atom:Path, so I can't select a model.

rusk911 commented 1 year ago

Can you try Ubuntu studio live USB stick? Both Ardour and Carla are in repos, I don't know if it's preinstalled in live image, but should be easy to install using software center. No need to install OS itself, just boot from USB stick.

I was trying to get Ardour to run under WSL. Got it working except for audio, so it won't fully start.

I'm running Linux on a Raspberry Pi, but it is headless. I've had X11 forwarding to Windows working before, though, so I should be able to get that set up.

RPi is an ARM platform, audio things may be difficult to get to working state, never tried it myself, but have read lot of compatibility issues on the internet. I think the best way for testing is booting from live USB stick without installation. On other hand there are some distros for RPi using JACK for audio. For example https://blokas.io/modep/ which could be great target to use NAM LV2 plugin with.

mikeoliphant commented 1 year ago

RPi is an ARM platform, audio things may be difficult to get to working state

I've got no issues with audio on RPi - that's what I'm using it for. I had audio issues trying to run using Windows subsystem for Linux (WSL).

rusk911 commented 1 year ago

Just upgraded my Mint and installed Ardour 7.2. Now NAM lv2 works fine in ardour including restoring it's state. So it probably was Ardour 6.9 issue.

mikeoliphant commented 1 year ago

Cool - glad it is working for you!