Forum
    • Categories
    • Register
    • Login

    Portamento control using knobs and button

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    13 Posts 3 Posters 62 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.
    • D
      duma
      last edited by

      So I check a previous portamento question or forum and I received this code. I wanna know hot to alter it to work by using a knob to control how much slide a sound has when gliding to another note and to have an on & off switch

      /** Portamento & Glide Example
      
      This example shows how to implement a monophonic synth behaviour by only keeping a single
      voice alive and retuning the start note to the last played note number using a pitch fade event.
      
      It also demonstrates the usage of the fix object factory which can be considered as a best practice
      for anything related to voice logic.
      
      */
      Content.makeFrontInterface(600, 600);
      
      // This is a constant glide time, but you can simply make this dynamic and react to pitch delta / 
      // velocity or a UI element.
      const var FADE_TIME = 100;
      
      // Usually you would put this into a script processor of a sound generator
      // but for demonstrating purposes we tuck all of this into the main Interface script
      Synth.deferCallbacks(false);
      
      // A fix object factory is created once with a JSON object as prototype and allows you to create
      // data structures with a fixed memory layout and named properties (hence the name).
      const var f = Engine.createFixObjectFactory({
      	"id": -1,
      	"noteNumber": -1,
      	"time": 0.0
      });
      
      // Create a stack that will hold the actively played notes.
      const var noteStack = f.createStack(256);
      
      // This will store the note information of the first note (and all further notes
      // will use this a reference to figure out the pitch factor).
      reg startNote = f.create();
      
      // Create a single object with the prototype layout that is used
      // for inserting / removing elements from the stack. We'll modify this
      // object and then pass it to the stack so it can do native comparison
      // functions etc.
      reg scratchObject = f.create();
      
      // This function will determine which note to play if you release
      // a key while another one is still held.
      inline function findNewNote()
      {
      	// We'll pick the simplest logic possible:
      	// just pick the first match that comes along your way
      	// You can implement a more fine-grained logic here (eg. use the oldest note,
      	// use the lowest note, etc).
      	for(s in noteStack)
      	{
      		// the syntax is this weird so you can simply swap the condition
      		// for another one...
      		if(true) 
      		{
      			scratchObject.noteNumber = s.noteNumber;
      			scratchObject.id = s.id;
      			scratchObject.time = s.time;
      			break;
      		}
      	}
      	
      	updatePitch();
      }
      
      // Instead of playing new notes, this function will bend the original note to whatever
      // pitch is currently played...
      inline function updatePitch()
      {
      	local delta = scratchObject.noteNumber - startNote.noteNumber;
      	Synth.addPitchFade(startNote.id, FADE_TIME, delta, 0);
      }
      
      LindonL David HealeyD 2 Replies Last reply Reply Quote 0
      • LindonL
        Lindon @duma
        last edited by

        @duma like it says put this in a script processor, add a knob for your slide time, and use its value wherever FADE_TIME is being used....

        HISE Development for hire.
        www.channelrobot.com

        D 1 Reply Last reply Reply Quote 0
        • D
          duma @Lindon
          last edited by

          @Lindon in this script processor? c1c52eb2-ce9e-4e2e-8886-6e86c6d3d3a3-image.png

          D 1 Reply Last reply Reply Quote 0
          • D
            duma @duma
            last edited by

            @duma it just made a whole new interface and im lost please tell me exactly what I should do

            LindonL 1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @duma
              last edited by

              @duma go do Daves bootcamp course.

              HISE Development for hire.
              www.channelrobot.com

              D 1 Reply Last reply Reply Quote 0
              • D
                duma @Lindon
                last edited by

                @Lindon I've done it fully, please just tell me what I need to do

                LindonL 1 Reply Last reply Reply Quote 0
                • LindonL
                  Lindon @duma
                  last edited by

                  @duma if you dont understand what script processors are, how they work, how to use them then you need to go find that out first.

                  HISE Development for hire.
                  www.channelrobot.com

                  D 1 Reply Last reply Reply Quote 0
                  • D
                    duma @Lindon
                    last edited by

                    @Lindon Dude, all Im asking for you to do is help me and guide me, im asking nicely

                    LindonL 1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon @duma
                      last edited by

                      @duma I am helping you and guiding you.

                      HISE Development for hire.
                      www.channelrobot.com

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

                        @duma said in Portamento control using knobs and button:

                        Content.makeFrontInterface(600, 600);

                        Remove this

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

                        D 1 Reply Last reply Reply Quote 0
                        • D
                          duma @David Healey
                          last edited by

                          @David-Healey done but It still opens an interface way smaller 7fb11734-086b-4429-bf8c-3cb6b85f16f2-image.png

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

                            @duma All MIDI processors have an interface. These blog posts might help:
                            https://audiodevschool.com/exploring-hise-built-in-factory-scripts/
                            https://audiodevschool.com/hise-community-scripts-and-snippets/

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

                            D 1 Reply Last reply Reply Quote 0
                            • D
                              duma @David Healey
                              last edited by

                              @David-Healey Alright I understand how am I going to connect this code to a knob on my main interface and a button aswell

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

                              23

                              Online

                              2.2k

                              Users

                              13.4k

                              Topics

                              116.3k

                              Posts