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.
    • 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
                        • d.healeyD
                          d.healey @A Former User
                          last edited by

                          @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 :)

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

                          ? 1 Reply Last reply Reply Quote 1
                          • orangeO
                            orange @Sawer
                            last edited by orange

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

                            develop Branch / XCode 13.1
                            macOS Monterey / M1 Max

                            Dan KorneffD S 2 Replies Last reply Reply Quote 1
                            • Dan KorneffD
                              Dan Korneff @orange
                              last edited by

                              @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

                              Dan Korneff - Producer / Mixer / Audio Nerd

                              1 Reply Last reply Reply Quote 1
                              • ?
                                A Former User @d.healey
                                last edited by

                                @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 ;)

                                1 Reply Last reply Reply Quote 1
                                • S
                                  Sawer @orange
                                  last edited by

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

                                  S ? 2 Replies Last reply Reply Quote 3
                                  • S
                                    Sawer @Sawer
                                    last edited by Sawer

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

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

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

                                      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.

                                      A web audio module like that would be insane for conversions. Right now I just have a demo version users can download that outputs noise every 25s, but a live A/B on the store page would just be on another level.

                                      S 1 Reply Last reply Reply Quote 0
                                      • S
                                        Sawer @A Former User
                                        last edited by

                                        @iamlamprey Yeah, I mean you can’t load the full plugin, but just some few and simple functionalities to give an idea of it , then if the user wants a lil bit more, then the user will buy it!

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

                                          Are there any Faust users here?

                                          https://faust.grame.fr/community/events/#faust-physical-modeling-workshop
                                          https://youtu.be/xQ8aNgMaR5k

                                          *Faust has been used for the physical modeling of musical instruments for many years now. Various tools have been developed recently to address the needs of various modeling techniques (e.g., finite difference scheme, waveguides, mass interaction, etc.).

                                          The goal of this one day workshop was to provide a series of interactive one-hour tutorials on these tools as well as some background on their related modeling techniques.

                                          It took place online on Feb. 1, 2021, 3-9pm GMT+1. Additional information about this event can be found here.

                                          Link Preview Image
                                          Events - Faust Programming Language

                                          favicon

                                          (faust.grame.fr)

                                          Dan Korneff - Producer / Mixer / Audio Nerd

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

                                          21

                                          Online

                                          1.7k

                                          Users

                                          11.8k

                                          Topics

                                          102.6k

                                          Posts