HISE Logo Forum
    • Categories
    • Register
    • Login

    How to Play an Audio Loop Player?

    Scheduled Pinned Locked Moved Solved Scripting
    28 Posts 5 Posters 672 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.
    • ChazroxC
      Chazrox @clevername27
      last edited by

      Screenshot 2025-03-06 at 6.12.38 PM.png

      1 Reply Last reply Reply Quote 1
      • rglidesR
        rglides @clevername27
        last edited by

        @clevername27

        //-------------- add this in the onNoteOn for the loop player
        function onNoteOn()
        {
                if (Message.getNoteNumber() != 81)
                Message.ignoreEvent(true);      
        }
        //-------------------and then just a classic Synth.playNote for the play button
        const var YourAwesomeLoopPlayer = Synth.getAudioSampleProcessor("YourAwesomeLoopPlayer");
        //--------------------------------------------------------------------------------------TEST SAMPLE 1
        const var YourAwesomeButton = Content.getComponent("YourAwesomeButton");
        inline function onYourAwesomeButtonControl(component, value)
        {
            if (value)
            Synth.playNote(81, 100);
        
        };
        Content.getComponent("YourAwesomeButton").setControlCallback(onYourAwesomeButtonControl);
        
        
        clevername27C 1 Reply Last reply Reply Quote 1
        • clevername27C
          clevername27 @rglides
          last edited by clevername27

          @rglides @Chazrox Thank you for your replies — do you know how I can send the note-on to the Audio Loop Player?

          rglidesR 1 Reply Last reply Reply Quote 0
          • rglidesR
            rglides @clevername27
            last edited by

            @clevername27 it depends on your set-up and goals but you can easily give every noisemaking module a similar onNoteOn as I wrote above, just give them each their own scriptProcesser. you can also assign playable ranges rather than just single notes, so Note 81 could trigger the audioloopplayer and the, for example SineWaveGenerator1 could have a playable range of 0-80 if you wanted. at least this how I have things set up, generally.

            Here's an example of adding a range

            function onNoteOn()
            {
               local note = Message.getNoteNumber();
                
                if (note < 0 || note > 80)
                    Message.ignoreEvent(true);
                    }
             
            
            clevername27C 1 Reply Last reply Reply Quote 1
            • clevername27C
              clevername27 @rglides
              last edited by

              @rglides Thank you - yes, I can add the that logic to Audio Player's Note-On function in its own Script Processor. I'm just confused as to how the note-on to the Audio Player (and not everything).

              rglidesR 1 Reply Last reply Reply Quote 0
              • rglidesR
                rglides @clevername27
                last edited by

                @clevername27 I'm confused by the question I think 😅 - in the first example I gave,YourAwesomeButton should trigger note 81, which should trigger the AudioLoopPlayer.

                When adding a sample to the AudioLoopPlayer, it doesn't populate a sampler so as long as you have a specific button and note assigned, it should work and shouldn't trigger on other note presses if you have the ignoreEvent

                rglidesR clevername27C 2 Replies Last reply Reply Quote 0
                • rglidesR
                  rglides @rglides
                  last edited by

                  @rglides

                  HiseSnippet 1312.3oc0W80aiTCD2aR1BIPOcG2gDOZp3gTopRBbbTQ0I5eRJJhl1ntkd7PkN4tqShU20dkWmzFN0OI7kgG4QDOyGBDeAfwd2jc21kdogVDrObWmwyL9mGO92LomT3RihDRjU0imDRQVuusyDtZ3tCILNpSKj0ir6RhTTINV0NSBIQQTOjkU4uQqvpZEj462+5cH9DtKMUEBchf4R2mEvToZ6s02x782i3QOlEjw5muUGWAeWguXDfmx1MPgD2yICnGPzlUxFYsTaOlRHcTDEMBrYGg2DmghK3w1eBKhclOUKzD4.AJVMZ2gLeudSOqQHjkcuzSd43S9yr6x7XyzmlAdrYAbpGYyAVktMH07N.IqLPpRLjdhsiqjEpRWQim2ytCGtP5SfTcVnDaKpzmVxdWAXAWsd.4b5dRPXlG0eQiFqgg+Y0MqUCR2QJ7XhDu8HOlXegHrmOYBU1D+RroNX8ATkApFo5qXrCqMDmX4JPfRiyNiTJAW69THnCfHHTvAg5qjrt1oZR5.b6wf5Ndf8M1rFi6y3Tb+QbWESvwBdh45XIE90cmFn0fMyeDc0ZuoVUVeb8DopfX0XbGBn6.ghVeilqgaZNtUupVUpeD0XFF9hsjCVcX+96LIAK0S9+XOtB.5a4nrdjVuAg6R78OCJZqecnCAKywRCrC40Mvu1U0vWeo98KbsjX4SkEtr90j71brNeTvYTY1jm1PnbKeM7RyWMrabZIigBdGNScXHMQdOgumt1T+22rhGkjWgZ+RIHDLUYp7eTRkebVDwffT0NIkhLvOKKCZl6KE69Gl3tob8Ujwz9BYfIJO1NmtBBlGQQPVMrc9pSc1tau8a6b5q19DrCIHzmhaIGEDc5Qc55bZqQQpI3iXAqeAYLRR3CnPFTBLc1V5.Yzzl6ok+we.T7ccZoiM7VM4jCYiPpTwzIcqVzw.WY7C+p1snQmqDglTSRIGx5clijykyNK+zfsljJH25BlmZnFL+FHOjxFLz.0eEjXQcEAvVPjfGVkP2bOuCYzKyRomh.zwoHnQorH3mgECmVXzwSSEeSdFnuwM3GAlYg2HehJOcstuTxBP8eNNRMOHOholjsu0cfCuwsxgOuP7I18XJ2gEiwREfQ8SjG.Llz4aY6186ScUo.rh8de+h1la929mNc6m08gF2gqv6++9IO9k4cxiv4dxCn0fKb8PyVlXtyNVBz6L9frakFls4D376kU8QBgRSmmcxmXVDCMAD9bVSGSkQ4ivdL+jgetyzQA5DTLOT.4xoTP9.RywQ4af9LJJqx4ulqLecBx+fKi8ELlSkGpIupLekj2dOo4eJrmlnMEcMKZZLq+vFWPm+kq8lkqgS9zSvzEBALpqdFCsMGX5TWeU7G+R7FMWM01o1wFvERpYTk5JIzMey30W9+fySXeeMOwsMCwB0c8+A8TxUQVcJFcX5m+s4io9vgzfwO.NU8Ii7US0ludrqfKBGJ3L27rNJIav.pLK1K7.ssRALeoZd1VGQ8ojnLzaexV6CyuSjWm37A82HU380GYGCWrtFF+O4d6dgU4dYtfxy0bA263cwmQ39AJGIFof9scIPgptOFvL5.soco.R3b32yo6cURyDDK2XZqMGJ2yH7mvWxhM0xVIK1b5h+qrGADWo30twLm5Z420nAN2bSG9p1c0x3B9EIAPSvW65lOT2vwOaQc7yWTGe9h53WrnN9hE0wubQcbi2ti5YT1djRDD+jEg51qsoUjk0roBsJi9K.LW5UFA
                  
                  rglidesR 1 Reply Last reply Reply Quote 0
                  • rglidesR
                    rglides @rglides
                    last edited by

                    @rglides

                    The confusion might be that usually it's good practice to use
                    Synth.getAudioSampleProcessor, but in this case it seems to only work with Synth.getChildSynth

                    clevername27C 2 Replies Last reply Reply Quote 0
                    • clevername27C
                      clevername27 @rglides
                      last edited by

                      @rglides Sorry if I'm not being clear, and I do appreciate you sticking with me on this. When I create a note-on, it's sent to every sound generator in the tree—so it triggers every sampler, every synth, etc. I just want to play the audio file.

                      rglidesR LindonL 2 Replies Last reply Reply Quote 0
                      • rglidesR
                        rglides @clevername27
                        last edited by

                        @clevername27 Sure, like I said it, the way I've gotten around this is to give each module an SP with a defined range

                        1 Reply Last reply Reply Quote 1
                        • clevername27C
                          clevername27 @rglides
                          last edited by clevername27

                          @rglides I'm trying to grapple with the idea that an advanced audio API cannot simply play an audio file. Every time I hit a problem with HISE, people tell me it's an edge case. Apparently, playing an audio file is also an edge case. 😂

                          rglidesR 1 Reply Last reply Reply Quote 0
                          • clevername27C
                            clevername27 @rglides
                            last edited by

                            @rglides Synth.getChildSynth got ya—that should work. Cheers. 🥂

                            1 Reply Last reply Reply Quote 1
                            • rglidesR
                              rglides @clevername27
                              last edited by

                              @clevername27 ikr! haha, although I've come to enjoy how tricky the simple things like a play button can get, learning a lot 😆

                              clevername27C 1 Reply Last reply Reply Quote 1
                              • clevername27C
                                clevername27 @rglides
                                last edited by clevername27

                                @rglides Not to prolong this 🥹, but do you please know the syntax here? I was thinking that getChildSynth would return a Synth object, but…maybe I'm missing something.

                                702fd0cc-dab7-4146-922d-d250fcb7ddf8-image.png

                                I thought this might do it, but it doesn't seem to…

                                8355d458-084d-4b10-ac23-ebc31f7571fc-image.png

                                rglidesR d.healeyD 2 Replies Last reply Reply Quote 0
                                • rglidesR
                                  rglides @clevername27
                                  last edited by

                                  @clevername27 you can call it whatever you like but you still need to write Synth.playNote rather than apSynth.playNote

                                  const var apSynth = Synth.getChildSynth("Audio Loop Player1");
                                  const var Button1 = Content.getComponent("Button1");
                                  
                                  reg EventId = 0;
                                  inline function onButton1Control(component, value)
                                  {
                                  	if (value)
                                  	{
                                  		Synth.playNote(81, 100);
                                  	}
                                  	else
                                  	{
                                  	    Synth.noteOffByEventId(EventId);
                                  	}
                                  };
                                  
                                  Content.getComponent("Button1").setControlCallback(onButton1Control);
                                  
                                  rglidesR 1 Reply Last reply Reply Quote 1
                                  • d.healeyD
                                    d.healey @clevername27
                                    last edited by

                                    @clevername27 All you need is Synth.playNote you don't need an object.

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

                                    1 Reply Last reply Reply Quote 1
                                    • rglidesR
                                      rglides @rglides
                                      last edited by

                                      @rglides I feel dumb, I added the EventId and yet not using it correctly. But still, this works for the player regardless

                                      1 Reply Last reply Reply Quote 0
                                      • LindonL
                                        Lindon @clevername27
                                        last edited by

                                        @clevername27 said in How to Play an Audio Loop Player?:

                                        @rglides Sorry if I'm not being clear, and I do appreciate you sticking with me on this. When I create a note-on, it's sent to every sound generator in the tree—so it triggers every sampler, every synth, etc. I just want to play the audio file.

                                        so what I do is set up a little script processor in each sampler/audio player that examines the midi channel of the note....then its simple logic to have one loop player allow Channel 16 (say), and the rest to ignore Channel 16 notes... then wherever I want to trigger the audio loop player _ I create a note and set its channel to 16....and only that player reacts to the note...

                                        HISE Development for hire.
                                        www.channelrobot.com

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

                                          @Lindon It doesn't need to be that elaborate. If the MIDI processor is within the loop player's MIDI Processor chain then it will only affect that loop player.

                                          Here is an example that has two buttons and two loop players.

                                          HiseSnippet 1346.3oc6WstSiaDEdLIl13dQc6xO5O8tpZUnhRhCWiPUMPHoaTA1TBca+GZh8DxTFOik8jraZ09Hzmo1Gg9lz9FzdFegXuDxFBPkVofDHOy4bly2Lmaez1WXSBBD9HMiyF4QPZerdmQbY+58wTNp0gHsB5XlmjDHQGLxCGDPbPZZ49NkXsB4Qg+7Oe6AXFlaSFuEB8RA0lbD0kJGua6ZeOkwZhcHmQcSo8l0ZYK30ELw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ZnzYe.RCII5upxWQZxiHWbvnFQhtREvGu48G9I52W7SlFmjHpH.p.Uuwg4wSZCwa59PyGgFsTDHx+t7YXGHCvUiR938f48YZFTHAicnpVtM3CIL3QJDieN7pzCOfIS1MaqfiEbgpmM0N6DAoO8hKH9ow9DuP6KkPg83cVo1oDFAGjJH9k0NBJvw9u8PsGz+AjIFu9B8H3ZpJfLuKws6kF52Kb1xMSb1t2w67ye69AJmJFHAtPGigDUUA7ICb6.TnrI.R3bBS0bSaIUann0kSXUzgvcBW7uvOwBsTq0hEZkHbd4KVYAew6DewJw7Eqby7E+CT9oxWTIeAew6.ewJK3Ktfu3B9hK3K5Qprfu3B9hK3KNC7E++vGtXaew41QMHU4xeX3Nv8lGx9pf9wp0lVWu0nKv+3ba6rG00Lrx7Z3FyqgaNuFt07Z31yqg6LuFt661PE8v8GHEtQkrHzwsaDNJSS6JF6Z4P+Gre0E3K
                                          

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

                                          clevername27C 1 Reply Last reply Reply Quote 1
                                          • clevername27C
                                            clevername27 @Lindon
                                            last edited by

                                            @Lindon Cheers, but…I'm using MIDI for playback…I don't see how I can my users,, "Works with any DAW, as long as you don't use MIDI channel 16." 🥲

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            31

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            105.4k

                                            Posts