HISE Logo Forum
    • Categories
    • Register
    • Login

    Block-Based Processing in Third Party Node

    Scheduled Pinned Locked Moved C++ Development
    10 Posts 2 Posters 589 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 A Former User

      Sorry for the dumb question, had a bit of brain fog the last few days

      template <typename T> void process(T& data)
      		{
      			static constexpr int NumChannels = getFixChannelAmount();
      			// Cast the dynamic channel data to a fixed channel amount
      			auto& fixData = data.template as<ProcessData<NumChannels>>();
      
      			// Create a FrameProcessor object
      			auto fd = fixData.toFrameData();
      
      			while (fd.next())
      			{
      				// Forward to frame processing
      				processFrame(fd.toSpan());
      			}
      
      		}
      

      Where in here do we process full buffers of audio? I know we can do single sample processing but I'm not sure how to do block-based processing

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @A Former User
        last edited by

        // ch is a pointer to the begin of each channel
        for(auto ch: data)
        {
        	// This gets you the array to the channel signal
        	dyn<float> channel = data.toChannelData(ch);
        
        	// access any sample
        	channel[2] = 0.0f;
        
        	// perform math operation on the entire
        	// data (using SIMD where possible)
        	channel *= 2.0f;
        
        	// iterate over the sample
        	for(auto& sample: channel)
        		sample *= 0.5;
        }
        
        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @Christoph Hart
          last edited by

          @Christoph-Hart thank you, I'll give it a shot.

          sidenote I almost have RTNeural working in HISE, if I can get this bit up and running I'll make a post in case anyone else wants to try out the ol neural synthesis :)

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

            Hmm okay block-based & single sample processing achieve the same result, is there a method to push samples to a dyn array in a FIFO manner? Would that even be stable in the audio thread?

            1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @A Former User
              last edited by

              Nice. If you need to pass in the channel pointers to an external function from a library, there is also

              void someExternalStuff(float** ptrs, int numSamples, int numChannels)
              {
              
              }
              
              
              float** ptrs = data.getRawDataPointers();
              int numSamples = data.getNumSamples();
              int numChannels = data.getNumChannels();
              
              ? 1 Reply Last reply Reply Quote 0
              • ?
                A Former User
                last edited by

                Sweet. RTNeural also supports SIMD, I assume that would play nicely with HISE?

                Have you come across any compatibility issues with SIMD?

                Christoph HartC 1 Reply Last reply Reply Quote 1
                • Christoph HartC
                  Christoph Hart @A Former User
                  last edited by

                  SIMD is just a way of calculating numbers and HISE (or any other host application) doesnt‘t care how a library produces its output.

                  Usually you just get the pointers and sample amount and pass that to the processing function of your library.

                  1 Reply Last reply Reply Quote 1
                  • ?
                    A Former User @Christoph Hart
                    last edited by

                    @Christoph-Hart said in Block-Based Processing in Third Party Node:

                    dyn<float> channel = data.toChannelData(ch);
                    float** ptrs = data.getRawDataPointers();
                    

                    Is there a way to cast or have these return as doubles?

                    Christoph HartC 1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart @A Former User
                      last edited by

                      No.

                      Can you set the library to use float numbers as signal? Usually every library allows to define the floating point type used for its signal (eg. Faust is using FAUST_FLOT which you can define to either float (reasonable) or double ("yeah, 64bit signal precision for the ultimate transparent sound").

                      If you need to feed it double numbers then it will become very annoying because you can't just cast the pointers to double pointers because the original source are still float numbers and you would have to introduce a working buffer that uses double numbers, copy the float numbers over, process the working buffer with your library and reverse all those steps to copy it back to the signal buffer.

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

                        Yeah RTNeural supports floats. I think the issue is with the type of Model I'm using -> I can get a guitar amp black box model working just fine, but the whole "predict the future" version isn't playing very nice :)

                        I'll keep messing around

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

                        21

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.9k

                        Posts