HISE Logo Forum
    • Categories
    • Register
    • Login

    Sample playback with stored sample start offsets

    Scheduled Pinned Locked Moved Scripting
    4 Posts 2 Posters 277 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.
    • B
      botnotbot
      last edited by

      I've hit a bit of a dead end. I'm trying to hack together a sample playback mode that uses a momentary switch to decide whether to 'continue' a sample from the previous last played position or not.

      The idea is to have a sustain pedal that enables this mode. When the pedal is released, all of the offsets return to zero, but in the mean time each offset should increase by the number of samples that a note is held for.

      I've tried writing a custom script voice start modulator but I'm getting crashes trying to start timer objects inside of the onVoiceStart callback (tried in stable and a recent build).

      Any thoughts on the best way to approach this? Thanks in advance!

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

        Maybe Synth.playNoteWithStartOffset(int channel, int number, int velocity, int offset); will provide a solution instead of using modulators.

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

        B 1 Reply Last reply Reply Quote 0
        • B
          botnotbot @d.healey
          last edited by botnotbot

          @d-healey Interesting, thanks!! That does look very useful for actually setting the offset onto the intended target.

          However, my current issues start with the simple gathering of the information required to store the offset somewhere to be used later. So far I've tried using timer callbacks to increment values per note (startTimer in onVoiceStart, stopTimer in onVoiceEnd). I tried stashing the value inside of this.data.offset inside the timer callback as well trying a parent scoped array (eg var posValues = []).

          At first I thought the Message.getTimestamp() function might be useful but that consistently returns 0. I assume that's because I'm not in a host, but if that's the case I don't to base this off the timeline anyway.

          EDIT: Running through Xcode I noticed that the timer related crashes are due to thread safety issues while modifying the array. I suspected that this might be the case, but I'm still stumped on how to get this value of "samples played between note on and note off".

          1 Reply Last reply Reply Quote 0
          • B
            botnotbot
            last edited by botnotbot

            @Christoph-Hart I'm thinking that one of the best methods for approaching this feature would be to add it as a distinct playback option for the Sampler.

            But before I start coding, I wanted to ask whether you would be open to this as an eventual pull request?

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

            46

            Online

            1.7k

            Users

            11.7k

            Topics

            101.9k

            Posts