How to Emulate Hardware or Software Instruments/FX in HISE



  • Is it possible to emulate an entire instrument/FX in HISE? For e.g Roland JUNO 60 or TAL-U-No-LX "Chorus" effect is very impressive... How to emulate such thing? Any help?



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

    Is it possible to emulate an entire instrument/FX in HISE? For e.g Roland JUNO 60 or TAL-U-No-LX "Chorus" effect is very impressive... How to emulate such thing? Any help?

    https://www.kvraudio.com/forum/viewforum.php?f=33



  • Short answer: Yes
    Long answer: Yeeeessss...

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





  • @Lindon OK...T U πŸ™‚



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



  • 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

    https://forum.hise.audio/topic/1322/about-rule-tec

    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 πŸ˜‰



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

    https://forum.hise.audio/topic/1322/about-rule-tec

    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.



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


Log in to reply
 

13
Online

1.1k
Users

3.8k
Topics

33.4k
Posts