HISE Logo Forum
    • Categories
    • Register
    • Login

    Multiple instruments, single project or multiple projects?

    Scheduled Pinned Locked Moved General Questions
    94 Posts 3 Posters 22.2k 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.
    • Christoph HartC
      Christoph Hart
      last edited by

      It works well for decaying samples (with ~60% size which is equal to FLAC but the decompression is way faster because the algorithm is much simpler).

      For sustain samples it's not that good though (80-90%) but maybe I can improve this.

      For general audio files it's horrible - when compressing a mastered music track you still end up with 99% file size.

      I'll devote a new blog entry to this once it's done where I'll explai how it works.

      1 Reply Last reply Reply Quote 2
      • Christoph HartC
        Christoph Hart
        last edited by

        I am using three compression algorithms, each with different decoding / compression ratios:

        • the "Block" algorithm is a simple bit depth compressor without any processing
        • the "Delta" algorithm detects a cycle in the waveform and stores delta values until the cycle is invalidated
        • the "Diff" algorithm uses 4x downsampling + bit depth reduction for the error signal (basically you take each 4th sample, draw a line between them and store the deviation of the second and third sample).

        I made some more tests & first decoding benchmarks:

        =====================================================
        FLAC ratio:	33.1% file size
        Block ratio:	74.2% file size
        Delta ratio:	66.8% file size
        Diff ratio:	57.3% file size
        =====================================================
        PCM speed:	11842.3x realtime
        FLAC speed:	1705.3 x realtime
        Block speed:	10086.3 x realtime
        Delta speed:	8175.8 x realtime
        Diff speed:     tba.
        

        The performance limit is uncompressed PCM decoding, which works at about 12000x realtime speed. While offering a far better compression ratio, FLAC's decompression speed is far behind the others (14% of PCM speed). The Block algorithm comes pretty close (and in a streaming context it might surpass the uncompressed PCM performance because it has to load fewer bytes from the disk). I didn't implement the Diff decompressor yet, but I expect it to yield something like 6000 - 7000x realtime speed, which will be the bang for the buck algorithm.

        Another speed advantage will come from using memory mapped files for this (the FLAC reader in JUCE doesn't support memory mapping).

        This format will also be used for the preload buffers so it'll drop the RAM usage significantly (currently the preload buffers are stored as 32bit floats!)

        1 Reply Last reply Reply Quote 2
        • d.healeyD
          d.healey
          last edited by d.healey

          This looks awesome! well done. The drop in RAM usage will be very welcome but what is the effect on CPU?

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

          1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart
            last edited by

            Well if you can decompress 8000 voices in realtime the CPU usage for each voice is 0,0125%

            1 Reply Last reply Reply Quote 1
            • d.healeyD
              d.healey
              last edited by

              Is the compression tool part of HISE or is it a separate app?

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

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                It will be of course embedded into HISE but I am using the seperate tool for testing & tuning the algorithms until it gets to a stable state.

                1 Reply Last reply Reply Quote 1
                • Christoph HartC
                  Christoph Hart
                  last edited by

                  Alright, the crashs should be fixed (it was the same reason that caused the REAPER crash so it's two for one :)

                  1 Reply Last reply Reply Quote 1
                  • d.healeyD
                    d.healey
                    last edited by

                    Brilliant, I'll give it a try later today

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

                    1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey
                      last edited by

                      Good news! The crash is fixed, not so good news, found a new bug :)

                      When using the last snippet I posted:

                      HiseSnippet 1184.3ocsV8+SabCE2GvM0KaTsNs+.73mBprzj1xV0XnUR.1xJDh5QQUpppy4NGN2dwNxmu.YH9mX+kt+C1d19tbWBWYDjVDBc980O989X6WeoHfljHjHmu7zoioHmux0eJWE0Ihv3nt6ibdn6wjDEUhshZOcLIIgFhbbV8W0Bb7VCY982+RaRLgGPKDgPmIXAziXiXpBo+wKeEKN9PRH8T1nRV+7W1MPv6HhEo.dV0sIZLI3Sjyo8HZyVwEMgQuHA4zz8YOsg7SsF7m603y9axYGz3iu3T8mnfTojxUmAtibbc9G3mi6AgLkP5qHJJDy0ZKBm5GItfaS8Yr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1FPAjvAFZhdRzUzrJ65l505JiOkG1LeL0LkszqcxT1JWIZDIPJ9PfkVpGv6AFI.l3lQl8fY2g03V4LQMtGASc9gf.cg36AjWsGOco83YKsGOeo8X6k1ieXo83GWZOdws3gdD+8RUhQ1iEHz+B3sqkq.
                      

                      If I load this from clipboard and then add a container to the Master container, and then try and add a sampler (or any other sub-module) to the new container it doesn't do anything. If I then delete the container and click the save button on my script I get an error that the container I deleted can't be found.

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

                      1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart
                        last edited by

                        Yes this is because scripts get recompiled if you add a sound generator, which interferes with the possibility of adding sound generators via scripting.

                        This is a rather annoying design flaw and I have to think about a clever solution (perhaps just removing the possibility to restore containers might be enough).

                        1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey
                          last edited by

                          Would that affect the contents of containers too?

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

                          1 Reply Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart
                            last edited by

                            If you restore a container, it will delete every sound generator in it and add the new ones which triggers a global script recompile (I am not 100% sure why it does that, but I think I added this for a good reason).

                            1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey
                              last edited by

                              Ah I see, well taking it out shouldn't really be an issue then because it's really the contents of the container that needs restoring, although I can think of a few edge cases ;)

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

                              1 Reply Last reply Reply Quote 0
                              • d.healeyD
                                d.healey
                                last edited by

                                I just noticed the "save current state as new user preset" option, when did this appear? Does it also save the state of samplers and sample maps?

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

                                1 Reply Last reply Reply Quote 0
                                • Christoph HartC
                                  Christoph Hart
                                  last edited by

                                  It simply stores every control on the main interface (so basically it's the same as using the preset browser to save a new preset). So you need a control that restores the samplers and sample maps

                                  1 Reply Last reply Reply Quote 1
                                  • d.healeyD
                                    d.healey
                                    last edited by

                                    Aha ok, same as before then :)

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

                                    1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey
                                      last edited by d.healey

                                      I'm working with the storeAllControlsAsPreset and restoreAllControlsFromPreset functions but I'm getting a crash as soon as I try to restore. Any ideas?

                                      /**
                                       * Title: Preset Hander v1.0.0.js
                                       * Author: David Healey
                                       * Date: 02/07/2017
                                       * Modified: 03/07/2017
                                       * License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html
                                      */
                                      
                                      //INIT
                                      const var save = Content.addButton("Save", 0, 0);
                                      const var load = Content.addButton("Load", 150, 0);
                                      
                                      //FUNCTIONS
                                      function savePreset()
                                      {
                                      	Content.storeAllControlsAsPreset("test");
                                      }
                                      
                                      function loadPreset()
                                      {
                                      	Content.restoreAllControlsFromPreset("test");
                                      }
                                      
                                      //CALLBACKS
                                      function onNoteOn()
                                      {
                                      }
                                      
                                      function onNoteOff()
                                      {
                                      }
                                      
                                      function onController()
                                      {
                                      }
                                      
                                      function onTimer()
                                      {
                                      }
                                      
                                      function onControl(number, value)
                                      {
                                      	switch(number)
                                      	{
                                      		case save:
                                      			number.setValue(0);
                                      			savePreset();
                                      		break;
                                      
                                      		case load:
                                      			number.setValue(0);
                                      			loadPreset();
                                      		break;
                                      	}
                                      }
                                      

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

                                      1 Reply Last reply Reply Quote 0
                                      • Christoph HartC
                                        Christoph Hart
                                        last edited by

                                        You are storing the widget that calls the restore function in the preset. This causes an endless loop because it will load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback :)
                                        This can be solved by setting saveInPreset to false for both buttons. (I thought about adding a safety measure that prevents this loop, but there was no easy solution and this is the kind of error that you'll only do once.

                                        Also you need to give it a file extension (the HISE default extension for user presets is .preset) - and the number widget is not defined, which causes a script error.

                                        1 Reply Last reply Reply Quote 0
                                        • d.healeyD
                                          d.healey
                                          last edited by

                                          Thanks Christoph, that makes total sense - you are right, I will not make that mistake twice :p

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

                                          1 Reply Last reply Reply Quote 1
                                          • d.healeyD
                                            d.healey
                                            last edited by

                                            After I saved a user preset with Content.storeAllControlsAsPreset("Bank 1/Category 1/test.preset"); I then click to load it from the preset browser and I get the prompt "This User Preset Was Built With a Previous Version. Do you want to update it?" - am I missing a setting somewhere?

                                            Also is there a way to get the ID of the current script (self)? I want to save the state of all scripts but I can't reference the script I'm in, my current solution is to ignore midi processors with a particular ID but I have to hard code that ID to be the same as the MIDI processor and I would like it to be more generic if it could just know its own ID.

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

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

                                            43

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.1k

                                            Posts