sdatkinson / NeuralAmpModelerPlugin

Plugin for Neural Amp Modeler
MIT License
1.9k stars 127 forks source link

[BUG] Cakewalk (DAW) - Plugin goes silent on stereo tracks #102

Closed James-F2 closed 1 year ago

James-F2 commented 1 year ago

Describe the bug The VST (NAM Loader) stops processing sound and behaves like it is bypassed. All the UI controls stop responding EXCEPT input knob and input meter.

To Reproduce

  1. Add NAM Loader to an audio track and load a capture.
  2. Click the small bypass button next to the plugin in the track's 'FX Rack'.
  3. Click the small bypass button next to the plugin again.

Expected behavior NAM Loader should still process sound. Needless to say this does not happen with any other VST plugin.

Screenshots Cakewalk bypass bug

Desktop (please complete the following information): Windows 10. 0.6.2 VST 3 DAW: Cakewalk by BandLab

sdatkinson commented 1 year ago

This is fixed on main and will be live in the next release. Sit tight! 🙂

sdatkinson commented 1 year ago

Duplicate of #38

James-F2 commented 1 year ago

Thank you sir. I have no means or experience to compile the VST myself.

Maybe automatic daily builds is a good idea? Just the .vst3 will be perfectly fine.

James-F2 commented 1 year ago

Still broken in 0.7.0. Not duplicate.

James-F2 commented 1 year ago

@sdatkinson Found the problem. If the track is set to Stereo the audio disappears once the plugin is bypassed or when any other plugin is added to the track with NAM, but everything is okay when the track is set to Mono, I can't reproduce the bugs when the track is set to Mono.

This is still a bug since people will want to use stereo plugins on the track after NAM Loader. For now a workaround is to send the mono track with NAM to a stereo Bus and load stereo plugins there.

mono

sdatkinson commented 1 year ago

Interesting. Reopening and going to edit the Issue name to reflect

sdatkinson commented 1 year ago

I'll mention parenthetically that the plugin expectsto see a mono input.

This doesn't support dual-mono yet (is there an Issue to track that yet? not sure...), but perhaps something that alerts the user how that it's not being used the way it expects would help in the meantime.

James-F2 commented 1 year ago

A small correction, it doesn't 'go silent' but behaves like it is 'bypassed' (carries the unprocessed direct sound to the output) as I've reported in the first post.

Another related issue; Even if the track is set to Mono, if you put another Stereo only plugin in the fx rack besides NAM, the bug will occur. So NAM Loader really doesn't like stereo tracks or having other stereo effects (like IR Loaders) with it in the same fx rack.

sdatkinson commented 1 year ago

Thanks for the info! This is really helpful for helping me guess what might be going on.

James-F2 commented 1 year ago

Related; https://github.com/sdatkinson/NeuralAmpModelerPlugin/issues/7 https://github.com/sdatkinson/NeuralAmpModelerPlugin/issues/70

iPlug2 channel configuration seems to be the problem.

define PLUG_CHANNEL_IO

Please include 2-2 that was removed in v0.6.1. Try this:

define PLUG_CHANNEL_IO 1-1 1-2 2-2

I have no means to compile and try myself.

James-F2 commented 1 year ago

I confirm this bug does not occur in 0.6.1 which has 2-2 channel configuration only. If anyone can compile a .vst3 with "1-1 1-2 2-2" for testing, I will test all possible mono//stereo DAW settings to confirm correct operation.

damiangr commented 1 year ago

I confirm this bug does not occur in 0.6.1 which has 2-2 channel configuration only. If anyone can compile a .vst3 with "1-1 1-2 2-2" for testing, I will test all possible mono//stereo DAW settings to confirm correct operation.

Thanks! this works for me - I'm also having this bug but this change ( "1-1 1-2 2-2" ) helped

sdatkinson commented 1 year ago

Interesting. Let me take a quick look.

sdatkinson commented 1 year ago

Ok. Here's what I'm finding:

Doing this doesn't seem to introduce anything bad. However, it doesn't change the fact that proper handling of stereo input isn't currently supported by the plugin.

The plugin currently takes the left input and ignores the right; this change doesn't affect that. (To hear it, try putting a ping-pong in front of NAM.)

So the choices are either to

  1. Do this, which keeps it from obviously working wrong, but makes it wrong in a more subtle way.
  2. Don't put this change in, which forces people to not (invalidly) put a stereo signal into the plugin.

I can anticipate that I will close this bug, then another will pop up saying the above, so it doesn't feel like a proper solution to me. This needs #108 to truly get fixed.

@damiangr, @James-F2 Thoughts?

damiangr commented 1 year ago

@sdatkinson I use NAM on a stereo track because I can use a stereo chorus after an amp or delay on the same track. Most guitar amp simulations can run on stereo tracks using one of the channels (or a sum of both /2) as input and can output to a stereo channel. Full stereo processing is something rare in amp sims. IMHO I would not follow the path of signal processing by namm for each channel separately. This only requires a second instance of namm on the second track as far as doubletrack is concerned. Not everyone records doubletracks. Implementation of double processing will double CPU for such cases (stereo track for stereo FX after amp) where it's not needed. More important for me is the seamless operation of the stereo track without sound hangups like in cakewalk. One can use Carla Patchbay(https://github.com/falkTX/Carla) for example to fully process L and R channels with two instances of NAMM. My opinion is - keep it simple as possible. Attempting to satisfy all wishes is doomed to failure as they will collide with each other and create too much complexity where it is not needed and can be dealt with relatively easily otherwise.

sdatkinson commented 1 year ago

I don't disagree with anything you're saying.

Most guitar amp simulations can run on stereo tracks using one of the channels (or a sum of both /2) as input and can output to a stereo channel.

Choosing whether to take L/R/both isn't implemented. I'm not against it, but I simply haven't implemented it and wanted to have a plan there first.

Implementation of double processing will double CPU for such cases

Right--and will double the wall time if appropriate multi-threading isn't used. Risky to ship w/o multi-threading given how we're seeing more and more users w/ computers that are "flying close" on e.g. standard models.

So all I'm saying is that yes, those solutions are reasonable; I just want to have a plan in place so I'm not moving from one bug to another 🙂

James-F2 commented 1 year ago

Can anyone please post a test build with ( "1-1 1-2 2-2" ) fix I can try?

@sdatkinson For now, we can ignore Dual Mono operation, no other professional plugin does that. In Helix Native for example, when you place an Amp block the input is summed to mono, amp blocks are always mono, but you can still place stereo effects after the amp block. YES, all stereo effects before the Amp block will be mono-fied.

--

  1. Do this, which keeps it from obviously working wrong, but makes it wrong in a more subtle way.

But it's not wrong, that's how all guitar plugins operate. I have never seen or used a guitar part that has Left and Right stems in a single track, nobody does that, and again, all guitar plugins that I've tried (Amplitube, Helix, NDSP, etc.) the Amp block will sum the L/R inputs to mono.

damiangr commented 1 year ago

NeuralAmpModeler.zip

@James-F2

Can anyone please post a test build with ( "1-1 1-2 2-2" ) fix I can try? Here you go :)

James-F2 commented 1 year ago

Thank you @damiangr.

Okay, that fixes the 'bypass' bug when moving the plugin in the plugin bin when the track is set to stereo mode, good.

Choosing either Left or Right input is working correctly now, so people can choose what input on their audio interface to use. When choosing combined L+R stereo input, only the Left channel is processed, while most amp plugins will sum L+R to Mono when using an Amp block, ie. Helix Native. The iPlug2 'wrapper' is processing the channels correctly, now we need to sum L+R inputs to mono, test and commit the fix.

James-F2 commented 1 year ago

We can commit #166 as is if summing to mono is a problem.

Summing to mono is typically done like so:

        // add the right (1) to the left (0)
        // store the sum in the left
        buffer.addFrom(0, 0, buffer, 1, 0, buffer.getNumSamples());

        // copy the combined left (0) to the right (1)
        buffer.copyFrom(1, 0, buffer, 0, 0, buffer.getNumSamples());

        // apply 0.5 gain to both
        buffer.applyGain(0.5f);

From here: https://forum.juce.com/t/how-do-i-sum-stereo-to-mono/37579/8

-- Sum = 0.5 * (left.sample + right.sample) I confirm that Helix Native does this for every mono block.

James-F2 commented 1 year ago

@sdatkinson

More information regarding stereo signal chain in DAW.

When the track is set to Stereo and I select one channel input (L or R), the DAW will automatically duplicate the input to the other channel, so we have identical signal in both L and R channels going into the plugin rack, the signal chain remains stereo.

The plugin currently takes the left input and ignores the right;

To maintain the same input gain level in a stereo track we have to use this: 0.5*(L+R), because the DAW will duplicate one channel sources to the other as stated above. This will also preserve any stereo effects before NAM albeit monofied. Yes, that means if we select two channel stereo input and only have data on one channel the signal will be -6db lower when summed to mono, that is correct operation.