HISE Logo Forum
    • Categories
    • Register
    • Login

    Is it possible to delay midi notes / sampler playback by a few ms?

    Scheduled Pinned Locked Moved General Questions
    21 Posts 4 Posters 271 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.
    • MorphoiceM
      Morphoice @ustk
      last edited by

      @ustk it's in the onNoteOn function not the onInit... though I don't really know the difference

      https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

      1 Reply Last reply Reply Quote 0
      • MorphoiceM
        Morphoice @Simon
        last edited by

        @Simon it does work there yes. probably the deferred thing

        https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

        1 Reply Last reply Reply Quote 0
        • MorphoiceM
          Morphoice @ustk
          last edited by

          @ustk there is a Synth.deferCallbacks(true); in my main script but even if I remove that, I get the same error

          https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

          ustkU d.healeyD 2 Replies Last reply Reply Quote 0
          • ustkU
            ustk @Morphoice
            last edited by ustk

            @Morphoice remove and reload the project, this sounds familiar to me...

            onNoteOn, onNoteOff, etc... are callbacks within the interface (or other) script, not different/independent scripts, so they all "see" what is in onInit

            Can't help pressing F5 in the forum...

            MorphoiceM 1 Reply Last reply Reply Quote 0
            • MorphoiceM
              Morphoice @ustk
              last edited by

              @ustk superb! quitting hise and reloading did the trick. thank you so much

              https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

              ustkU 2 Replies Last reply Reply Quote 0
              • d.healeyD
                d.healey @Morphoice
                last edited by

                @Morphoice said in Is it possible to delay midi notes / sampler playback by a few ms?:

                even if I remove that

                You should keep it, it forces good programming habits by preventing you doing real-time stuff in your ui script. You should make a secondary script for playing your notes and connect your GUI to it.

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

                MorphoiceM 1 Reply Last reply Reply Quote 1
                • ustkU
                  ustk @Morphoice
                  last edited by

                  @Morphoice When you save a script to clipboard, it shows like this:

                   function onNoteOn()
                  {
                  	
                  }
                   function onNoteOff()
                  {
                  	
                  }
                   function onController()
                  {
                  	
                  }
                   function onTimer()
                  {
                  	
                  }
                   function onControl(number, value)
                  {
                  	
                  }
                  

                  So you see they are just functions within onInit

                  Can't help pressing F5 in the forum...

                  1 Reply Last reply Reply Quote 1
                  • ustkU
                    ustk @Morphoice
                    last edited by

                    @Morphoice Dave said it, just keep it and do your MIDI things in another script 😉

                    Can't help pressing F5 in the forum...

                    1 Reply Last reply Reply Quote 0
                    • MorphoiceM
                      Morphoice @d.healey
                      last edited by

                      @d-healey this might sound like a totally stupid noob question, but how exactly do I do that? I have only ever put stuff inside the interface script or put some functions into an include which I recon are "included" so not really out of the script

                      https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                        @Morphoice said in Is it possible to delay midi notes / sampler playback by a few ms?:

                        but how exactly do I do that

                        This is the simple explanation, but not necessarily the best way:

                        • Add a new MIDI processor.
                        • Take all your MIDI note generating code, your button grid, etc. and copy it to this new MIDI processor.
                        • Remove the MIDI note generating code from your UI script.
                        • Connect the buttons on your UI to the buttons on the new MIDI processor.

                        A better approach would avoid duplicating the grid and would allow the new MIDI processor to handle an arbitrary number of grid buttons on the UI so that it could be reused in other projects. But this would require more work so probably not worth the trouble at this stage of your HISE journey.

                        Another, more modular approach, would have a separate MIDI processor for each of your samplers.

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

                        MorphoiceM 2 Replies Last reply Reply Quote 2
                        • MorphoiceM
                          Morphoice @d.healey
                          last edited by

                          @d-healey the delay needn't be on the pads, I'm fine with it on the real midi input only
                          so I created a new MidiProcessor and put the delay code in it's onNoteOn

                          function onNoteOn()
                          {
                          	Message.delayEvent(Math.randInt(0, 30000));
                          }
                          

                          that seems to do the trick and I can reenable the deferCallbacks on the interface script! Unless I'm mistaken this was an easy fix that should work

                          https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                            @d-healey ofc the delay value is just around 300, I'm just looking for phase variance when the oneshots appear on a strict grid they sound better that way, as not every kick/snare is exactly at the same position as all the other sounds. It's what gives the organic 80s vibe ;)

                            https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                              @Morphoice said in Is it possible to delay midi notes / sampler playback by a few ms?:

                              so I created a new MidiProcessor and put the delay code in it's onNoteOn

                              That should do it.

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

                              ustkU 1 Reply Last reply Reply Quote 1
                              • ustkU
                                ustk @d.healey
                                last edited by ustk

                                @d-healey what you suggested with duplicating the controls to pilot the other script is what I would go with as well, but... Would there be a simpler way using instead a global broadcaster of some sort?

                                Can't help pressing F5 in the forum...

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

                                  @ustk said in Is it possible to delay midi notes / sampler playback by a few ms?:

                                  a global broadcaster of some sort

                                  I tried adding a broadcaster to a global variable but it didn't go well. I asked Christoph about it and he says not to do it.

                                  The way I suggested is the way all the other built-in modules of HISE work, so I think it's a good way to do it.

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

                                  ustkU 1 Reply Last reply Reply Quote 1
                                  • ustkU
                                    ustk @d.healey
                                    last edited by

                                    @d-healey said in Is it possible to delay midi notes / sampler playback by a few ms?:

                                    the way all the other built-in modules of HISE work

                                    Quite a valid point!

                                    Can't help pressing F5 in the forum...

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

                                    30

                                    Online

                                    1.7k

                                    Users

                                    11.9k

                                    Topics

                                    103.4k

                                    Posts