HISE Logo Forum
    • Categories
    • Register
    • Login

    Delaying the Audio Signal in Audio Samples

    Scheduled Pinned Locked Moved Solved General Questions
    14 Posts 3 Posters 433 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.
    • clevername27C
      clevername27
      last edited by clevername27

      I'm still cracking this nut, and bringing it up here because every so often it's asked here on the forum.

      Module Tree

      The Delay effect only uses milliseconds, with a granularity of 1ms. So that's out.

      ScriptNode

      The Delay Node also only accepts milliseconds—but there's two decimal places, and a Conversion node that translates between samples and milliseconds. But does that give you sample-accurate precision (which is probably why you're using samples in the first place)? And is the Conversion Node using audio samples or sample rate—at least in terms of the editor's warning, it's sample rate (which we probably don't want).


      While we're asking questions, how long should the audio samples in a file take to play? Maybe they're 48000 samples, but the system is running at 44.1kHz…do we then have a quantum paradox of only specifying duration or phase accuracy?

      Any thoughts? I'm probably missing something. 🥴

      A 1 Reply Last reply Reply Quote 0
      • A
        aaronventure @clevername27
        last edited by

        @clevername27 use faust.

        The delay is simply

        process = @samples, @samples;

        clevername27C 1 Reply Last reply Reply Quote 2
        • clevername27C
          clevername27 @aaronventure
          last edited by clevername27

          @aaronventure Thank you - what do those samples correspond to, though? If I have 48kHz samples, but the system is running at 44.1kHz (which I have no control over), then what is the duration of a (say) 4000 sample delay? (Is the context audio samples, or sample-rate?)

          Also, isn't there a lot of unnecessary overhead in using Faust just to fill a buffer?

          A 1 Reply Last reply Reply Quote 0
          • A
            aaronventure @clevername27
            last edited by

            @clevername27 Whatever you want, I thought you didn't want ms? I think your audio samples in the sampler get resampled to the current system sampling rate. So if that's what you're delaying for, use the delay node with ms. It takes in a double, but it only displays one decimal (the issue I talked about before).

            7a4ffaae-672f-4953-bd2a-1730d69e50d5-image.png

            clevername27C 1 Reply Last reply Reply Quote 1
            • clevername27C
              clevername27 @aaronventure
              last edited by

              @aaronventure Thanks, man! That seems to be it, with the clutch being, "…your audio samples in the sampler get resampled to the current system sampling rate". (@Christoph-Hart, could pls verify? Then, we'll have it all on record in one tidy forum post!) Cheers, mates.

              griffinboyG 1 Reply Last reply Reply Quote 0
              • griffinboyG
                griffinboy @clevername27
                last edited by

                @clevername27

                I highly suspect that this conversion is true.
                The rest of hise and scriptnode is compensating for sample rate I have no reason to suspect that this would be different

                A clevername27C 2 Replies Last reply Reply Quote 1
                • A
                  aaronventure @griffinboy
                  last edited by

                  @griffinboy also that's how all other samplers work

                  1 Reply Last reply Reply Quote 1
                  • clevername27C
                    clevername27 @griffinboy
                    last edited by

                    @griffinboy @aaronventure So…let's say I want to delay the playback of a 48K sample precisely—let's say it's a specific zero-crossing point. If the plugin is running at 44.1 kHz (based on the DAW), will the sample still begin at the same (zero-crossing) point?

                    • If I pass the raw sample offset into HISE's API?
                    • If I pass the sample offset into ScriptNode's (or HISEScript's) conversion node/function?

                    It sounds like the answer is yes…?

                    Thanks, guys.

                    griffinboyG A 2 Replies Last reply Reply Quote 0
                    • griffinboyG
                      griffinboy @clevername27
                      last edited by griffinboy

                      @clevername27

                      Okay now that depends on how the resampler works.
                      In general the zero crossing point will stay where it is. But resamplers that work based on smoothing / interpolating can definitely change the value and position of samples. I'd recommend doing tests to see how Hise deals with sample rate conversion: my guess is that it uses linear interpolation and will indeed change the zero crossings. Usually vsts recalculate from scratch if the program needs to know the positions of particular samples or points of interest. Zero crossing detection is pretty straightforward. Fancy sample rate conversion libraries would be needed to get a clean job straight off the bat, IDK if Hise uses them in their samplers.

                      clevername27C 1 Reply Last reply Reply Quote 1
                      • clevername27C
                        clevername27 @griffinboy
                        last edited by

                        @griffinboy Makes sense. So if I'm using the delay to the sample's phase, the result will be very close, but not quite perfect?

                        griffinboyG 1 Reply Last reply Reply Quote 0
                        • griffinboyG
                          griffinboy @clevername27
                          last edited by

                          @clevername27

                          Likely but I recommend testing this. Should be easy to test if you can render the audio files and analyse in an audio editor

                          1 Reply Last reply Reply Quote 1
                          • A
                            aaronventure @clevername27
                            last edited by

                            @clevername27 sample offset works on the sampling rate of the file, otherwise it makes no sense.

                            The playback gets delayed by the sample offset in the original sampling rate, and then it gets resampled to the current engine/host sampling rate.

                            But you need to be controlling that offset in the sampler.

                            clevername27C 1 Reply Last reply Reply Quote 1
                            • clevername27C clevername27 marked this topic as a question on
                            • clevername27C clevername27 has marked this topic as solved on
                            • clevername27C
                              clevername27 @aaronventure
                              last edited by

                              @aaronventure @griffinboy Thanks, mates!

                              griffinboyG 1 Reply Last reply Reply Quote 0
                              • griffinboyG
                                griffinboy @clevername27
                                last edited by

                                @clevername27

                                Ahh he is right! That is a detail I missed sorry. So yes, the sample number will always correspond to the original zero crossing sample. But there is a chance this sample will not be an exact zero crossing anymore if sample playback doesn't start from this exact sample.

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

                                15

                                Online

                                1.7k

                                Users

                                11.8k

                                Topics

                                103.0k

                                Posts