HISE Logo Forum
    • Categories
    • Register
    • Login

    Convolution gain louder at higher sample rates

    Scheduled Pinned Locked Moved Bug Reports
    samplerateconvolution
    37 Posts 7 Posters 2.7k 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.
    • lalalandsynthL
      lalalandsynth @Dan Korneff
      last edited by

      @dustbro said in Convolution gain louder at higher sample rates:

      uch for this! I think I have it (mostly) working.
      Any words of advice on how to deal with a user changing sample rates while the plugin is loaded?
      I tried this in the preparedToPlay callback with no luck

      Was this ever solved or do I need to monitor the sample rates and change gain accordingly ?

      https://lalalandaudio.com/

      https://lalalandsynth.com/

      https://www.facebook.com/lalalandsynth

      https://www.facebook.com/lalalandsynth

      lalalandsynthL Dan KorneffD 2 Replies Last reply Reply Quote 0
      • lalalandsynthL
        lalalandsynth @lalalandsynth
        last edited by

        @lalalandsynth ittybittybump. :)

        https://lalalandaudio.com/

        https://lalalandsynth.com/

        https://www.facebook.com/lalalandsynth

        https://www.facebook.com/lalalandsynth

        1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff @lalalandsynth
          last edited by

          @lalalandsynth I believe you still have to self monitor these changes

          Dan Korneff - Producer / Mixer / Audio Nerd

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @Dan Korneff
            last edited by

            Actually I'm not sure whether this is a bug in the convolution engine or a physical /mathematical law that you need to counteract manually. I'd love to encorporate a automatic fix for this into the convolution module directly, but it's not so easy, so maybe something can help me out here.

            Let's assume we have a impulse response at 48 kHz with a single dirac at 0dB at sample position 512. And we're convoluting a signal with the same samplerate, then it would be a simple static delay of 512 samples without modification of the gain. Now If we switch to 96kHz, the impulse response needs to be resampled to match the 96kHz signal input. However this means that the upsampling will duplicate the dirac impulse (so that in the 96k response, we'll have a dirac at sampleposition 1024 and 1025, both at 0dB. If we now convolute the 96k signal, we'll get two delays short after each other which basically causes a +6db gain.

            In this simple example, the solution would be a 6dB attenuation when we double the samplerate (+12db if we quadruple it, etc), but this is only working for this extremely simple test case - as soon as you have a "real" impulse response the upsampling will not be in this linear relation.

            I'm not sure how other convolution reverbs take this into account (or if they don't), so if anybody has a clue about this, let me know.

            d.healeyD 1 Reply Last reply Reply Quote 2
            • d.healeyD
              d.healey @Christoph Hart
              last edited by d.healey

              @Christoph-Hart Might be of interest - https://github.com/juce-framework/JUCE/commit/68d30f9c8d8571acf43a39caffc7d5b64ed9f253

              And here's the forum post - https://forum.juce.com/t/dsp-convolution-changing-level-depending-on-the-host-sample-rate/

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

              Christoph HartC 1 Reply Last reply Reply Quote 1
              • Christoph HartC
                Christoph Hart @d.healey
                last edited by

                @d-healey Well the comment below the commit is correct, the problem is that you can't expect the linearity between resample factor and output gain - you even can't expect the gain change to be the same for each input signal, so it's a highly imprecise thing after all.

                lalalandsynthL 1 Reply Last reply Reply Quote 0
                • lalalandsynthL
                  lalalandsynth @Christoph Hart
                  last edited by

                  @christoph-hart I guess it would be helpful to have an approximation at least, I guess not many users are switching sample rates mid project?

                  https://lalalandaudio.com/

                  https://lalalandsynth.com/

                  https://www.facebook.com/lalalandsynth

                  https://www.facebook.com/lalalandsynth

                  1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk
                    last edited by

                    Or getting a tool that tests different samplerates for an impulse and spits out a compensation table (why not an API we can directly use in script? but execution time might be a problem, or not with the new background thread...)

                    As @Christoph-Hart said it also depends on the input, but this is a lesser problem since users need to compensate for the signal they put in (as it's always been the case in any audio processing)

                    Can't help pressing F5 in the forum...

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

                      What about providing several impulses at different sample rates and loading the one based on the "current" sample rate?

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

                      ustkU 1 Reply Last reply Reply Quote 0
                      • ustkU
                        ustk @d.healey
                        last edited by

                        @d-healey I'm not sure this erases the gain problem, because you have to resample them somewhere anyway, but I might be mistaken...

                        Can't help pressing F5 in the forum...

                        1 Reply Last reply Reply Quote 0
                        • ustkU
                          ustk
                          last edited by ustk

                          Here's an interesting consideration in the last post:

                          Link Preview Image
                          Is it ok to resample impulse response?

                          I have some room impulse response at 48kHz sampling rate. I have recording at 16kHz sampling rate. I want to apply impulse response on the recording. What I do now is downsample impulse response 48...

                          favicon

                          Signal Processing Stack Exchange (dsp.stackexchange.com)

                          My opinion would be to record them at different samplerates from the start, so you never resample, and load them as @d-healey mentioned
                          Although this might not fix the fact that regarding the frequency domain, you'll have additional energy in the upper frequencies at higher SR and so have to deal with (a filter might be enough though)

                          Can't help pressing F5 in the forum...

                          1 Reply Last reply Reply Quote 2
                          • ustkU
                            ustk
                            last edited by

                            Could someone provide me with an IR at two different SR for which you approximately know the gain difference?
                            I'd like to make some tests...

                            Can't help pressing F5 in the forum...

                            1 Reply Last reply Reply Quote 0
                            • bendursoB
                              bendurso
                              last edited by

                              This is from two years ago, was there any change in Hise? I have this same problem.

                              Is it possible to decrease the volume of the Convolution Reverb samples with some configuration? So I could decrease the volume of the samples according to the sample rate.

                              Dan KorneffD 1 Reply Last reply Reply Quote 0
                              • Dan KorneffD
                                Dan Korneff @bendurso
                                last edited by

                                @bendurso I ended up doing some calculations for the gain differences and threw it in a script.

                                Dan Korneff - Producer / Mixer / Audio Nerd

                                bendursoB 1 Reply Last reply Reply Quote 0
                                • bendursoB
                                  bendurso @Dan Korneff
                                  last edited by

                                  @Dan-Korneff said in Convolution gain louder at higher sample rates:

                                  I ended up doing some calculations for the gain differences and threw it in a script.

                                  Did you put a "Simple Gain" and modify it based on the currentSampleRate?

                                  Because only the Wet signal is increased by the sample rate change. The Dry stays the same, and if I put a Simple Gain it will also impact the Dry signal.

                                  Dan KorneffD 1 Reply Last reply Reply Quote 0
                                  • Dan KorneffD
                                    Dan Korneff @bendurso
                                    last edited by

                                    @bendurso I did. I leave the convolution node set to full wet and mange the blend separately.

                                    Dan Korneff - Producer / Mixer / Audio Nerd

                                    bendursoB 1 Reply Last reply Reply Quote 0
                                    • bendursoB
                                      bendurso @Dan Korneff
                                      last edited by

                                      @Dan-Korneff Cool thanks, I was learning scriptnode these days and I was able to do that. But how did you monitor the Sample Rate changes? In your last code post you were asking about that.

                                      Making a timer to monitor the current sample rate would be another option to constantly output the values. Wouldn't there be any problem with this?

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

                                      14

                                      Online

                                      1.7k

                                      Users

                                      11.8k

                                      Topics

                                      103.0k

                                      Posts