HISE Logo Forum
    • Categories
    • Register
    • Login

    Some basic questions

    Scheduled Pinned Locked Moved Scripting
    74 Posts 4 Posters 17.8k 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
      last edited by

      Ah that sounds like a workable solution

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

      1 Reply Last reply Reply Quote 0
      • LevitanusL
        Levitanus
        last edited by

        What is about globals? I mean are they global for unique plugin or for any plugin in the project?
        Generally, in the any future would be grate to have both separately, but now I need only to know :)

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

          Globals are only accessible in one plugin. Making shared stuff across different plugins in a DAW is a source of constant trouble so I wouldn't bother with this...

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

            Might be possible in the HISE player though, no?

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

            1 Reply Last reply Reply Quote 0
            • LevitanusL
              Levitanus
              last edited by

              i'm trying to understand some basic concepts and can't assume, where I'm wrong here:
              Here I'm trying to implement waitting, and expect that note would be delayed by 1 second but it isn't at all...

              <?xml version="1.0" encoding="UTF-8"?>
              
              <Processor Type="ScriptProcessor" ID="Script Processor6" Bypassed="1" Script="Globals.interval = 2;&#13;&#10;Globals.attack = false;&#13;&#10;Globals.legato = false;&#13;&#10;Globals.glissando = false;&#13;&#10;Globals.sus = false;&#13;&#10;&#13;&#10;var note = 0;&#13;&#10;var velocity = 0;&#13;&#10;&#13;&#10;var newnote = 0;&#13;&#10;var lastnote = 0;&#13;&#10;var i = 0;&#13;&#10;var prev_note = 0;&#13;&#10;var temp = 0;&#13;&#10;var rel_off = 0;&#13;&#10;var fading = 0;&#13;&#10;var fade_id = 0;&#13;&#10;var exit = 0;&#13;&#10;&#13;&#10;var wait = {&#13;&#10;&#9;ms:0,&#13;&#10;&#9;start:1,&#10;};function onNoteOn()&#10;{&#13;&#10;&#9;note = Message.getNoteNumber();&#13;&#10;&#9;velocity = Message.getVelocity();&#13;&#10;&#9;&#13;&#10;&#9;//if (lastnote = 0){&#13;&#10;&#9;&#9;//Globals.attack = 1;&#13;&#10;&#9;&#9;//Globals.sus = 1;&#10;&#9;//}else {&#13;&#10;&#9;&#10;&#9;//};&#13;&#10;&#9;Message.ignoreEvent(true);&#13;&#10;&#9;wait.start = 1;&#13;&#10;&#9;wait.ms = 1000;&#10;}&#10;function onNoteOff()&#10;{&#10;&#9;note = Message.getNoteNumber();&#10;}&#10;function onController()&#10;{&#10;&#9;&#10;}&#10;function onTimer()&#10;{&#10;&#9;if (wait.ms != 0){&#13;&#10;&#9;&#9;if (wait.start == 1){&#13;&#10;&#9;&#9;&#9;wait.ms = Engine.getSamplesForMilliSeconds(wait.ms);&#13;&#10;&#9;&#9;&#9;wait.start = 0;&#10;&#9;&#9;}&#13;&#10;&#9;&#9;if (wait.ms == 1){&#13;&#10;&#9;&#9;&#9;Synth.playNote(note, velocity);&#10;&#9;&#9;}&#13;&#10;&#9;&#9;wait.ms -= 1;&#10;&#9;};&#10;};&#10;function onControl(number, value)&#10;{&#10;&#9;&#10;}&#10;">
                <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="0" onInitOpen="0"
                              onNoteOnOpen="0" onNoteOffOpen="0" onControllerOpen="0" onTimerOpen="1"
                              onControlOpen="0"/>
                <ChildProcessors/>
                <Content/>
              </Processor>
              
              1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey
                last edited by d.healey

                Well I'm not 100% sure what you're trying to do but you can't use the timer without starting it :) If you just want to delay note ons you might find what you need in my humaniser script - http://forum.hise.audio/topic/151/humaniser

                Message.delayEvent(Engine.getSamplesForMilliSeconds(randNoteOnDelay));

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

                1 Reply Last reply Reply Quote 1
                • LevitanusL
                  Levitanus
                  last edited by

                  just want to delay note

                  no, it's just smple visible action for debugging)))

                  use the timer without starting it

                  ahhh))) Thakns

                  1 Reply Last reply Reply Quote 0
                  • LevitanusL
                    Levitanus
                    last edited by

                    what the difference between playNote and addNoteOn?

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

                      addNoteOn is more specialised, but internally they are the same.

                      1 Reply Last reply Reply Quote 1
                      • LevitanusL
                        Levitanus
                        last edited by

                        agggr, I can't get it....
                        I have pretty simple on my taste task - take the attack sample (~0.7 sec), and sustain momentary, but sustain at -120dB then on last 0.3 sec of attack fade sus to 0dB. But it seems to me that callbacks on one event are executed consecutive, including to onNoteOff my wait function from onNoteOo, which using the timer callback.
                        I feel that it's not working like kontakt, and there should be way to implement such a thing, but any other thoughts bring me to the table envelopes with per-note changing the attack time and moving points (for avoide stretch of the fade area itself withtin changing attack time), that seems to me too complicated and unrelieble (more than, I can't get how to edit points on the specific attack table) :)
                        I feel myself so stupid....

                        1 Reply Last reply Reply Quote 0
                        • LevitanusL
                          Levitanus
                          last edited by Levitanus

                          function onNoteOn()
                          {
                          	note = Message.getNoteNumber();
                          	velocity = Message.getVelocity();
                          	
                          	//if (lastnote = 0){
                          		//Globals.attack = 1;
                          		//Globals.sus = 1;
                          	//}else {
                          	
                          	//};
                          	Message.ignoreEvent(true);
                          	wait.start = 1;
                          	wait.ms = 10;
                          	Synth.startTimer(0.004);
                          }
                          function onTimer()
                          {
                          	if (wait.ms != 0){
                          		if (wait.start == 1){
                          			wait.start = 0;
                          		}
                          		if (wait.ms == 1){
                          			Synth.playNote(note, velocity);
                          		}
                          		wait.ms -= 1;
                          	};
                          };
                          

                          P.S. It's just debugging code for understanding how things are working, but even here I'm confused)))

                          P.P.S.

                          take the attack sample (~0.7 sec), and sustain momentary

                          Why this way? From my experience momentary taking two samples produces less bugs and less code, than moving sustain noteOn in time

                          1 Reply Last reply Reply Quote 0
                          • LevitanusL
                            Levitanus
                            last edited by

                            Well, Now I'm almost sure about logic and syntax, but while loop terminates.

                            var wait = 0;
                            const var timer = Engine.createTimerObject();
                            
                            
                            timer.callback = function()
                            {	
                            	wait = wait - 1;
                            	if (wait == 0){
                            		timer.stopTimer;
                            	}
                            };
                            
                            function onNoteOn()
                            {
                            	note = Message.getNoteNumber();
                            	velocity = Message.getVelocity();
                            	Message.ignoreEvent(true);
                            	wait = 2;
                            	timer.startTimer(150); // in milliseconds
                            	while (wait > 0){
                            		
                            	}
                            	Synth.playNote(note, velocity);
                            }
                            
                            1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey
                              last edited by

                              I'm still not really sure what the purpose of this is but this should help:

                              <?xml version="1.0" encoding="UTF-8"?>
                              
                              <Processor Type="SynthChain" ID="Master Chain" Bypassed="0" Gain="1" Balance="0"
                                         VoiceLimit="128" KillFadeTime="20" IconColour="0" packageName=""
                                         views="32.rk1bzA.....B.........LUYtQFL..+O..........." currentView="-1">
                                <EditorStates BodyShown="0" Visible="1" Solo="0" Folded="0"/>
                                <ChildProcessors>
                                  <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
                                    <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                                    <ChildProcessors/>
                                  </Processor>
                                  <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1">
                                    <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                                    <ChildProcessors/>
                                  </Processor>
                                  <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="1" Intensity="0">
                                    <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                                    <ChildProcessors/>
                                  </Processor>
                                  <Processor Type="EffectChain" ID="FX" Bypassed="0">
                                    <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                                    <ChildProcessors/>
                                  </Processor>
                                  <Processor Type="SineSynth" ID="Sine Wave Generator" Bypassed="0" Gain="0.25"
                                             Balance="0" VoiceLimit="128" KillFadeTime="20" IconColour="0"
                                             OctaveTranspose="0" SemiTones="0" UseFreqRatio="0" CoarseFreqRatio="1"
                                             FineFreqRatio="0" SaturationAmount="0">
                                    <EditorStates BodyShown="1" Visible="1" Solo="0" GainModulationShown="1"/>
                                    <ChildProcessors>
                                      <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
                                        <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/>
                                        <ChildProcessors>
                                          <Processor Type="ScriptProcessor" ID="Time Delay" Bypassed="0" Script="reg id;&#13;&#10;reg note;&#13;&#10;reg velo;&#13;&#10;&#13;&#10;reg waitTime = 0.5; //ms&#13;&#10;reg timePassed;function onNoteOn()&#10;{&#13;&#10;&#9;Message.ignoreEvent(true);&#13;&#10;&#9;&#10;&#9;note = Message.getNoteNumber();&#13;&#10;&#9;velo = Message.getVelocity();&#13;&#10;&#9;&#13;&#10;&#9;timePassed = 0;&#13;&#10;&#9;Synth.startTimer(0.05);&#10;}&#10;function onNoteOff()&#10;{&#13;&#10;&#9;Synth.noteOffByEventId(id);&#10;}&#10;function onController()&#10;{&#10;&#9;&#10;}&#10;function onTimer()&#10;{&#13;&#10;&#9;timePassed = timePassed + 0.05;&#10;&#9;&#13;&#10;&#9;if (timePassed &gt;= waitTime)&#13;&#10;&#9;{&#13;&#10;&#9;&#9;id = Synth.playNote(note, velo);&#13;&#10;&#9;&#9;Synth.stopTimer();&#10;&#9;}&#9;&#10;}&#10;function onControl(number, value)&#10;{&#10;&#9;&#10;}&#10;">
                                            <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0"
                                                          onNoteOnOpen="0" onNoteOffOpen="0" onControllerOpen="0" onTimerOpen="1"
                                                          onControlOpen="0"/>
                                            <ChildProcessors/>
                                            <Content/>
                                          </Processor>
                                        </ChildProcessors>
                                      </Processor>
                                      <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1">
                                        <EditorStates BodyShown="1" Visible="0" Solo="0"/>
                                        <ChildProcessors>
                                          <Processor Type="SimpleEnvelope" ID="DefaultEnvelope" Bypassed="0" Intensity="1"
                                                     Attack="5" Release="10" LinearMode="1">
                                            <EditorStates BodyShown="1" Visible="1" Solo="0"/>
                                            <ChildProcessors>
                                              <Processor Type="ModulatorChain" ID="Attack Time Modulation" Bypassed="0"
                                                         Intensity="1">
                                                <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                                                <ChildProcessors/>
                                              </Processor>
                                            </ChildProcessors>
                                          </Processor>
                                        </ChildProcessors>
                                      </Processor>
                                      <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="0" Intensity="0">
                                        <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                                        <ChildProcessors/>
                                      </Processor>
                                      <Processor Type="EffectChain" ID="FX" Bypassed="0">
                                        <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                                        <ChildProcessors/>
                                      </Processor>
                                    </ChildProcessors>
                                    <RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/>
                                  </Processor>
                                </ChildProcessors>
                                <RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/>
                                <macro_controls>
                                  <macro name="Macro 1" value="0" midi_cc="-1"/>
                                  <macro name="Macro 2" value="0" midi_cc="-1"/>
                                  <macro name="Macro 3" value="0" midi_cc="-1"/>
                                  <macro name="Macro 4" value="0" midi_cc="-1"/>
                                  <macro name="Macro 5" value="0" midi_cc="-1"/>
                                  <macro name="Macro 6" value="0" midi_cc="-1"/>
                                  <macro name="Macro 7" value="0" midi_cc="-1"/>
                                  <macro name="Macro 8" value="0" midi_cc="-1"/>
                                </macro_controls>
                                <MidiAutomation/>
                              </Processor>
                              
                              

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

                              1 Reply Last reply Reply Quote 1
                              • LevitanusL
                                Levitanus
                                last edited by

                                Thank You! I assume this code, thank God, something like this have worked, but are you using timer for stopping callback for a while?
                                This is the main purpose of wait))
                                For continue executing callback after "wait" function. Many of concepts in my head are still connected with time

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

                                  The timer goes around and around once started, I'm just counting how much time has passed and performing an action after a time limit has reached, once that happens I'm stopping the timer. Can't you use an envelope for playing attack samples?

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

                                  1 Reply Last reply Reply Quote 0
                                  • LevitanusL
                                    Levitanus
                                    last edited by Levitanus

                                    Can't you use an envelope for playing attack samples?

                                    Afraid, not. Or i have to have 3 envelopes, 0.7 sec for mixing with attack, 0,5 with gliss, 0.3 with leg
                                    And Every time i want to change the main mixing properties should be edited three times...
                                    Or i have poor logic)

                                    in KSP I would make something like this:

                                    on init
                                      declare constant $attack_time := 700000
                                      declare constant $leg_time := 300000
                                      declare constant $gliss_time := 500000
                                      declare constant $fade_time := 100000
                                    end on
                                    on note
                                      if (<first note trigger>)
                                        <attack groups allowing>
                                        $attack_id :=    play_note ()
                                        <sus groups allowing>
                                        $new_id := play_note()
                                        change_vol($new_id,0) {if i not mistake}
                                        wait ($attack_time - $fade_time)
                                        change_vol ($new_id, <0dB lvl>)
                                        fade_out ($attack_id,$fade_time,1)
                                        fade_in ($new_id,$fade_time)
                                      end if
                                    {+some other stuff is not included
                                    The same with leg and gliss}
                                    end on
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey
                                      last edited by d.healey

                                      I think you could do it with a table envelope. Or use 3 samplers

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

                                      1 Reply Last reply Reply Quote 0
                                      • LevitanusL
                                        Levitanus
                                        last edited by

                                        Or use 3 samplers

                                        for sustain? The better to ave 3 envelopes, i think, but the problem of wasting time is here...

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

                                          It really depends on how you're laying out other things like RRs and Dynamics but I see no reason why you could have 4 samplers (3 was a typo), one for attacks, one for sustains, one for legatos, and one for gliss. They could each have their own envelopes. Or you can one sampler with 3 envelopes and change the attack/release time on the fly.

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

                                          1 Reply Last reply Reply Quote 0
                                          • LevitanusL
                                            Levitanus
                                            last edited by

                                            I have dedicated samplers for every phase. But The point is I need different attack delay (not attack time) on sustain depends on attack, leg, or gliss triggering.
                                            And it's quite simple example... May be i'm trying to make things too complicated...

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

                                            28

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.3k

                                            Posts