HISE Logo Forum
    • Categories
    • Register
    • Login

    airwindows dither in snex

    Scheduled Pinned Locked Moved General Questions
    4 Posts 3 Posters 490 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.
    • giftliftG
      giftlift
      last edited by

      Ive been trying to re-write this dither code from airwindows in snex

      //stereo 32 bit dither, made small and tidy.
      int expon; frexpf((float)inputSampleL, &expon);
      long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))pow(2,expon+62);
      inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
      frexpf((float)inputSampleR, &expon);
      dither = (rand()/(RAND_MAX
      7.737125245533627e+25))*pow(2,expon+62);
      inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
      //end 32 bit dither

      is there a rand() function? like math.random or something.

      1 Reply Last reply Reply Quote 1
      • C
        clumsybear
        last edited by clumsybear

        @giftlift

        ah, I see the SNEX awesomeness begins. Can't help you with the code unfortunately... anyway, I have to learn snex and dsp eventually.

        1 Reply Last reply Reply Quote 1
        • Christoph HartC
          Christoph Hart
          last edited by

          The SNEX Math API is almost identical to the Javascript Math object:

          Link Preview Image
          HISE | Docs

          favicon

          (docs.hise.audio)

          The only difference is that the functions which do not have an argument have two different function names (because you can‘t overload functions which only differ by return type).

          This is the case for the random function so it‘s called randomFloat() or randomDouble() dependending on what number type you need.

          giftliftG 1 Reply Last reply Reply Quote 3
          • giftliftG
            giftlift @Christoph Hart
            last edited by

            @Christoph-Hart thanks man (∩ ` -´)⊃━━☆゚.*・。゚

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

            13

            Online

            1.7k

            Users

            11.8k

            Topics

            102.3k

            Posts