Forum
    • Categories
    • Register
    • Login

    NAM Model switching logic

    Scheduled Pinned Locked Moved General Questions
    30 Posts 4 Posters 159 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • OrvillainO
      Orvillain @pratitghosh
      last edited by

      @pratitghosh said in NAM Model switching logic:

      I have 101 nam files, 0.nam to 100.nam, I want the Drive knob to switch between those models. But the neural network stays stuck at the default 50.nam... Can someone please help?

      That's probably not going to give you the result you want. It will not smoothly blend like a drive knob does, and even if it does, it will probably hammer the CPU.

      Musician - Instrument Designer - Sonic Architect - Creative Product Owner
      Crafting sound at every level. From strings to signal paths, samples to systems.

      P 1 Reply Last reply Reply Quote 0
      • P
        pratitghosh @Orvillain
        last edited by

        @Orvillain said in NAM Model switching logic:

        That's probably not going to give you the result you want. It will not smoothly blend like a drive knob does, and even if it does, it will probably hammer the CPU.

        Yeah. I know that's a risk, But I want to atleast see if it CAN be done. Because I can look into optimisation later... But honestly I can't even switch the models at all...

        On that note, you got any ideas on what I could do? Maybe creating a saturation algorithm from all these nam models? Then I could make the plugin an algorithmic saturation plugin...

        resonantR 1 Reply Last reply Reply Quote 0
        • David HealeyD
          David Healey @pratitghosh
          last edited by David Healey

          @pratitghosh Why are you rounding the value of the knob? Can't you change the step size instead?

          You don't need an else after a return on the if.

          if (modelIndex == index) - where are you changing the value of index?

          Free HISE Bootcamp Full Course for beginners.
          YouTube Channel - Public HISE tutorials
          My Patreon - HISE tutorials

          P 1 Reply Last reply Reply Quote 0
          • resonantR
            resonant @pratitghosh
            last edited by resonant

            @pratitghosh you can just use bypass nodes for each model. And these modes will be connected to a xfader node, so it will switch between models

            Edit: 100 models are pretty huge, maybe multiple xfader nodes, each one will switch 8 models

            P 1 Reply Last reply Reply Quote 0
            • P
              pratitghosh @David Healey
              last edited by

              @David-Healey I do have the step size set to 1, I put in the rounding thing as a precaution.. Honestly it can be deleted and it wouldn't change anything...

              Ik I don't need an else, I just added it after testing it without the else when it didn't work. So I thought maybe I should add it (Ik it isn't logical, but programming Gods might have smiled upon me). Anyway that didn't work either.

              I'm not changing the value of index. The index is 50... I just don't want modelIndex == 50 entering the processing so I'm just removing that particular case from the processing.

              1 Reply Last reply Reply Quote 0
              • P
                pratitghosh @resonant
                last edited by

                @resonant Huh... This sounds simple... Let me try it out with 8 nodes First. If it works well, I'll start on adding more...

                David HealeyD 1 Reply Last reply Reply Quote 0
                • David HealeyD
                  David Healey @pratitghosh
                  last edited by David Healey

                  @pratitghosh Put Console.print(value) in the else clause, do you see it change when you change the knob value?

                  Also, where on your system are you nam files?

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  P 1 Reply Last reply Reply Quote 0
                  • P
                    pratitghosh @David Healey
                    last edited by

                    @David-Healey Yes, it does change. However what doesn't change is the object value in the neural network. I did a Console.print(neuralNetwork) inside the else and also just before the inline function. Both print out "Object:2ox7...." something. The same value. Nothing changes.

                    My nam files are in HISE/Projects/API212L/Samples

                    David HealeyD 1 Reply Last reply Reply Quote 0
                    • David HealeyD
                      David Healey @pratitghosh
                      last edited by David Healey

                      @pratitghosh said in NAM Model switching logic:

                      HISE/Projects/API212L/Samples

                      Which folder does FileSystem.getFolder(FileSystem.Samples) point to?

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        pratitghosh @David Healey
                        last edited by

                        @David-Healey The same place...? It does fetch the 50.nam file. It saturates in the same way 50.nam would. That part is working. It's the drive knob callback where I try to switch models that isn't working.

                        Also, I just tried out @resonant 's idea with 5 models at first and it works great, except for when it switches between models there's this white noise burst. As long as that can be removed, I think this project can be completed...

                        David HealeyD resonantR 2 Replies Last reply Reply Quote 0
                        • David HealeyD
                          David Healey @pratitghosh
                          last edited by David Healey

                          @pratitghosh said in NAM Model switching logic:

                          The same place...?

                          Test it - Console.print(FileSystem.getFolder(FileSystem.Samples).toString(0)); just to be sure.

                          Free HISE Bootcamp Full Course for beginners.
                          YouTube Channel - Public HISE tutorials
                          My Patreon - HISE tutorials

                          P 1 Reply Last reply Reply Quote 1
                          • resonantR
                            resonant @pratitghosh
                            last edited by resonant

                            @pratitghosh I think you can use timer node to make a gain node to mute then back to 0 dB to make a smoother transition. This time there will be brief silence every time the knob is tweaked.

                            P 1 Reply Last reply Reply Quote 1
                            • P
                              pratitghosh @David Healey
                              last edited by

                              @David-Healey
                              Interface: F:\Apps\HISE\Projects\API212L\Samples

                              David HealeyD 1 Reply Last reply Reply Quote 0
                              • David HealeyD
                                David Healey @pratitghosh
                                last edited by

                                @pratitghosh Show us the code for your 5 model version.

                                Free HISE Bootcamp Full Course for beginners.
                                YouTube Channel - Public HISE tutorials
                                My Patreon - HISE tutorials

                                P 1 Reply Last reply Reply Quote 0
                                • P
                                  pratitghosh @resonant
                                  last edited by

                                  @resonant This is an acceptable result. Silence is manageable. The white noise bursts are unbearable.

                                  Do you have any place where I can learn how to do this? Is this in the HISE Documentation?

                                  (I'm gonna use this technique to make a Manley Voxbox emulation. There are only 5 gain stages... Well, 10 if you count in the Line and Mic switching... And 20 if you count the xfmr in/out switch... But this can be done... I will make that plugin with this idea. As soon as I can do that silence thing, that is.)

                                  resonantR 1 Reply Last reply Reply Quote 0
                                  • P
                                    pratitghosh @David Healey
                                    last edited by

                                    @David-Healey Not a lot of code, I'm doing this 5-model thing in a new project. Here is the code and the scriptnode.
                                    Screenshot 2026-03-26 175307.png
                                    Screenshot 2026-03-26 175212.png

                                    David HealeyD 1 Reply Last reply Reply Quote 1
                                    • David HealeyD
                                      David Healey @pratitghosh
                                      last edited by

                                      @pratitghosh Aha I see. Using that method you don't need any scripting because you can load the models directly in scriptnode, no? But also I don't think you can implement the timer idea with this method.

                                      Free HISE Bootcamp Full Course for beginners.
                                      YouTube Channel - Public HISE tutorials
                                      My Patreon - HISE tutorials

                                      P 1 Reply Last reply Reply Quote 1
                                      • resonantR
                                        resonant @pratitghosh
                                        last edited by resonant

                                        @pratitghosh yes documentation will be helpful.

                                        Are you using Nam or Aida x? Nam is very cpu extensive in stereo processing. How do you prevent this?
                                        Also can you embed models as json scripts intΔ± the plugin, or external files?

                                        P 1 Reply Last reply Reply Quote 0
                                        • P
                                          pratitghosh @David Healey
                                          last edited by

                                          @David-Healey πŸ˜– πŸ˜– Why is NAM like this... Just give us normies a nice loadModel function in a simple cpp that we can just put in a third party C++ node of our own like

                                          #include "./loader.cpp";
                                          Network.loadModel(index+".nam");

                                          And Boom, job done.

                                          But nooooooo, it has to be convoluted.

                                          (Sorry for the rant I know it's a lot more complex than that)

                                          1 Reply Last reply Reply Quote 0
                                          • P
                                            pratitghosh @resonant
                                            last edited by

                                            @resonant I'm not preventing s#it... I'm just testing out the waters. So 35-40% CPU usage isn't as big of an issue right now. Just trying to see if my idea can actually be realised. Also what's Aida x?

                                            As much as I gathered from other chats in this forum, you can embed models as json scripts. I'm not sure, as a noob, if I'll be able to do it or not... So I am just going the simplest route I can take and kinda brute forcing it to work.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            23

                                            Online

                                            2.2k

                                            Users

                                            13.5k

                                            Topics

                                            117.7k

                                            Posts