Per voice pitch scripting



  • Hi,
    I must be missing something obvious in the way the sampler work, but I can't manage to script the pitch. For example, in his case I'm trying to alter the pitch of the sampler voices by a random factor:

    https://imgur.com/a/iuW3SlX

    The note gets played, but its pitch is never altered. Can it be done ? Am I doing it wrong ?



  • The scripted modulators work in a different way to normal MIDI processor scripts and require different commands (I don't fully understand them). I think you can use your script from a normal MIDI processor though.



  • i tried moving function onVoiceStart(voiceIndex) in a script node, but it never get called. However, it does if it's part of a pitch modulator script. In that case, the Synth.setVoicePitchValue(voiceIndex, pitch);
    seems to do nothing.



  • Just return a value from 0 to 1 from the function, the rest will be taken care of - the modulation intensity will be applied to the value and it will be converted to the correct range (in this case 0.5 ... 2.0).

    function onVoiceStart(voiceIndex)
    {
        return Math.random();
    }


  • Hm, I'm still missing something it seems. I did exactly as follows :

    • started HISE
    • created a sampler
    • dragged a wav on some note
    • open the pitch processor
    • added the code in voice start
    • clicked compile (no errors)

    When I click the note on the keyboard at the bottom, the pitch is always the same.

    pic for reference : https://imgur.com/a/haNigg5



  • Have you set the intensity to something > 0? A script modulator is just like any other modulator and needs a intensity to work.



  • Thanks, works perfectly.


Log in to reply
 

10
Online

553
Users

2.1k
Topics

16.4k
Posts