How can I ensure only one sample per note is being played when I retrigger a note?

fan455
fan455 Member Posts: 9 Member
edited October 22 in Scripting Workshop

Hi there,

I am struggling to solve this issue. For example, I play a note C3 when there is already a C3 note being held. They may have different velocities and may correspond to the same zone or different zones. How can I make sure the previous C3 voice will be killed and a new C3 voice will be triggered? It seems assigning to voice groups can do, but it seems voice groups only work on group level, and I have got too many notes that need this feature so it's tough to use voice groups.

Appreciate your answers!

Best Answer

  • soundtrax
    soundtrax Member Posts: 14 Member
    Answer ✓

    I'd recommend this little script from the KSP manual (page 82):

    on init
        declare %key_id[128]
    

    end on

    on note
        if (event_status(%key_id[$EVENT_NOTE])= $EVENT_STATUS_NOTE_QUEUE)
            fade_out(%key_id[$EVENT_NOTE],10000,1)
        end if
         %key_id[$EVENT_NOTE] := $EVENT_ID
    end on
    


Answers

  • soundtrax
    soundtrax Member Posts: 14 Member
    Answer ✓

    I'd recommend this little script from the KSP manual (page 82):

    on init
        declare %key_id[128]
    

    end on

    on note
        if (event_status(%key_id[$EVENT_NOTE])= $EVENT_STATUS_NOTE_QUEUE)
            fade_out(%key_id[$EVENT_NOTE],10000,1)
        end if
         %key_id[$EVENT_NOTE] := $EVENT_ID
    end on
    


This discussion has been closed.
Back To Top