HISE Logo Forum
    • Categories
    • Register
    • Login

    How to set Filter Frequency per voice?

    Scheduled Pinned Locked Moved General Questions
    3 Posts 2 Posters 157 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.
    • dannytaurusD
      dannytaurus
      last edited by dannytaurus

      I'm trying to understand the polyphonic wizardry that goes on in HISE 😀

      I'm making a polyphonic synth. I need to add a HP filter, with a frequency of the played note. I'd like each voice (note of a chord) to have its own filter frequency, so the output of each voice has the correct filter frequency setting.

      I have multiple Waveform Generators in a Synthesiser Group, with a Filter in the SG FX chain.

      Does that achieve what I want? Or does that put all the voices through the same filter?

      I'm setting the filter freq like this:

      # init
      const var HPF = Synth.getEffect("HPF");
      
      function onNoteOn()
      {
      	const freq = Engine.getFrequencyForMidiNoteNumber(Message.getNoteNumber())
      	HPF.setAttribute(HPF.Frequency, freq);
      }
      

      EDIT: reading through some more posts here, it looks like maybe I should be setting the filter freq with a Script Voice Start Modulator on the Filter Frequency Modulation instead? Would that make it polyphonic automatically?

      Meat Beats: https://meatbeats.com
      Klippr Video: https://klippr.video

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

        The filter module is a bit special in this case because it renders monophonically until there is polyphonic modulation (either through an envelope or a voice start modulator) present in one of its modulation chains, then it switches to polyphonic rendering. This saves a lot of CPU in patches that don't require polyphonic filtering.

        That means that you're example won't work because it still renders the filters monophonically. The quickest way to achieve that is to script a voice start modulator that calculates the modulation value for each voice based on its note number:

        HiseSnippet 1083.3oc6X80aaTDDeuDukZCT0TUg.wCrOZiJAaml+oHDtIwtXQcpSboh2pVe2b1qx5cO1auzZg3c9XwGAj3K.eD3a.r6cW7cNwx1wk1RkvOXc6rybyucleyricWkzEBCkJjSomMN.PNeDt2Xgd3QCoLAp8wHm6f6PC0fhjH5vwAzvPvC43r9isBbJV.E+4u91CobpvExDgP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wea9jtYM6ZmzMqc4luU7wHpqR9B2jRQaiuaGKwbtEw+cCEwcrqI0Pwkm4uhXjo0xKbcm9UcMCqupFt0pZ3CWUC2dUMbmU0vcWUC2awFZ67+nHsbTRcBB0oay3teNNMETCiOtjA8OvmtVih
        

        Note that this sounds a bit out of tune and you have to fight against the weird modulation filter scaling that makes the default HISE filter so annoying to use.

        Another option is to just use scriptnode, it's literally two nodes and one modulation connection:

        HiseSnippet 1426.3oc6X0raaaDDdokWEamzfj1.zdqBHWRJBLjrSbbPOXYaIkJzHG0PGibycE4RqEhbWVxk1Von25gdquR9AHGBPdB5aP5SP6rKoDIsnskUbRPAJMfA24GNy2LyNyX2MPXQCCEAHik1cnOEYbCr4Ptr+18ILNpcCjwMwcHgRZPkXRaMzmDFRsQFFkdphfwhyizOueisHtDtEMkDBsmfYQeFyiISo1s9OxbcaQro6x7xH8Cq21Rv2V3Jh.+oDtJxmXMfb.cGhRr4vnefD1GY7c30VuW0G+Dm0cVgR60y5ID6pOhRsVizq2iqRpshsCcc6Gs5pHixMsYRQfojHogvGcKg8Py9hi3wFXOVHqmKUcnFxDrbLYz18Yt1cGEbBQHCb2zPUo3P0cvcX1rwzSCY2RynRpFYCZFycdtTsKgKYjwklO1ktM1zJf4KS4n7mqiaygLnCAxMYckXYQFmf2V.BvkK6QFPaE.GFqv8VqZ0GTA908+dmHtkjI3UD7cDR5y4269K8qKs3R+1RUNMKGmB4oLSfv0kFTHaU4Pv4o383Qd8nAOnxgD2H5XAA3mOlVd5hoVwnNifBdaNS9beZx4VBWaUrR89jY.TRXCd6ksaPjDURIgFHmOMPxTtiQC5gv0f3Tzh3FzvARgObQXh7GT4HribIx7kSpKZILf3QtbnJQwCYxgYuHdIpwpdt0XSqKdabWlzpew93bE3iPj5igOlby7KvMcbnVxTGbdbqWMqWCmdyuPr4uFdGAKjpM7WF+dkmR4z.UPq14zB8sSaKT+otEpQo73b9o6pQ9JtLxWPen4+LzZ7por8y3MqbcuWbjOZx77coM4GRc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+Bw6v.BC
        
        dannytaurusD 1 Reply Last reply Reply Quote 1
        • dannytaurusD
          dannytaurus @Christoph Hart
          last edited by

          @Christoph-Hart Super helpful, thanks!

          Meat Beats: https://meatbeats.com
          Klippr Video: https://klippr.video

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

          17

          Online

          2.0k

          Users

          12.8k

          Topics

          111.1k

          Posts