How to Emulate Hardware or Software Instruments/FX in HISE



  • 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.



  • @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).



  • @iamlamprey Yes...... ๐Ÿ‘



  • @Fortune Yup.. ๐Ÿ™‚ sure.



  • @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++.



  • #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?



  • @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 ๐Ÿ™‚



  • @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.



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



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



  • @dustbro Yeeeeeeaa ๐Ÿ˜ƒ ........ that will be so much helpful to me.... great... ๐Ÿ‘



  • @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!!!! ๐Ÿ˜ƒ



  • @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 ๐Ÿ™„



  • 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.

    https://github.com/airwindows/airwindows/tree/master/plugins

    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.



  • @iamlamprey There are a number of free FFT and time stretching libraries, Rubberband and KISSFFT spring to mind, go and look at their source code ๐Ÿ™‚



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

    @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!!!! ๐Ÿ˜ƒ

    @Christoph-Hart is the real genius and he has built this revolution that makes everything possible.
    Hise is very strong tool and it is capable of almost everything.... Also with forthcoming SNEX updates, it will be maybe the most powerful audio plugin development tool in the world.....



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

    it will be maybe the most powerful audio plugin development tool in the world.....

    agreed



  • @d-healey I actually checked the Rubberband one the other night when I was super sleep-deprived - heiroglyphs. Maybe I'll take another crack when my brain works again ๐Ÿ˜‰



  • @orange Yess absolutely!! Iโ€™ve just saw your Fx plugin on YouTube and I was like...wooow all of this in Hise?!! Youโ€™re great in doing all these things! Concerning Hise, I think that in some few years this IDE will absolutely surpass JUCE. Itโ€™s way more intuitive (I started in November last year) and it helps you being more โ€œcreative โ€œ in terms of creating your plugin.. because majority of the task, Hise is already doing it for you (Exporting, previewing ecc).
    Tho there very little tutorials on this and can be a little bit frustrating. But if youโ€™re determined by trial and error you can figure it out! Thanks also to @d-healey for your efforts on giving tutorials, it helps a lot!
    What I think is that Hise would be perfect if it has an Web Audio Module, whereby you can create your plugin and make sure people can have a try on your website to have a feel.
    But yeah , after all this.. Hise is the future!



  • @Christoph-Hart And lastly, maybe some UX api animations like in web design, when you click in a button something shakes, or a very smooth transition happens. Just like in web design or In swift UI animations
    A good and smooth GUI/UX Animations + Real quality sound or FX is the perfect match!!


Log in to reply
 

18
Online

1.2k
Users

3.8k
Topics

33.4k
Posts