HISE Logo Forum
    • Categories
    • Register
    • Login

    Issue with simply playing a file, and question about introspection

    Scheduled Pinned Locked Moved Scripting
    8 Posts 4 Posters 309 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.
    • T
      thrice801
      last edited by

      Hi. New to hise, and I having trouble with this:

      local player =    Synth.getAudioSampleProcessor("Audio Loop Player1");
      
      Console.print(player.getFilename());
      Console.print(player);
      player.loadFile(path);
      

      it's saying player.loadFile function not found. Any idea what I am doing wrong? according to https://docs.hise.dev/scripting/scripting-api/synth/index.html#getaudiosampleprocessor it looks correct to me, but seems to not be returning the correct object type.

      Also is there a way to introspect objects on the console, to inspect things like the class name, functions on the object, etc, similar to ruby or other languages? I keep running into issues like this, where the thing I am dealing with isn't the correct thing, and that would be nice for debugging, rather than just seeing Object 0x in the console.

      d.healeyD hujackusH ulrikU 3 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @thrice801
        last edited by

        @thrice801 What is path?

        @thrice801 said in Issue with simply playing a file, and question about introspection:

        Also is there a way to introspect objects on the console

        Console.print(trace(myObj));

        You might get more info using the variable watch table.

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

        T 2 Replies Last reply Reply Quote 0
        • T
          thrice801 @d.healey
          last edited by

          @d-healey path is a string pointing at a wav file. will it throw function not found if the wrong type is passed into the function?

          1 Reply Last reply Reply Quote 0
          • hujackusH
            hujackus @thrice801
            last edited by

            @thrice801 said in Issue with simply playing a file, and question about introspection:

            it's saying player.loadFile function not found.

            Why is player local? Is this code within a callback or a helper function? My first thought was that it wasn't finding the AudioSampleProcessor at runtime, but that usually throws a different error like "Audio Loop Player1 was not found."

            But I think the main issue is that loadFile() is not a function of AudioSampleProcessor, it is a function of AudioFile. You might want to try AudioSampleProcessor.setFile()

            Check out the music of Conway's Game of Life - https://www.youtube.com/@hujackus
            ConwayMatrix - http://hujackus.altervista.org/conwaymatrix/

            1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @thrice801
              last edited by ulrik

              @thrice801 said in Issue with simply playing a file, and question about introspection:

              Hi. New to hise, and I having trouble with this:

              local player =    Synth.getAudioSampleProcessor("Audio Loop Player1");
              
              Console.print(player.getFilename());
              Console.print(player);
              player.loadFile(path);
              

              it's saying player.loadFile function not found.

              It should be

              player.setFile(String fileName)
              

              and the

              player.getFilename()
              

              will get the path to the loaded file

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              1 Reply Last reply Reply Quote 0
              • T
                thrice801 @d.healey
                last edited by

                @d-healey when I tried the trace function, it broke off execution and opened xcode (not familiar with xcode debugging), I can't tell if that is the expected behavior from that, or if it was trying to log some data as json unsuccessfully, and it is blowing up, and xcode is catching the error (the line it breaks on is something about json serialization) - is that the expected behavior of trace, or is it supposed to be putting info in my console? - also the variable watch table gave me slightly more info which is helpful, could see arrays of strings and what not, but still don't see any class names or object types and what not.

                Thanks all I eventually got it figured out, and was able to get the file loaded in the AudioLoopPlayer. However I am now realizing, there is no play method on this thing. How do I actually go about triggering playback of the file, or what am I missing here?

                I'm basically just trying to trigger playback of the sample now, when the daw transport play button is clicked, except I have no daw here. So I'm wondering, how do I actually play it back, and also: is there a way to simulate daw transport playback/controls directly within hise (and or setting tempo and things)?

                d.healeyD T 2 Replies Last reply Reply Quote 0
                • d.healeyD
                  d.healey @thrice801
                  last edited by

                  @thrice801 said in Issue with simply playing a file, and question about introspection:

                  when I tried the trace function, it broke off execution and opened xcode

                  Where did you try it?

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

                  1 Reply Last reply Reply Quote 0
                  • T
                    thrice801 @thrice801
                    last edited by

                    @thrice801 said in Issue with simply playing a file, and question about introspection:

                    @d-healey when I tried the trace function, it broke off execution and opened xcode (not familiar with xcode debugging), I can't tell if that is the expected behavior from that, or if it was trying to log some data as json unsuccessfully, and it is blowing up, and xcode is catching the error (the line it breaks on is something about json serialization) - is that the expected behavior of trace, or is it supposed to be putting info in my console? - also the variable watch table gave me slightly more info which is helpful, could see arrays of strings and what not, but still don't see any class names or object types and what not.

                    Thanks all I eventually got it figured out, and was able to get the file loaded in the AudioLoopPlayer. However I am now realizing, there is no play method on this thing. How do I actually go about triggering playback of the file, or what am I missing here?

                    I'm basically just trying to trigger playback of the sample now, when the daw transport play button is clicked, except I have no daw here. So I'm wondering, how do I actually play it back, and also: is there a way to simulate daw transport playback/controls directly within hise (and or setting tempo and things)?

                    just running it in the code editor, just using Console.print(trace(myObj));

                    -- any idea on the triggering playback of AudioLoopPlayer also, programatically? is that not possible, do I need to use a sampler and attach midi for playback or something?

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

                    21

                    Online

                    1.7k

                    Users

                    11.8k

                    Topics

                    102.6k

                    Posts