HISE Logo Forum
    • Categories
    • Register
    • Login

    How to Load Audio File Using Scripting? (External Data)

    Scheduled Pinned Locked Moved Solved Scripting
    10 Posts 2 Posters 151 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.
    • griffinboyG
      griffinboy
      last edited by griffinboy

      894a0782-7453-4296-92ce-99bce290141b-image.png

      3b320aca-1ccb-4c0b-a9cf-f2885398f137-image.png

      This is causing a crash. I'm not sure why.
      I'm trying to figure out how to load an audio file into an external data slot using scripting.

      It works fine when done manually, or through the use of an audioWaveform UI component. But my scripting attempt has been less than successful.

      Is this an incorrect way to access the external data slot? Have I accidently grabbed something else instead?

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

        @griffinboy Probably need an audio sample reference rather than complex data

        acf362e6-a9ff-4a88-b8db-cfc93de9fd5b-image.png

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

        griffinboyG 1 Reply Last reply Reply Quote 0
        • griffinboyG
          griffinboy @d.healey
          last edited by griffinboy

          @d-healey

          mmm I'm really not experienced when it comes to Hise API.
          I'm fumbling around fairly aimlessly

          2a0d004a-3e7a-4607-b11e-fe07322b08e4-image.png

          I've been putting this off since I joined Hise.

          edit* is there a way to dump all the methods belonging to slot 0 here?

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

            @griffinboy said in How to Load Audio Using Scripting? (External Data):

            edit* is there a way to dump all the methods belonging to slot 0 here?

            If slot0 is actually an audio sample processor, then look up audio sample processor in the API browser to see all the methods. They should also show up in the auto-complete.

            5e69819c-d76b-461d-b55f-e090e79d1f17-image.png

            HiseSnippet 1452.3ocuWEzaaaCElxIJc1qcaEX8tZN4TDXXmjllfhg4Dm3UiMmZTkEzdpfVhJlvTjBhTIwasm1kdam6s8SXW2s9GXm1ej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NlbpX.COotLUN9Y.v2zYHS3M1k9Sj4aYiL35PsG08Fg4bBStLc1q8Q55MzyDIJPkrOFDKgFIaX+6BuLvizICcZNnhto1LtodrtXwkv8SG7OvOYS1ZFgAS1Z5jEzCNgntTDON8LJ6anG2bfHSI4WFbUKzALl3RsJ.MqzENXRsMPvlDMRvodZSFOlhzCBEIZICCbgGwbJlxz05tIRP4x+obW8k.5WNYsxYjXYZhukcyFvuPs+IBe8SY5h8.hcx.rZjtIRKFBUrj3FdypbKg0REOoOgpzz5rN8wVFhCPcXp1F7TKqUJHHZpa0iftxJlEpm7L8rdXF5LcIfd+jlSCEZfr106nQ5EBVRJeUZSbOa3JP3cFxFEcYdbWNE2DfqmBJ+uZpXegNnhifd9dbexUSS3wPssObQRZXYEK8o7rMpwm93qJMFM.GCnUucfbaOaDbRlGZtjVd34RwtJRjt8rjswjKMjVQqZhcMPpWQPykE3gJ3DlZN6naLjZ+qsuYPplMbikOAzcPyk8ECqh71Bg0Kd27LEzFWFV+1ae6eLOrd24+98ZqgEbENnBBhIezP0NsmCUu4utdjU6eI7OSIqaY+DZmDEZtzrPLA1Qe5qoticeXkopQwDr+xvV5dtCEhwg3Twzk5cV+uH8Gh8hEuzybalti8yRs.5G7TMmp180icZgt382sgv+c2K87Jmp4BbqkMvsW1.2YYC7gKaf6trA9nkMv89uCT+OeePhRDZtgFZKFbrQH25XNFd7Q5MKn+EvW2cZm
            

            To clear the loaded file you can use setFile(-1)

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

            griffinboyG 1 Reply Last reply Reply Quote 1
            • griffinboyG
              griffinboy @d.healey
              last edited by

              @d-healey

              I wonder if I need to compile to the latest version of Hise, because this doesn't work for me. The filename seems to update in the external data, but the audio files don't load properly. Neither in the snippet nor my actual project, the waveform display never updates and no sound is audible.

              73670a31-e3dd-4ece-bfd7-4806294fceef-image.png

              we get the filename sure enough, but there seems to be something the matter.

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

                @griffinboy said in How to Load Audio File Using Scripting? (External Data):

                Neither in the snippet nor my actual project, the waveform display never updates and no sound is audible

                Hmmm, I'm on the latest version so it's not that, let me check

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

                griffinboyG 2 Replies Last reply Reply Quote 0
                • griffinboyG
                  griffinboy @d.healey
                  last edited by

                  @d-healey

                  I appreciate the help, if it's working on your end but not mine, I'll have to just investigate and poke around.

                  1 Reply Last reply Reply Quote 0
                  • griffinboyG
                    griffinboy @d.healey
                    last edited by griffinboy

                    @d-healey

                    I mean, is this correct?

                    e37df357-33e4-4010-87b6-c5ea6851ec8d-image.png

                    We are using the file load function, but the actual info that ends up getting fed is just the file name, not any path.

                    edit* Ah then again, even loading files that are located inside of the project folder, we get the same result, so it's not that. I'm probably just ignorant of the workings

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

                      @griffinboy said in How to Load Audio File Using Scripting? (External Data):

                      but the actual info that ends up getting fed is just the file name, not any path.

                      Yes that was the problem.

                      Should have been ScriptFX1.setFile(file.toString(file.FullPath));

                      Of course if you're using it from the project's audio files folder then the path from loadAudioFilesIntoPool() will work too.

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

                      griffinboyG 1 Reply Last reply Reply Quote 1
                      • griffinboyG
                        griffinboy @d.healey
                        last edited by griffinboy

                        @d-healey

                        Worked!
                        Great, thanks David.

                        Answer:

                        const var ScriptnodeSynthesiser1 = Synth.getAudioSampleProcessor("Scriptnode Synthesiser1");
                        
                        inline function onButton1Control(component, value)
                        {
                        	if (!value)
                        		return;
                        		
                        	FileSystem.browse(FileSystem.getFolder(FileSystem.Downloads), false, "*.wav", function(file)
                        	{
                        		if (!isDefined(file) || !file.isFile())
                        			return;
                        			
                        		ScriptnodeSynthesiser1.setFile(file.toString(file.FullPath));
                        	});
                        };
                        
                        Content.getComponent("Button1").setControlCallback(onButton1Control);
                        
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • griffinboyG griffinboy marked this topic as a question on
                        • griffinboyG griffinboy has marked this topic as solved on
                        • First post
                          Last post

                        10

                        Online

                        1.7k

                        Users

                        11.9k

                        Topics

                        103.5k

                        Posts