HISE Logo Forum
    • Categories
    • Register
    • Login

    set VoiceLimit of sine Wave Generator

    Scheduled Pinned Locked Moved Scripting
    23 Posts 4 Posters 226 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 @rglides
      last edited by Chazrox

      @rglides

      try this?

      inline function onKnob1Control(component, value)
      {
      	OSC1.setAttribute(2, value);
      };
      Content.getComponent("Knob1").setControlCallback(onKnob1Control);
      
      

      if you dump parameter ID & values, you see this in code editor.

      "Voice Limit" is paramter [2]
      Screenshot 2025-06-30 at 9.59.55 PM.png

      rglidesR d.healeyD 2 Replies Last reply Reply Quote 0
      • rglidesR
        rglides @Chazrox
        last edited by

        @Chazrox Thanks, good idea but it doesn't work, I'm using a Sine Wave Generator and although I can set octave, semitone etc using numbers, there seems to be no number for VoiceLimit

        ChazroxC 1 Reply Last reply Reply Quote 0
        • ChazroxC
          Chazrox @rglides
          last edited by Chazrox

          @rglides i found something weird...

          this script "works" kinda lol....but for some reason the value doesnt reflect visually on the module's text label.
          If you paramter dump after each value change, you can see that it is in fact changing it.

          try this and see what happens. Move Knob1 then close and open OSC1 module and you'll see it changes. I imagine you can figure out whats happening from that. Its kinda weird. Buggy??

          const var OSC1 = Synth.getChildSynth("OSC1");
          const var Knob1 = Content.getComponent("Knob1");
          
          
          inline function onKnob1Control(component, value)
          {
          		
          	local LimitNOW = OSC1.getAttribute(2);	
          	if (value)
          	{
          		OSC1.setAttribute(2, value);
          		Console.print(LimitNOW);	
          
          	}
          };
          Content.getComponent("Knob1").setControlCallback(onKnob1Control);
          
          
          HiseSnippet 1157.3ocyW0saaaCElx1LaVcKXsnWrKEB1EtCcAx4ulhfg4Dmjsf1jXDklsqVGsDkMWnH0jnxl2Pd21ixdD1av1gTxQxoNNtdsESAH.776GO7vuCcuDoOMMUlfrrOeTLEY8IXuQB0vtCILA5n8QVKiOljpnIN4h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LdnTv7q1AbFElNOX.MoJ1m5FBliCCTKk73NmQ4TR0t4unyKgtPRBTmnKXs3s+oYS875yw4v0QeA04+x41Gz1rYRfWetHvemi2EmL+cCTNSloXhAGSfFUXvM9jrHOfe0mBHQHnbHQXqZ5mwju1UuNmYUDXV7OvWgx150VEJaOV4GjbDQ7Sju1O+AV5d4O1HA12ByOIqI7aCg0N29kUvG71F1q88mLTugiqsnNt9h53FKpiatnNt0h53yVTG299cTOzZ2LkLJ+JKBcbuCLuD1x5.AA53M2NP+KTMLew.
          

          If I chang the knob while im playing, I can tell its working because if you go from 1 voices to 3 you can hear the polyphony changing.

          rglidesR 1 Reply Last reply Reply Quote 0
          • rglidesR
            rglides @Chazrox
            last edited by

            @Chazrox oh!! so it does! Thanks man!

            ChazroxC 2 Replies Last reply Reply Quote 0
            • ChazroxC
              Chazrox @rglides
              last edited by

              @rglides Yeet! 🙏

              1 Reply Last reply Reply Quote 0
              • ChazroxC
                Chazrox @rglides
                last edited by

                @rglides just remove the .changed();. not needed, I was being hacky. lmao

                rglidesR 1 Reply Last reply Reply Quote 0
                • rglidesR
                  rglides @Chazrox
                  last edited by

                  @Chazrox hehe hackerman to the rescue. Getting weird audio glitches in the generators now, not sure it's related, will keep playing around

                  rglidesR ChazroxC 2 Replies Last reply Reply Quote 0
                  • rglidesR
                    rglides @rglides
                    last edited by

                    @rglides Ah it's cos I set the saturation to max when testing earlier. All good, this really helps, thanks again!

                    ChazroxC 1 Reply Last reply Reply Quote 0
                    • ChazroxC
                      Chazrox @rglides
                      last edited by

                      @rglides lol.

                      I think Voice Limit does falls into the category of one of those features that cause zipping if you adjust in real time.

                      rglidesR 1 Reply Last reply Reply Quote 0
                      • ChazroxC
                        Chazrox @rglides
                        last edited by

                        @rglides oh SWEET! so its not what I said. Thats great news. haha.

                        1 Reply Last reply Reply Quote 0
                        • rglidesR
                          rglides @Chazrox
                          last edited by rglides

                          @Chazrox that could be true, I know setting to 1 probably isn't a good idea too. But no, I was getting some really strange sounds cos of the max saturation for sure - EDIT changing in real-time sounds fine actually, very smooth

                          ChazroxC 2 Replies Last reply Reply Quote 1
                          • ChazroxC
                            Chazrox @rglides
                            last edited by

                            @rglides I was just playing with it and it doesnt have a problem with zero even so I really dont know. hahaha

                            rglidesR 1 Reply Last reply Reply Quote 0
                            • ChazroxC
                              Chazrox @rglides
                              last edited by

                              @rglides shiiid. You're all good then!

                              1 Reply Last reply Reply Quote 0
                              • rglidesR
                                rglides @Chazrox
                                last edited by rglides

                                @Chazrox oh interesting, yeah I would have thought that'd be some kind of mute hack but nope

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

                                  @Chazrox said in set VoiceLimit of sine Wave Generator:

                                  Voice Limit" is paramter [2]

                                  Avoid the magic number, use the parameter name instead OSC1.VoiceLimit

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

                                  ChazroxC 1 Reply Last reply Reply Quote 1
                                  • ChazroxC
                                    Chazrox @d.healey
                                    last edited by Chazrox

                                    @d-healey ah, are these the proverbial "magic numbers" I hear about? It worked either way, I just chose the short version obviously thinking it was better. Thank You!

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

                                      @Chazrox Yeah a magic number means you're using the value of a constant instead of the constant itself. So to anyone else looking at your code - or you in the future when you've forgotten what your code does - they just see a number that magically does something but have no idea what it refers to.

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

                                      ChazroxC dannytaurusD 2 Replies Last reply Reply Quote 1
                                      • ChazroxC
                                        Chazrox @d.healey
                                        last edited by

                                        @d-healey That makes sense. Now I know wth that means. haha Ty. 🙏 Hope all is blessed!

                                        1 Reply Last reply Reply Quote 0
                                        • rglidesR
                                          rglides
                                          last edited by rglides

                                          Yeah it's true, I did update to this

                                          inline function onknb_OSC1_VoiceLimitControl(component, value)
                                          {
                                          		OSC1.setAttribute(OSC1.VoiceLimit, value);
                                          };
                                          Content.getComponent("knb_OSC1_VoiceLimit").setControlCallback(onknb_OSC1_VoiceLimitControl);
                                          

                                          but it was very helpful to discover that the function was always working, just not updating in real-time in module window, so the help was massive 🙏 edit: 'update' I mean revert hehe

                                          1 Reply Last reply Reply Quote 1
                                          • dannytaurusD
                                            dannytaurus @d.healey
                                            last edited by

                                            @d-healey It would be even better if instead of this:

                                            OSC1.setAttribute(OSC1.VoiceLimit, value);
                                            

                                            we could do this:

                                            OSC1.VoiceLimit = value;
                                            

                                            but I'm guessing that's too dynamic (or something) for C++?

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

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            20

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            104.9k

                                            Posts