1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Controlling notes through knobs

Discussion in 'Scripting Workshop' started by Dr. Ra'id Marji, May 31, 2016.

  1. Dr. Ra'id Marji

    Dr. Ra'id Marji NI Product Owner

    Messages:
    26
    Hi All
    How to make Drum pad?
     
    Last edited: Jun 2, 2016
  2. Levitanus

    Levitanus Member

    Messages:
    85
    @Dr. Ra'id Marji , somthing like this?
    Code:
    on note
        declare ui_button $pad
    end on
    
    on ui_control ($pad)
        play_note (<note number>,<velocity>,0,10)
    end on
     
  3. Dr. Ra'id Marji

    Dr. Ra'id Marji NI Product Owner

    Messages:
    26
    Levitanus........Many Many Thanks
    But the problem here is that it plays the whole sample, not like drum pad when you stop clicking the sample stops.
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You just need to do a note_off() in case $pad is 0.

    Code:
    on init
        declare ui_switch $pad
        declare $ID
    end on
    
    on ui_control ($pad)
        if ($pad = 1)
            $ID := play_note(<note>,<velocity>,0,-1)
        else
            note_off($ID)
        end if
    end on
     
    Last edited: Jun 10, 2016
  5. Dr. Ra'id Marji

    Dr. Ra'id Marji NI Product Owner

    Messages:
    26
    Many Thanks, It worked :)
     
  6. Lindon

    Lindon NI Product Owner

    Messages:
    322
    "on note"? are we sure? not "on init"?
     
  7. Dr. Ra'id Marji

    Dr. Ra'id Marji NI Product Owner

    Messages:
    26
    no
    it is on init
     
  8. Lindon

    Lindon NI Product Owner

    Messages:
    322
    you dont say...
     
  9. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Yeah my bad! Fixed the post.
     
  10. alswefi

    alswefi NI Product Owner

    Messages:
    51
    or may be u need the natural release of the kit ?
    and may be can add the option to cut the release by the new note played if it is the same.