HISE Logo Forum
    • Categories
    • Register
    • Login

    How to Play an Audio Loop Player?

    Scheduled Pinned Locked Moved Solved Scripting
    28 Posts 5 Posters 674 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

      This post is deleted!
      ChazroxC 1 Reply Last reply Reply Quote 0
      • ChazroxC
        Chazrox @Chazrox
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • 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.ghVeilqgaZNtUupVUpeD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ti5YT1djRDD+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
                                            • First post
                                              Last post

                                            20

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            105.7k

                                            Posts