HISE Logo Forum
    • Categories
    • Register
    • Login

    Get Root Note

    Scheduled Pinned Locked Moved General Questions
    42 Posts 6 Posters 1.6k 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.
    • d.healeyD
      d.healey @DanH
      last edited by

      @DanH I think it would be sensible if it used the loading callback that we already have.

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

      1 Reply Last reply Reply Quote 1
      • MikeBM
        MikeB
        last edited by MikeB

        It works like this in both directions now.

        1. when changing the sample, the RootNote of the sample is displayed.
        2. if I change the value of the knob, it is played with a new root note.

        Wonderful

        inline function onknb_RootControl(component, value)
        {	
        if(value)
        AudioLoopPlayer1.setAttribute(AudioLoopPlayer1.RootNote, value);
        };
        
        Content.getComponent("knb_Root").setControlCallback(onknb_RootControl);
        
        

        "One hour of trial and error can save 10 minutes of reading the manual."
        "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
        HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

          @MikeB You don't the if (value) part.

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

          1 Reply Last reply Reply Quote 1
          • MikeBM
            MikeB
            last edited by

            Next challenge in this topic!

            Is there already a snippet (or 2 lines of code) with the definition or the conversion of the note numbers into notes e.g. 60 = C3 or C4 as the case may be?

            So that the root note number is no longer displayed here (60) but the actual note C3.

            "One hour of trial and error can save 10 minutes of reading the manual."
            "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
            HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

              @MikeB

              Engine.getMidiNoteName(midinotenumber);
              

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

              MikeBM 1 Reply Last reply Reply Quote 2
              • MikeBM
                MikeB @ulrik
                last edited by

                @ulrik That's simple - isn't there something more complicated? 😆 😆 😆

                "One hour of trial and error can save 10 minutes of reading the manual."
                "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                  @MikeB said in Get Root Note:

                  isn't there something more complicated?

                  inline function midiNumberToName(n)
                  {
                  	local notes = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
                          return notes[n % 12] + Math.round((n / 12) - 2);
                  }
                  

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

                  MikeBM 1 Reply Last reply Reply Quote 3
                  • MikeBM
                    MikeB @d.healey
                    last edited by

                    @d-healey :beaming_face_with_smiling_eyes: :beaming_face_with_smiling_eyes: :beaming_face_with_smiling_eyes:

                    "One hour of trial and error can save 10 minutes of reading the manual."
                    "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                    HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

                    1 Reply Last reply Reply Quote 0
                    • NatanN
                      Natan
                      last edited by

                      @MikeBDo You Have A Snippet For Study On This Usage?

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

                        Actually I think my solution is better than HISE's :p This is the JUCE function that HISE is calling. Mine doesn't have as many options though.

                        String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includeOctaveNumber, int octaveNumForMiddleC)
                        {
                            static const char* const sharpNoteNames[] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
                            static const char* const flatNoteNames[]  = { "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B" };
                        
                            if (isPositiveAndBelow (note, 128))
                            {
                                String s (useSharps ? sharpNoteNames[note % 12]
                                                    : flatNoteNames [note % 12]);
                        
                                if (includeOctaveNumber)
                                    s << (note / 12 + (octaveNumForMiddleC - 5));
                        
                                return s;
                            }
                        
                            return {};
                        }
                        

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

                        ulrikU 1 Reply Last reply Reply Quote 0
                        • ulrikU
                          ulrik @d.healey
                          last edited by

                          @d-healey Haha...yes your's is shorter at least, but you don't get flatmates 🤔

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

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

                            @ulrik "aint got no use for no stinkin flats!"

                            HISE Development for hire.
                            www.channelrobot.com

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

                            12

                            Online

                            1.8k

                            Users

                            11.9k

                            Topics

                            104.0k

                            Posts