HISE Logo Forum
    • Categories
    • Register
    • Login

    Dynamically loading samples (Sampler, AudioLoopPlayer)

    Scheduled Pinned Locked Moved Scripting
    8 Posts 3 Posters 615 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.
    • oskarshO
      oskarsh
      last edited by oskarsh

      Hey there!

      I'm trying to load some small generated samples over the network into different players. I've already got them loaded into the AudioLoopPlayer, but I'd love to have even more options for players. I'm thinking the sampler could be perfect for this, but I'm not sure if I can load .wav files on the fly.

      So my questions are:

      • Is it possible to have multiple AudioLoopPlayers, with each one being played by a different note?
      • Can I dynamically load .wav files into the Sampler? I don't need fast disk streaming.
      • Will I need to create a sample map to load into the sampler dynamically?

      Thanks for any help you can give me!

      breathing HISE

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

        I think you might find this useful - https://github.com/christophhart/hise_tutorial/tree/master/CustomSampleImport

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

        oskarshO 1 Reply Last reply Reply Quote 3
        • oskarshO
          oskarsh @d.healey
          last edited by

          @d-healey,

          Thanks for sharing your knowledge! I've gone through the code snippets and while it seems complex, it definitely gets the job done. I did want to mention that when loading the sample from the file path using local s = [Sampler1.parseSampleFile(filePath)];, it gives you a JSON sample map.

          To create the correct mapping, I used s[0]['LoKey'] and s[0]['HiKey'] to alter the JSON sample map. You can also set other common sample map parameters here.
          Since I'm able to predict that I'll always have the exact same mapping, this method works perfectly for me!

          Thanks again for your help!

          breathing HISE

          trillbillyT 1 Reply Last reply Reply Quote 2
          • trillbillyT
            trillbilly @oskarsh
            last edited by

            @oskarsh This is good stuff. I've been trying to figure this out for a while. When your adding the s[0]['LoKey'] & s[0]['HiKey'] methods, how are you altering the custom JSON file? Are you replacing the local s = [Sampler1.parseSampleFile(filePath)] or adding to it?

            Your help and any snippets is greatly appreciated.

            oskarshO 1 Reply Last reply Reply Quote 0
            • oskarshO
              oskarsh @trillbilly
              last edited by

              @trillbilly

              local s = [Sampler1.parseSampleFile(file)]; will give you a array with a json called s.

              simply add to the json s[0]['LoKey'] and s[0]['HiKey'] like a normal json object. It then sets the json via Sampler1.loadSampleMapFromJSON(s);

              breathing HISE

              trillbillyT 1 Reply Last reply Reply Quote 0
              • trillbillyT
                trillbilly @oskarsh
                last edited by

                @oskarsh Im not sure how to edit the JSON file I guess. Ive added the s[0]['LoKey'] and s[0]['HiKey'] below local s = [Sampler1.parseSampleFile(file)]; within the SampleLoadSave.js script with no success. I assumed this was editing the .js which is the JSON file, yes?

                I'll keep plucking away. Any other info is appreciated. Thanks for getting back so quickly.

                oskarshO 1 Reply Last reply Reply Quote 0
                • oskarshO
                  oskarsh @trillbilly
                  last edited by

                  @trillbilly ah I see.

                  You will need to assign a value ...

                  Like s[0]['lowkey'] = 61;

                  I suggest you check out the basic programming section in the Hise docs.

                  breathing HISE

                  trillbillyT 1 Reply Last reply Reply Quote 0
                  • trillbillyT
                    trillbilly @oskarsh
                    last edited by

                    @oskarsh ahhh, I was changing the "0" for the key. My mistake. I will try this again when I'm back in the studio. I appreciate your help.

                    Yes, I do need to get through all the docs. Definitely not where I'd like to be.

                    Goals...

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

                    48

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    101.8k

                    Posts