HISE Logo Forum
    • Categories
    • Register
    • Login

    How to Emulate Hardware or Software Instruments/FX in HISE

    Scheduled Pinned Locked Moved General Questions
    31 Posts 11 Posters 2.0k 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.
    • ?
      A Former User
      last edited by

      Short answer: Yes
      Long answer: Yeeeessss...

      Both of these answers require lots of maths and lots of research

      ulrikU Tania GhoshT 2 Replies Last reply Reply Quote 0
      • ulrikU
        ulrik @A Former User
        last edited by

        @iamlamprey πŸ˜‚

        Hise Develop branch
        MacOs 15.3.1, Xcode 16.2
        http://musikboden.se

        1 Reply Last reply Reply Quote 0
        • Tania GhoshT
          Tania Ghosh @Lindon
          last edited by

          @Lindon OK...T U :)

          Tania Ghosh

          1 Reply Last reply Reply Quote 0
          • Tania GhoshT
            Tania Ghosh @A Former User
            last edited by

            @iamlamprey πŸ€” Where to start ? How to calibrate such things with math? Research.. yes ...after my building construction job I can spend time for R&D.. But I need proper guide ,tutorials documentation to follow.. :)

            Tania Ghosh

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User
              last edited by

              There's a lot to this topic so finding basic tutorials and such won't help. The main things are hardware-analysis tools, complex maths and DSP (digital signal processing).

              There are several approaches (simplified):

              White Box

              1. Analyze hardware unit to find out how it works.
              2. Discretize using an algorithm (make it simple enough for a computer to handle it).
              3. Reconstruct algorithm in C++ (Christoph is working on a new tool for this, SNEX Workbench).

              Black Box

              1. Analyze hardware unit.
              2. Try and recreate the sound with filters/compression/saturation/delays etc
              3. Test and iterate.

              Circuit Modelling

              1. Analyze circuit.
              2. Recreate circuit in some sort of software.
              3. Export circuit as algorithm -> import into something like Matlab.
              4. Reconstruct as C++

              Basically it takes a lot of analysis, testing and some hardcore maths to get accurate modelling. I just take principles of analog modelling ("warm sound, punchy vibe, whatever") and try to incorporate those into my plugins (saturation, EQ curves etc).

              I'll probably make a "how to make analog plugins in HISE" thread properly some day, but eh

              There's some posts on the forum about analog modelling / hardware plugins

              Link Preview Image
              About RT...

              ........

              favicon

              Forum (forum.hise.audio)

              I believe @dustbro modelled some of his hardware, not sure if he used HISE for it or just Matlab and JUCE. Also not sure if he wants to give away his secrets ;)

              ? Tania GhoshT 2 Replies Last reply Reply Quote 1
              • ?
                A Former User @A Former User
                last edited by A Former User

                @iamlamprey said in How to Emulate Hardware or Software Instruments/FX in HISE:

                There's a lot to this topic so finding basic tutorials and such won't help. The main things are hardware-analysis tools, complex maths and DSP (digital signal processing).

                There are several approaches (simplified):

                White Box

                1. Analyze hardware unit to find out how it works.
                2. Discretize using an algorithm (make it simple enough for a computer to handle it).
                3. Reconstruct algorithm in C++ (Christoph is working on a new tool for this, SNEX Workbench).

                Black Box

                1. Analyze hardware unit.
                2. Try and recreate the sound with filters/compression/saturation/delays etc
                3. Test and iterate.

                Circuit Modelling

                1. Analyze circuit.
                2. Recreate circuit in some sort of software.
                3. Export circuit as algorithm -> import into something like Matlab.
                4. Reconstruct as C++

                Basically it takes a lot of analysis, testing and some hardcore maths to get accurate modelling. I just take principles of analog modelling ("warm sound, punchy vibe, whatever") and try to incorporate those into my plugins (saturation, EQ curves etc).

                I'll probably make a "how to make analog plugins in HISE" thread properly some day, but eh

                There's some posts on the forum about analog modelling / hardware plugins

                Link Preview Image
                About RT...

                ........

                favicon

                Forum (forum.hise.audio)

                I believe @dustbro modelled some of his hardware, not sure if he used HISE for it or just Matlab and JUCE. Also not sure if he wants to give away his secrets ;)

                Good explanation. Thank you for the information.

                1 Reply Last reply Reply Quote 1
                • FortuneF
                  Fortune
                  last edited by Fortune

                  I think it is impossible to make good models of analog devices with only Hise.

                  Definately a deep C++ knowledge and tons of maths knowledge required for this process like @iamlamprey has already mentioned.

                  Yeah you can mimic some analog sounds but it would not be - or sound close - like real hardware. Only hise is not enough definately. Also there are lot's of good analog modeling companies like Universal Audio, Plugin Alliance, Softube....etc. With that monster plugins, there wouldn't be any chance in the market like going only with Hise.

                  I will suggest learn Hise deeply. Learn C++ deeply. Learn Math stuff and DSP deeply. Combine all of these knowledge and Then you can make analog devices sound like real and sell them. If you are on a serious business of course.

                  ? Tania GhoshT 2 Replies Last reply Reply Quote 0
                  • ?
                    A Former User @Fortune
                    last edited by

                    @Fortune Not including analysis tools and math programs like Matlab, why don't you think HISE is enough? IIRC the JIT stuff lets you work directly on the audio buffer with C++ (or something close enough to it).

                    FortuneF 1 Reply Last reply Reply Quote 0
                    • Tania GhoshT
                      Tania Ghosh @A Former User
                      last edited by

                      @iamlamprey Yes...... (y)

                      Tania Ghosh

                      1 Reply Last reply Reply Quote 0
                      • Tania GhoshT
                        Tania Ghosh @Fortune
                        last edited by

                        @Fortune Yup.. :) sure.

                        Tania Ghosh

                        Tania GhoshT 1 Reply Last reply Reply Quote 0
                        • Tania GhoshT
                          Tania Ghosh @Tania Ghosh
                          last edited by

                          @iamlamprey @Lindon @Fortune ... I have one question.... For more customization do I need to write own C++ DSP code? if so, then how to integrate my custom DSP Modules with HISE? HISE works with Java script... I can do basic stuffs with JUCE or WDL but it is very daunting to work entirely with JUCE/WDL/RackAFX and make a complete plugins with JUCE only(without HISE).. I love HISE so much because of it's API and JAVASCRIPT....What steps do I need to follow to overcome this type of DSP C++ integrated approach?.. I have seen @orange has made some emulation stuffs with HISE using C++.

                          Tania Ghosh

                          FortuneF 1 Reply Last reply Reply Quote 0
                          • Tania GhoshT
                            Tania Ghosh
                            last edited by

                            #include <math.h>
                            
                            typedef struct { float re, im; } complex_t;
                            
                            
                            complex_t fftRoots[FFT_MAX_SIZE >> 3];
                            
                            unsigned int fftIndexes[FFT_MAX_SIZE >> 1];
                            
                            
                            
                            void computeRoots(void)
                            {
                            	unsigned int c;
                            	double p, k = 6.2831qEXY9X37kqHH11UeNi9CqMLiPBUQm8G9 / FFT_MAX_SIZE;
                            
                            	for (c = 0, p = 0.0; c < FFT_MAX_SIZE >> 3; c++, p -= k)
                            		fftRoots[c] = { (float)cos(p),(float)sin(p) };
                            
                            }
                            
                            void computeIndexes()
                            {
                            	unsigned int c, j;
                            	const unsigned int m = FFT_MAX_SIZE >> 1;
                            
                            	for (c = j = 0; c < m; c++)
                            	{
                            		fftIndexes[c] = j;
                            		j ^= m - m / ((c ^ (c + 1)) + 1);
                            	}
                            }
                            
                            
                            
                            
                            
                            void rfft(float* data, const unsigned int z)
                            {
                            	unsigned int w, w2, i, p, inc;
                            	float x, y, x1, y1, x2, y2, rx, ry, tmp;
                            	const float scal = 1.f / (float)z;
                            	float* data2, * dataover = data + z, * ptr1, * ptr2;
                            	complex_t* rotptr, * rotators = fftRoots;
                            	unsigned int* bitrev = fftIndexes;
                            
                            
                            
                            	for (i = 0, ptr1 = data, inc = FFT_MAX_SIZE / z, w = z >> 1; i < z; i += 2, bitrev += inc)
                            	{
                            		p = *bitrev;
                            		x = *(ptr1++);
                            		if (p > i) { tmp = *(ptr2 = data + p); *ptr2 = x; x = tmp; }
                            		p += w;
                            		y = *ptr1;
                            		if (p > i + 1) { tmp = *(ptr2 = data + p); *ptr2 = y; y = tmp; }
                            		*(ptr1--) = (x - y) * scal;
                            		*ptr1 = (x + y) * scal;
                            		ptr1 += 2;
                            	}
                            
                            
                            
                            	for (w = 2, w2 = 4, inc = FFT_MAX_SIZE >> 2; w < z; w <<= 1, w2 <<= 1, inc >>= 1)
                            	{
                            		for (data2 = data; data2 < dataover; data2 += w2) 
                            		{
                            			
                            
                            			x = data2[0];
                            			y = data2[w];
                            			data2[0] = x + y;
                            			x -= y;
                            			y = data2[w2 - 1];
                            			data2[w2 - 1] = x;
                            			data2[w - 1] *= 2.f;
                            			data2[w] = -(y + y);
                            
                            			if (w < 4) continue;
                            
                            	
                            
                            			ptr1 = data2 + (w >> 1) - 1;
                            			ptr2 = ptr1 + w;
                            			x = *(ptr1++);	y = *ptr1;
                            			x1 = *(ptr2++);	y1 = *ptr2;
                            			tmp = (x1 + y1) * 0.7071067812f;
                            			y1 = (y1 - x1) * 0.7071067812f;
                            			x1 = tmp;
                            			*(ptr1--) = y + y1;
                            			*ptr1 = x + x1;
                            			*(ptr2--) = y1 - y;
                            			*ptr2 = x - x1;
                            
                            			if (w < 8) continue;
                            
                            		
                            
                            			for (ptr1 = data2 + 1, ptr2 = data2 + w - 3, rotptr = rotators + inc; ptr1 < ptr2; rotptr += inc)
                            			{
                            				rx = rotptr->re; ry = rotptr->im;
                            				x = *ptr1; y = *(ptr1 + 1);
                            				x1 = *(ptr1 + w); y1 = *(ptr1 + w + 1);
                            				x2 = *(ptr2 + w); y2 = *(ptr2 + w + 1);
                            				tmp = rx * x1 - ry * y1; y1 = rx * y1 + ry * x1; x1 = tmp;
                            				*ptr1 = x + x1;	*(ptr1 + 1) = y + y1;
                            				*(ptr2 + w) = x - x1; *(ptr2 + w + 1) = y1 - y;
                            				x = *ptr2; y = *(ptr2 + 1);
                            				tmp = rx * y2 - ry * x2; y2 = -rx * x2 - ry * y2; x2 = tmp;
                            				*ptr2 = x + x2;	*(ptr2 + 1) = y + y2;
                            				*(ptr1 + w) = x - x2; *(ptr1 + w + 1) = y2 - y;
                            				ptr1 += 2; ptr2 -= 2;
                            			}
                            		}
                            	}
                            }
                            
                            
                            
                            
                            
                            void rifft(float* data, const unsigned int z)
                            {
                            	unsigned int w, w2, i, p, inc;
                            	float x, y, x1, y1, x2, y2, rx, ry;
                            	float* data2, * dataover = data + z, * ptr1, * ptr2;
                            	complex_t* rotptr, * rotators = fftRoots;
                            	unsigned int* bitrev = fftIndexes;
                            
                            	data[0] += data[0];
                            	data[z - 1] += data[z - 1];
                            
                            
                            
                            	for (w = z >> 1, w2 = z, inc = FFT_MAX_SIZE / z; w > 1; w >>= 1, w2 >>= 1, inc <<= 1)
                            	{
                            		for (data2 = data; data2 < dataover; data2 += w2) /
                            		{
                            		
                            
                            			x = data2[0];
                            			y = data2[w2 - 1];
                            			data2[0] = x + y;
                            			data2[w - 1] += data2[w - 1];
                            			x -= y;
                            			y = data2[w];
                            			data2[w] = x;
                            			data2[w2 - 1] = -(y + y);
                            
                            
                            			if (w < 4) continue;
                            
                            	
                            			ptr1 = data2 + (w >> 1);
                            			ptr2 = ptr1 + w;
                            			y = *(ptr1--);
                            			x = *ptr1;
                            			y1 = *(ptr2--);
                            			x1 = *ptr2;
                            			*(ptr1++) = x + x1;
                            			*ptr1 = y - y1;
                            			*(ptr2++) = 0.7071067812f * (x - y - x1 - y1);
                            			*ptr2 = 0.7071067812f * (x + y + y1 - x1);
                            
                            			if (w < 8) continue;
                            
                            
                            			for (ptr1 = data2 + 1, ptr2 = data2 + w - 3, rotptr = rotators + inc; ptr1 < ptr2; rotptr += inc)
                            			{
                            				rx = rotptr->re; ry = rotptr->im;
                            				x = *ptr1; y = *(ptr1 + 1);
                            				x1 = *(ptr2 + w); y1 = *(ptr2 + w + 1);
                            				*ptr1 = x + x1; *(ptr1 + 1) = y - y1;
                            				x -= x1; y += y1;
                            				x1 = *(ptr1 + w); y1 = *(ptr1 + w + 1);
                            				*(ptr1 + w) = rx * x + ry * y;
                            				*(ptr1 + w + 1) = rx * y - ry * x;
                            				x = *ptr2; y = *(ptr2 + 1);
                            				*ptr2 = x + x1; *(ptr2 + 1) = y - y1;
                            				y += y1; x -= x1;
                            				*(ptr2 + w) = -rx * y - ry * x;
                            				*(ptr2 + w + 1) = rx * x - ry * y;
                            				ptr1 += 2; ptr2 -= 2;
                            			}
                            		}
                            
                            	}
                            
                            
                            	for (i = 0, ptr1 = data + 1, inc = FFT_MAX_SIZE / z, w = z >> 1; i < z; i += 2, bitrev += inc)
                            	{
                            		p = *bitrev;
                            		y = *(ptr1--) * .5f;
                            		x = *ptr1 * .5f;
                            		x1 = *ptr1 = x + y;
                            		if (p < i) { *ptr1 = *(ptr2 = data + p); *ptr2 = x1; }
                            		p += w;
                            		ptr1++;
                            		x1 = *ptr1 = x - y;
                            		if (p < i + 1) { *ptr1 = *(ptr2 = data + p); *ptr2 = x1; }
                            		ptr1 += 2;
                            	}
                            
                            }
                            

                            How can I use this type of code and call it from HISE?

                            Tania Ghosh

                            ustkU 1 Reply Last reply Reply Quote 0
                            • FortuneF
                              Fortune @A Former User
                              last edited by

                              @iamlamprey said in How to Emulate Hardware or Software Instruments/FX in HISE:

                              @Fortune Not including analysis tools and math programs like Matlab, why don't you think HISE is enough? IIRC the JIT stuff lets you work directly on the audio buffer with C++ (or something close enough to it).

                              For analysis tools, of course these are a must to have, I didn't even need to mention this :)

                              Hise is sooo good and sweet. But I am just saying that, analog models can't be done with ONLY Hise. Hise is just a one tool to must have. There are other things to do like C++, maths...etc that I mentioned for analog modeling :)

                              1 Reply Last reply Reply Quote 1
                              • FortuneF
                                Fortune @Tania Ghosh
                                last edited by

                                @Tania-Ghosh said in How to Emulate Hardware or Software Instruments/FX in HISE:

                                @iamlamprey @Lindon @Fortune ... I have one question.... For more customization do I need to write own C++ DSP code? if so, then how to integrate my custom DSP Modules with HISE? HISE works with Java script... I can do basic stuffs with JUCE or WDL but it is very daunting to work entirely with JUCE/WDL/RackAFX and make a complete plugins with JUCE only(without HISE).. I love HISE so much because of it's API and JAVASCRIPT....What steps do I need to follow to overcome this type of DSP C++ integrated approach?.. I have seen @orange has made some emulation stuffs with HISE using C++.

                                Very simple, just learn and test :) There are lots of sources for learning this oceanic knowledge on the internet.

                                https://www.musicdsp.org/en/latest/ is one of them to make a good start.

                                1 Reply Last reply Reply Quote 1
                                • ustkU
                                  ustk @Tania Ghosh
                                  last edited by

                                  @Tania-Ghosh you already have the best documentation -> Hise source code

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

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

                                    I have a new project that I'll be using the Black Box approach with. Maybe I can detail the process using only HISE.

                                    Dan Korneff - Producer / Mixer / Audio Nerd

                                    Tania GhoshT 1 Reply Last reply Reply Quote 3
                                    • Tania GhoshT
                                      Tania Ghosh @Dan Korneff
                                      last edited by Tania Ghosh

                                      @dustbro Yeeeeeeaa πŸ˜ƒ ........ that will be so much helpful to me.... great... (y)

                                      Tania Ghosh

                                      1 Reply Last reply Reply Quote 0
                                      • S
                                        Sawer
                                        last edited by Sawer

                                        @ustk sooo true. I’m learning C++ lately and what I usually do is to analyse the structure of Hise! There’s a lot to learn! The more I learn, the more I appreciate @Christoph-Hart and all you guys who are creating all this stuff!! Hope to become good like you guys in future!!!! πŸ˜ƒ

                                        ustkU orangeO 2 Replies Last reply Reply Quote 0
                                        • ustkU
                                          ustk @Sawer
                                          last edited by

                                          @nesta99 That's my goal for the next ten years, acquire knowledge for approximately 10% of Christoph πŸ˜‚
                                          Seriously, I'm learning C++ too and since I am constantly learning different things for a very long time, I know learning C++ and DSP will take me years honestly, probably 5 just to understand "enough to be autonomous and be ready to begin" I'd say πŸ™„

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

                                          1 Reply Last reply Reply Quote 4
                                          • ?
                                            A Former User
                                            last edited by

                                            The hardest part for me is understanding how the code modifies the sound, like I get putting a buffer through a sin algo saturates it. But how does one even begin to approach stuff like FFT and time-stretching? πŸ˜•

                                            It's especially difficult when almost all of the papers on the topic only explain things using actual math algorithms and not code snippets. They also never release source files.

                                            By the way, for anyone that doesn't already know, airwindows has all of his source code on his github for people to take a peek at, although his stuff generally only applies to the frequency-domain (EQs/Compressors/Saturators) and isn't that useful for anyone wanting to learn how to make, say, an autotune plugin.

                                            Link Preview Image
                                            airwindows/plugins at master Β· airwindows/airwindows

                                            This contains all the Airwindows audio open source code - airwindows/plugins at master Β· airwindows/airwindows

                                            favicon

                                            GitHub (github.com)

                                            I'd say blackbox is the best approach for HISE in its current state, when SNEX Workbench is ready, and (hoping) we get some sort of pitch/time-stretching tools, it's going to be absolutely insane.

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

                                            26

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.6k

                                            Posts