HISE Logo Forum
    • Categories
    • Register
    • Login

    Timestretch tempo sync, Num Quarters question

    Scheduled Pinned Locked Moved General Questions
    timestretchtempo sync
    15 Posts 3 Posters 180 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.
    • VirtualVirginV
      VirtualVirgin @d.healey
      last edited by VirtualVirgin

      @d-healey What is the NumQuarters an argument for? I don't know what math you need without more context. Are you assuming 4/4 bars?

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

        @VirtualVirgin I have no idea, this is what it says in the docs

        NumQuarters double 0.0 if this is not 0.0, it will skip the automatic detection of the sample length when in tempo-synced mode and use this value to determine the BPM of the source sample (so you will need to set this to the value of your loop lengths).

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

        VirtualVirginV 1 Reply Last reply Reply Quote 0
        • VirtualVirginV
          VirtualVirgin @d.healey
          last edited by VirtualVirgin

          @d-healey It sounds like you just need to calculate the number of quarter notes in your loop.
          You said a loop from bar 2 to 4? So a 2 bar loop? In 4/4?
          NumQuarters = bars * beats
          That's 4 quarters per bar, so your "NumQuarters" should be 8.

          Though is the timestretch for the whole sample length?
          Then I guess you would want 4x4, so NumQuarters = 16.

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

            @VirtualVirgin said in Timestretch tempo sync, Num Quarters question:

            It sounds like you just need to calculate the number of quarter notes in your loop.

            If it was that simple I'd be very happy. It was the first thing I've tried, I tried a bunch of others too.

            I think that documentation must assume that the sample is only as long as the loop, from start to finish. As I said my sample is very long - long release tail, and the looped part doesn't start until bar 2. So while the loop is only 8 quarter notes, that won't provide the BPM of the whole file.

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

            VirtualVirginV 1 Reply Last reply Reply Quote 0
            • VirtualVirginV
              VirtualVirgin @d.healey
              last edited by VirtualVirgin

              @d-healey Can you edit your release tail to end on a specific beat (add space)? If so, maybe you could calculate the total beats from that.

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

                @VirtualVirgin I don't think that would work because the loop is still only going to be 2 bars.

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

                VirtualVirginV 1 Reply Last reply Reply Quote 0
                • VirtualVirginV
                  VirtualVirgin @d.healey
                  last edited by

                  @d-healey But isn't the whole thing getting timestrethced?

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

                    @VirtualVirgin Yes, but each sample is a different length - higher notes have a shorter tail than lower notes. So putting in the total length won't work even if it is right for one sample - which I just tested and it doesn't work, the stretch ratio is completely wrong.

                    @Christoph-Hart Any input on this?

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

                    ChazroxC 1 Reply Last reply Reply Quote 0
                    • ChazroxC
                      Chazrox @d.healey
                      last edited by

                      @d-healey Would it be hard to impliment warping points based on transients marked by the user? Thats how its done in Abelton live. The algorithm I assume is using the math between those markers to calculate timestretching.

                      idk f this helps but this is what I use to get some math out of it when im working...

                      this is the beat increments in /ms @140 bpm.

                      Im surrre with this math you should be able to come up with something. I've seen you guys do some crazy stuff.

                      My guess is the match per beat in between bars (in /ms) needs to be stretched to target tempo (in /ms).

                      Im not a coder at all and I could be speaking redundantly but this is my thought process as a music producer.

                      Link Preview Image
                      Delay & Reverb Time Calculator

                      With the Delay & Reverb Time Calculator, you can improve your songs by tuning your delay and reverb effects to the BPM of your song to clean up your mixes.

                      favicon

                      Another Producer (anotherproducer.com)

                      Screenshot 2025-02-01 at 3.09.15 PM.png

                      ChazroxC d.healeyD 2 Replies Last reply Reply Quote 0
                      • ChazroxC
                        Chazrox @Chazrox
                        last edited by

                        Here's the chart @ 160bpm...

                        so the quarter note length @ 140bpm just needs to be calculated to match the note length @160bpm.

                        Screenshot 2025-02-01 at 3.13.33 PM.png

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

                          @Chazrox said in Timestretch tempo sync, Num Quarters question:

                          Would it be hard to impliment warping points based on transients marked by the user?

                          Probably very hard - no idea - but not necessary for this issue. My samples were recorded to a fixed 140bpm click, it doesn't vary.

                          I just had an idea though. I could forget about the tempo sync mode and use the time variant mode myself and do my own calculation of the pitch ratio - worth a try anyway.

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

                          ChazroxC 1 Reply Last reply Reply Quote 0
                          • ChazroxC
                            Chazrox @d.healey
                            last edited by

                            @d-healey well besides making a new feature in HISE, this is pretty much what I mean. These values are what you need. I've seen you guys do similar calculations before. I believe you can do it!

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

                              @Chazrox said in Timestretch tempo sync, Num Quarters question:

                              These values are what you need.

                              I don't see how they are applicable in this situation.

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

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

                                Ok here's the solution - well it doesn't answer my question but it gets the job done.

                                const var Sampler1 = Synth.getSampler("Sampler1");
                                
                                const th = Engine.createTransportHandler();
                                
                                th.setOnTempoChange(true, updateTimeStretchRatio);
                                
                                // fetch the current state
                                const var obj = Sampler1.getTimestretchOptions();
                                
                                // Apply your changes
                                obj.SkipLatency = true;
                                
                                // Update the options
                                Sampler1.setTimestretchOptions(obj);
                                
                                inline function updateTimeStretchRatio(newTempo)
                                {
                                	local ratio = newTempo / 140;
                                	Sampler1.setTimestretchRatio(ratio);			 
                                }
                                
                                

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

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

                                52

                                Online

                                1.7k

                                Users

                                11.7k

                                Topics

                                102.1k

                                Posts