HISE Logo Forum
    • Categories
    • Register
    • Login

    How do you Tempo Sync ADSR?

    Scheduled Pinned Locked Moved General Questions
    60 Posts 5 Posters 830 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
      Delamere @d.healey
      last edited by

      @d-healey when you say "Then recompile HISE" do you mean to do this?

      Screenshot 2025-05-27 at 11.20.13.png

      And is this what you mean by adding it in my project preferences?

      Screenshot 2025-05-27 at 11.16.40.png

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Delamere
        last edited by

        @Delamere yes and yes and you'll also need to add it to the script node extra definitions, also in project preferences

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        D 1 Reply Last reply Reply Quote 0
        • D
          Delamere @d.healey
          last edited by

          @d-healey okay thanks, I can't see the script node extra definitions in the project preferences, is it called something else?

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Delamere
            last edited by d.healey

            @Delamere Extra Definitions Network Dll - you may as well add it to all the extra definitions boxes except iOS.

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            D 1 Reply Last reply Reply Quote 0
            • D
              Delamere @d.healey
              last edited by

              @d-healey Okay thanks, I thought it may be that and I've now added it to the others. There is now a difference but it's still not working. Say for example I change the knobs maximum value to be 20 instead of 18, the tempo knob goes past 1/64t, but the beats values no longer appear and the value in ms still doesn't go any further than 20ms.

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @Delamere
                last edited by

                @Delamere Did you recompile HISE?

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                D 1 Reply Last reply Reply Quote 0
                • D
                  Delamere @d.healey
                  last edited by Delamere

                  @d-healey Yeah, just done it after you said but there's still no difference.

                  The value of the attack in the first screenshot is at 19.0, but it hasn't gone past 1/64t (20ms) despite moving.

                  Screenshot 2025-05-27 at 12.33.07.png

                  In the second screenshot, I have changed the value from 18 to 20 in tempo sync mode expecting the attack to go past 1/64t?

                  Screenshot 2025-05-27 at 12.32.34.png

                  M d.healeyD 2 Replies Last reply Reply Quote 0
                  • M
                    Mighty23 @Delamere
                    last edited by

                    @Delamere said in How do you Tempo Sync ADSR?:

                    but it hasn't gone past 1/64t (20ms) despite moving

                    Link Preview Image
                    tempo_sync node faster than 1/64t

                    I would like to know if there is a trick to set the node 'tempo_sync' faster than 1/64t? Intuitively I think I should use .getHostBPM and .setHostBPM or is t...

                    favicon

                    Forum (forum.hise.audio)

                    it is not possible without modifying the HISE source code and recompiling it. The solution is in the link.

                    Free Party, Free Tekno & Free Software too

                    D 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @Delamere
                      last edited by d.healey

                      @Delamere said in How do you Tempo Sync ADSR?:

                      In the second screenshot, I have changed the value from 18 to 20 in tempo sync mode expecting the attack to go past 1/64t?

                      23 is the top value I think. But yeah 1/64t is the highest.

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

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

                        @Mighty23 thanks, I'm fairly new to HISE so I'm not sure I understand. Do you mean, to replace this..

                        Screenshot 2025-05-27 at 13.02.55.png

                        with..

                        Screenshot 2025-05-27 at 13.04.03.png

                        Then Recompile?

                        Thanks.

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          Mighty23 @Delamere
                          last edited by

                          @Delamere
                          hi_tools/hi_tools/MiscToolClasses.cpp in HISE source code.

                          Find this line and edit as you need, adding tempo values:

                          void TempoSyncer::initTempoData()
                          {
                                  tempoNames.add("32/1");          tempoFactors[ThirtyTwouple] = 128.0f;
                          	tempoNames.add("16/1");		tempoFactors[Sixteenthuple] = 64.0f;
                          	tempoNames.add("8/1");		tempoFactors[Octuple] = 32.0f;
                          	tempoNames.add("4/1");		tempoFactors[Quadruple] = 16.0f;
                          	tempoNames.add("2/1");		tempoFactors[Double] = 8.0f;
                          	tempoNames.add("1/1");		tempoFactors[Whole] = 4.0f;
                          	tempoNames.add("1/2D");	        tempoFactors[HalfDuet] = 2.0f * 1.5f;
                          	tempoNames.add("1/2");		tempoFactors[Half] = 2.0f;
                          	tempoNames.add("1/2T");		tempoFactors[HalfTriplet] = 4.0f / 3.0f;
                          	tempoNames.add("1/4D");	        tempoFactors[QuarterDuet] = 1.0f * 1.5f;
                          	tempoNames.add("1/4");		tempoFactors[Quarter] = 1.0f;
                          	tempoNames.add("1/4T");		tempoFactors[QuarterTriplet] = 2.0f / 3.0f;
                          	tempoNames.add("1/8D");	        tempoFactors[EighthDuet] = 0.5f * 1.5f;
                          	tempoNames.add("1/8");		tempoFactors[Eighth] = 0.5f;
                          	tempoNames.add("1/8T");		tempoFactors[EighthTriplet] = 1.0f / 3.0f;
                          	tempoNames.add("1/16D");	tempoFactors[SixteenthDuet] = 0.25f * 1.5f;
                          	tempoNames.add("1/16");		tempoFactors[Sixteenth] = 0.25f;
                          	tempoNames.add("1/16T");	        tempoFactors[SixteenthTriplet] = 0.5f / 3.0f;
                          	tempoNames.add("1/32D");	tempoFactors[ThirtyTwoDuet] = 0.125f * 1.5f;
                          	tempoNames.add("1/32");		tempoFactors[ThirtyTwo] = 0.125f;
                          	tempoNames.add("1/32T");	tempoFactors[ThirtyTwoTriplet] = 0.25f / 3.0f;
                          	tempoNames.add("1/64D");	tempoFactors[SixtyForthDuet] = 0.125f * 0.5f * 1.5f;
                          	tempoNames.add("1/64");		tempoFactors[SixtyForth] = 0.125f * 0.5f;
                          	tempoNames.add("1/64T");	tempoFactors[SixtyForthTriplet] = 0.125f / 3.0f;
                          }
                          

                          and this:
                          MiscToolClasses.h

                          /** The note values. */
                          	enum Tempo
                          	{
                                          ThirtyTwouple = 0,
                          		Sixteenthuple,
                          		Octuple,
                          		Quadruple,
                          		Double,
                          		Whole, ///< a whole note (1/1)
                          		HalfDuet, ///< a half note duole (1/2D)
                          		Half, ///< a half note (1/2)
                          		HalfTriplet, ///< a half triplet note (1/2T)
                          		QuarterDuet, ///< a quarter note duole (1/4D)
                          		Quarter, ///< a quarter note (1/4)
                          		QuarterTriplet, ///< a quarter triplet note (1/4T)
                          		EighthDuet, ///< a eight note duole (1/8D)
                          		Eighth, ///< a eighth note (1/8)
                          		EighthTriplet, ///< a eighth triplet note (1/8T)
                          		SixteenthDuet, ///< a sixteenth duole (1/16D)
                          		Sixteenth, ///< a sixteenth note (1/16)
                          		SixteenthTriplet, ///< a sixteenth triplet (1/16T)
                          		ThirtyTwoDuet, ///< a 32th duole (1/32D)
                          		ThirtyTwo, ///< a 32th note (1/32)
                          		ThirtyTwoTriplet, ///< a 32th triplet (1/32T)
                          		SixtyForthDuet, ///< a 64th duole (1/64D)
                          		SixtyForth, ///< a 64th note (1/64)
                          		SixtyForthTriplet, ///> a 64th triplet 1/64T)
                          		numTempos
                          	};
                          
                          

                          once you find these lines in the HISE source code, you will need to add the timing parameters you want to add, something like this: .cpp

                          	// (..........) 
                                 setTempo(ThirtyTwo, "1/32", 0.125f);
                          	setTempo(ThirtyTwoTriplet, "1/32T", 0.25f / 3.0f);
                          	setTempo(SixtyForthDuet, "1/64D", 0.125f * 0.5f * 1.5f);
                          	setTempo(SixtyForth, "1/64", 0.125f * 0.5f);
                          	setTempo(SixtyForthTriplet, "1/64T", 0.125f / 3.0f);
                                  // new tempos
                          	setTempo(HundredTwentyEighthDuet, "1/128D", 0.125f * 0.25f * 1.5f);
                          	setTempo(HundredTwentyEighth, "1/128", 0.125f * 0.25f);
                          	setTempo(HundredTwentyEighthTriplet, "1/128T", 0.0625f / 3.0f);
                          	setTempo(TwoHundredFiftySixthDuet, "1/256D", 0.125f * 0.125f * 1.5f);
                          	setTempo(TwoHundredFiftySixth, "1/256", 0.125f * 0.125f);
                          	setTempo(TwoHundredFiftySixthTriplet, "1/256T", 0.03125f / 3.0f);
                          	setTempo(FiveHundredTwelfthDuet, "1/512D", 0.125f * 0.0625f * 1.5f);
                          	setTempo(FiveHundredTwelfth, "1/512", 0.125f * 0.0625f);
                          	setTempo(FiveHundredTwelfthTriplet, "1/512T", 0.015625f / 3.0f);
                          

                          in .h:

                          		SixtyForthDuet, ///< a 64th duole (1/64D)
                          		SixtyForth, ///< a 64th note (1/64)
                          		SixtyForthTriplet, ///> a 64th triplet 1/64T)
                          // add those lines for faster tempos:
                          		HundredTwentyEighthDuet, ///< a 128th note with dot
                          		HundredTwentyEighth, ///< a 128th note
                          		HundredTwentyEighthTriplet, ///< a 128th note triplet
                          		TwoHundredFiftySixthDuet, ///< a 256th note with dot
                          		TwoHundredFiftySixth, ///< a 256th note
                          		TwoHundredFiftySixthTriplet, ///< a 256th note triplet
                          		FiveHundredTwelfthDuet, ///< a 512th note with dot
                          		FiveHundredTwelfth, ///< a 512th note
                          		FiveHundredTwelfthTriplet, ///< a 512th note triplet
                          		numTempos
                          	};
                          

                          I suggest a double check of the values ​​but it should work.

                          Once you have modified the two files (.cpp and .h) you will have to recompile HISE again from its source code.

                          Free Party, Free Tekno & Free Software too

                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @Mighty23
                            last edited by

                            @Delamere Also it's worth noting that any changes you make to the source code will be overwritten the next time you grab the latest version from github, unless you fork the source code and use git to manage changes.

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            1 Reply Last reply Reply Quote 1
                            • D
                              Delamere @d.healey
                              last edited by

                              @d-healey So I could use a Linear Knob that goes from 0.0 to 23.0, as I will be using a Film Strip for my Knobs that won't display the value.

                              Screenshot 2025-05-27 at 13.10.24.png

                              Screen Recording 2025-05-27 at 13.19.08.mov

                              But it's still not possible to go faster than 1/64t, so I'm guessing the only way is to modify the source code like @Mighty23 mentioned. This seems a bit too advanced for me though at this moment in time, but I will look into it.

                              Would I still need to change the source code if I was to use the Transport Handler & Scripting? I really don't understand how to do it that way.

                              Thanks.

                              d.healeyD 1 Reply Last reply Reply Quote 0
                              • d.healeyD
                                d.healey @Delamere
                                last edited by

                                @Delamere said in How do you Tempo Sync ADSR?:

                                Would I still need to change the source code if I was to use the Transport Handler & Scripting?

                                There would be no need to change the source code as far as I can see, you'd just take the tempo value and convert it to ms.

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

                                D 1 Reply Last reply Reply Quote 0
                                • D
                                  Delamere @d.healey
                                  last edited by

                                  @d-healey Okay thanks, if you have any time, could you please explain how to write a script that will mean I can change the AHDSR to be Tempo Synced for any Sampler I apply it to? Similar to what I did in scrip node but with the option to go to 0ms for the Attack, Hold, Sustain & Release if they're not needed.

                                  Thanks.

                                  d.healeyD 1 Reply Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey @Delamere
                                    last edited by

                                    @Delamere said in How do you Tempo Sync ADSR?:

                                    could you please explain how to write a script

                                    Well I already explained it, I think what you're asking is for me to write it, but I think it would be better if you learned how to do it.

                                    Start with that scripting 101 video I mentioned.

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    D 1 Reply Last reply Reply Quote 0
                                    • D
                                      Delamere @d.healey
                                      last edited by

                                      @d-healey Sorry for the confusion, I wasn't asking for you to write it, just to explain it in simpler terms, for someone that's new to scripting. I know what I wan't to do & there are only several things that require scripting to make my Plug-ins do what I need them to. But no matter how much I read on the HISE website I just can't take it in properly or find what I need. I have watched the video you mentioned previously & I will watch it again and see if it makes more sense to me this time. I find videos easier to understand. But I am finding Youtube to be very limited when it comes to HISE videos based on the things I need to do. I can't find anything based around the Transport Handler or Tempo Syncing.

                                      Thanks.

                                      d.healeyD 1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @Delamere
                                        last edited by

                                        @Delamere said in How do you Tempo Sync ADSR?:

                                        I can't find anything based around the Transport Handler or Tempo Syncing.

                                        It's that thing about teaching a man to fish.

                                        If I show you how to do the task you want (I write the code for you basically), you won't really be any further ahead with scripting than you are now. When you run into another task that requires scripting you'll be asking again for a basic explanation.

                                        If you take the time to go through the fundamentals, make some basic projects, write a few scripts. Then when I explain some concepts like callback functions, and setting attributes, you'll understand what I mean and be able to implement them in a way that fits your project.

                                        It's not a quick process, there is a learning curve, but ultimately it gives you control over you projects and allows you to implement the features you want in a way that you understand.

                                        But here's the explanation of what you need to do:

                                        Use transport handler callback to get the host tempo (BPM)

                                        Within your GUI knob's control callbacks use the BPM and the knob's value (tempo sync) to calculate milliseconds then call .setAttribute() to set the value of the ahdsr knobs to the millisecond value you calculated.

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        D 2 Replies Last reply Reply Quote 2
                                        • D
                                          Delamere @d.healey
                                          last edited by

                                          @d-healey Okay I understand what you mean and agree with what you're saying. I am currently watching your video again. Thank you for your help.

                                          1 Reply Last reply Reply Quote 1
                                          • D
                                            Delamere @d.healey
                                            last edited by Delamere

                                            @d-healey

                                            Since we last spoke, I have been constantly learning HISE scripting & I now understand a lot more about it.

                                            I have made simpler scripts based on other things I wanted to do, but I am really struggling to understand how to tempo sync the AHDSR knobs & this is the most important thing I need for my plug-ins. If you could please explain a few things to help me understand it more. This is what I’m stuck on..

                                            const var Transport_Handler = Engine.createTransportHandler();
                                            // Transport_Handler: Provides a Callback that tells the script when the tempo of the DAW has changed.

                                            Transport_Handler.setOnTempoChange(var sync, var f)
                                            // So for this Callback do I use a function & if so, is it an inline function or function?

                                            • “You can use the Tempo”

                                            Const var Get_Host_Bpm = Engine.getHostBpm(); - Is that right?

                                            • Combined with the value of the Knobs from the Interface (Which will be Tempo Synced) 1/4 etc.

                                            How do you get the value of the Knobs & where do I put them?

                                            • To calculate the number of milliseconds the Attack & Release should be.

                                            How do you calculate the number of milliseconds the Attack & Release should be?

                                            • You can use that calculated value (milliseconds) to set the Attack & Release Knobs of the envelope. .setAttribute()

                                            How do you set the Knobs of the envelope?

                                            What do I do with this.. Engine.getMilliSecondsForTempo(int tempoIndex) ?

                                            Thank you for your help.

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            19

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            103.2k

                                            Posts