HISE Logo Forum
    • Categories
    • Register
    • Login

    Change panorama position of a noteOn Message

    Scheduled Pinned Locked Moved Feature Requests
    25 Posts 5 Posters 1.5k 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.
    • FrankbeatF
      Frankbeat @Christoph Hart
      last edited by

      @Christoph-Hart said in Change panorama position of a noteOn Message:

      Changing the sample properties like this might lead to a few edge case issues (eg. if you load a sample map in a preset and then change the pan it might cause order-of-initialization issues), also it's a very heavyweight operation so you can't automate it.

      The stereo FX with scripted voice start modulator solution looks like this:

      HiseSnippet 1431.3oc2X0saSbDEd1jLoXCkBnnpJ0aFg5ENTvX2BoUBghyeFYAArxF9oWglr6wwixtyrc1wgXPU8l97zWgxiPeDZeC3Mn8Lyt1dcvJXaU.Q8EIdNybly2424bbasJ.RSUZhWo86m.DuKP86KMc2pKWHIs1l3cQ5t7TCnYYj1reBOMEBIddKdOKAuRKQbedy5axi3x.XDIB4IJQ.7.QrvLhZ6F2WDE0jGB6KhKb5a0nUfRtkJR0CwyhzZjDdvQ7CgGxsGaAJwa4cBEFk12vMPJdlMUg886pdgL67OQjJNHBrKpS7wKJiLYqthnv1Cz0TBwi1djluXlluBcWQnXH8QVfK41fMhih1.uENKHUeFfjWAHsTFjtL0OPKRLi1whmySaIQGRGNZpKBkryR7dMcKEd.ooZL+HnoFWLjgJqUq10Y3eV8Nc5ICLBkjojOTYfGIqrZ4WUtT4eoL6za0oyD2yJFsJJBzSbaq2UeVLVQ1K9.Pec1w7ndvvChp+31zkmNaZPlVW3fJYKov7nDHecSUTn0VY+9a6AH4lMquHGg3QMNOwEy8D9QhPPSD3k7Yz6KUGTm3.ewXdxiasM2vGbM3MhRIAzFgUY71FNFyIxbvknaCoGYTItyFmnjV46c92oPOYj.EM5ObwqOrQpou0zrr6fjXQXXDzVkJrl9QL8Wq2QDEmZvquULlhQ7tB8wo.KD5v6EYXoGg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7.s54AYwE15smyQAiPjteAnRzcsqYCm4lRqUsl0MHddPf8IzaTmPlLOe2bvy2OG7bq4fmaOG7r1bvyOLG77imIO1gG1nmQEm8TLRn8Nt7ROucjbrjf6cNx+xakGYp
      

      relevant code (you might need to scale the range according to what you want):

      function onVoiceStart(voiceIndex)
      {
      	// Fetch the note position (the Message class will hold a reference to 
      	// the note on that started the voice) and scale it to -1 ... 1
      	local normPos = (Message.getNoteNumber() - 64.0) / 64.0;
      	
      	// Apply the spread
      	normPos *= SpreadKnob.getValue();
      	
      	// the function needs to return a modulation value between 0 and 1
      	// that will be applied as constant to the stereo position of the voice.
      	return (normPos + 1.0) * 0.5;
      }
      

      With this solution, does the knob have to be added inside the Script Modulator? So I have to add the same knob to each of my Samplers?

      Using HISE from the develop branch (Feb '23)

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @Frankbeat
        last edited by

        Yes and it might make sense to connect it to an external script if you have more than two samplers to keep the redundancy low.

        ulrikU 1 Reply Last reply Reply Quote 1
        • ulrikU
          ulrik @Christoph Hart
          last edited by

          @Christoph-Hart this seems to be a better way, and cleaner!

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

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

            @Christoph-Hart And using this way, would it be possible to set up a mixer for just one sampler, gain and pan for each note?

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

            1 Reply Last reply Reply Quote 0
            • FrankbeatF
              Frankbeat
              last edited by

              Wow, this works like a charm! Thank you very much!
              This way, it is even easier to set the right spread amount across the mapping range. I helped myself a little by printing it to console, since you wrote it has to return values between 0 and 1.

              function onVoiceStart(voiceIndex)
              {
              	local normPos = (Message.getNoteNumber() - 45) / 45;
              	normPos *= spreadKnob.getValue();
              	local newNormPos=(normPos) * 3.21;
              	// dev state only: Console.print(newNormPos);
              	return newNormPos;
              }
              

              The noteNumber 45 is my lowest mapped key here, but I don't know how I came to end up with this modified formula omitting the +1. But not to complain – it works. 😀

              Using HISE from the develop branch (Feb '23)

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

              37

              Online

              1.8k

              Users

              12.1k

              Topics

              105.6k

              Posts