HISE Logo Forum
    • Categories
    • Register
    • Login

    Loop Player Root Note

    Scheduled Pinned Locked Moved Scripting
    24 Posts 5 Posters 1.2k 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.
    • P
      paper_lung @paper_lung
      last edited by

      Just to be clear to anyone that might be a solution to this:

      When importing a file into the audio loop player, the root note changes:

      Screenshot 2024-01-05 at 08.57.06.png

      This slider on my UI doesn't update:

      Screenshot 2024-01-05 at 08.58.41.png

      I'd like to either:

      1. Turn off pitch detection inside the loop player so root note is always set manually and doesn't change unless changed by the user.
      2. Have the UI slider update to the new value whenever a file is imported.

      Does anyone have any suggestions? Thanks!

      DanHD 1 Reply Last reply Reply Quote 0
      • DanHD
        DanH @paper_lung
        last edited by

        @paper_lung have you tried a broadcaster?

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        P 1 Reply Last reply Reply Quote 0
        • P
          paper_lung @DanH
          last edited by

          @DanH No, I've not used broadcasters yet as I'm quite new to this, do you know of any examples that demonstrates how that could work?

          P 1 Reply Last reply Reply Quote 0
          • P
            paper_lung @paper_lung
            last edited by paper_lung

            Would this be using something like 'attachtoComponentValue' within the sliders callback or a listener?

            P 1 Reply Last reply Reply Quote 0
            • P
              paper_lung @paper_lung
              last edited by

              @paper_lung Ok, my first stab at creating a broadcaster - my main question is if I should be using attachToComponentValue or something else?

              var audioLoopPlayer = Synth.getAudioSampleProcessor("AudioLoopPlayer1");
              
              // Create a broadcaster
              var bc = Engine.createBroadcaster({
                  "id": "Root Note",
                  "colour": -1,
                  "args": ["component", "value"]
              });
              
              // Attach the broadcaster to the RootNote parameter of the Audio Loop Player module
              bc.attachToComponentValue(audioLoopPlayer, "RootNote");
              
              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @paper_lung
                last edited by

                No you need to attach it to a module parameter - the component value is required when you want to listen to changes of your UI components on your interface (like an additional control callback).

                const var bc = Engine.createBroadcaster({
                	"id": "root watcher",
                	"args": ["processor", "parameter", "value"]
                });
                
                bc.attachToModuleParameter("Audio Loop Player1", "RootNote", "watch attribute");
                
                bc.addListener("", "update something", function(u1, u2, value)
                {
                	Console.print(value);
                });
                

                However I realized that once the root note is not 64, then it will not update the parameter anymore when you load a new file (I think it's some kind of protection so it doesn't override the parameter value when you load an existing preset).

                P 1 Reply Last reply Reply Quote 1
                • P
                  paper_lung @Christoph Hart
                  last edited by

                  @Christoph-Hart Thanks, I've got it all working on my end now. The value seems to always update for me, I'm not getting the issue you describe

                  P 1 Reply Last reply Reply Quote 0
                  • P
                    paper_lung @paper_lung
                    last edited by

                    Just coming back to this, does anyone know of a way to disable the RootNote changing when a sample is loaded? It looks like it automatically detects the file key/note and then changes it accordingly, but unsure. I can't find anything in the docs.

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      paper_lung @paper_lung
                      last edited by

                      Hmm perhaps using setContentCallback - anyone have any insights?

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

                        @paper_lung said in Loop Player Root Note:

                        Hmm perhaps using setContentCallback - anyone have any insights?

                        I played around with the loop player for a project a while ago and ran into annoying issues like this (and your one about not being able to set the loop range colours). I switched to using a sampler instead.

                        You might want to checkout this example project - 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

                        P 1 Reply Last reply Reply Quote 0
                        • P
                          paper_lung @d.healey
                          last edited by

                          @d-healey Thanks, yeah I've had a look at that project but the sample start mod doesn't work in the same way as it does for the looper, and it's quite crucial for this project. I'm also only shipping a few samples, so I can easily bundle the audio into the installer as well, whereas with the sampler they'd be a separate download.

                          If I can find a way to fix the root note change, the looper will be just fine for my project, although I'm not sure if it's doable. Do you know if setContentCallback works with the Looper/Audio Sample Processor?

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

                            @paper_lung I'm not sure what the solution is (if there is one). Try the callback and let us know.

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

                            P 1 Reply Last reply Reply Quote 0
                            • P
                              paper_lung @d.healey
                              last edited by

                              Don't think setContentCallback works, as far as I can tell anyway.

                              DanHD 1 Reply Last reply Reply Quote 0
                              • DanHD
                                DanH @paper_lung
                                last edited by DanH

                                @paper_lung why not have a dig in the source code? There's probably a couple of lines that could be commented out to prevent the root note auto-detect

                                Screenshot 2024-01-11 at 19.51.47.png

                                DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                https://dhplugins.com/ | https://dcbreaks.com/
                                London, UK

                                P 1 Reply Last reply Reply Quote 0
                                • P
                                  paper_lung @DanH
                                  last edited by

                                  @DanH yeah I did wonder that, but didn’t want to break anything plus I don’t know any c++ haha. Maybe @Christoph-Hart can offer some insight?

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

                                    @paper_lung said in Loop Player Root Note:

                                    plus I don’t know any c++

                                    Don't let that put you off. Looking around in the source code you can figure out what a lot of stuff is doing without fully understanding it. I do this all the time, sometimes I break stuff, so then I undo that and try something else.

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

                                    P 1 Reply Last reply Reply Quote 0
                                    • P
                                      paper_lung @d.healey
                                      last edited by

                                      @d-healey ok will do. Do I need to recompile Hise if I try commenting out some of the code / Anything I should be aware of?

                                      DanHD d.healeyD 2 Replies Last reply Reply Quote 0
                                      • DanHD
                                        DanH @paper_lung
                                        last edited by

                                        @paper_lung yes you do. I tend to compress the hise folder before tinkering so I have a backup.

                                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                        https://dhplugins.com/ | https://dcbreaks.com/
                                        London, UK

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

                                          @paper_lung Yes compile debug versions because it's much quicker. Learn to use git as well, it will make life easier for you when switching between versions or reverting changes that you've made.

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

                                          P 1 Reply Last reply Reply Quote 0
                                          • P
                                            paper_lung @d.healey
                                            last edited by

                                            I managed to remove the root note pitch detection, thanks for the tips everyone. For anyone interested, I commented out the following code in the AudioLooper.cpp file within the source files:

                                            /*if (copy.getNumSamples() > 0)
                                            	{
                                            		auto freq = PitchDetection::detectPitch(copy, 0, copy.getNumSamples(), sr);
                                            		
                                            		if (freq == 0.0)
                                            			return;
                                            
                                            		Array<Range<double>> freqRanges;
                                            
                                            		freqRanges.add(Range<double>(0, MidiMessage::getMidiNoteInHertz(1) / 2));
                                            
                                            		for (int i = 1; i < 126; i++)
                                            		{
                                            			const double thisPitch = MidiMessage::getMidiNoteInHertz(i);
                                            			const double nextPitch = MidiMessage::getMidiNoteInHertz(i + 1);
                                            			const double prevPitch = MidiMessage::getMidiNoteInHertz(i - 1);
                                            
                                            			const double lowerLimit = thisPitch - (thisPitch - prevPitch) * 0.5;
                                            			const double upperLimit = thisPitch + (nextPitch - thisPitch) * 0.5;
                                            
                                            			freqRanges.add(Range<double>(lowerLimit, upperLimit));
                                            		}
                                            
                                            		for (int j = 0; j < freqRanges.size(); j++)
                                            		{
                                            			if (freqRanges[j].contains(freq))
                                            			{
                                            				setAttribute(AudioLooper::SpecialParameters::RootNote, (float)(j), sendNotification);
                                            				return;
                                            			}
                                            		}
                                            	} */
                                            

                                            I've not fully tested it yet, but hopefully proves useful to someone.

                                            T 1 Reply Last reply Reply Quote 3
                                            • First post
                                              Last post

                                            18

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.4k

                                            Posts