Like a drumpad

  • Hi

    i would like to add to an image (pad) a simple sound from the sampler (note number 60)
    and to an other image the note 61.
    how can i do that?


  • administrators

    This should get you going.

    // Store the event id of the generated note for the note on.
    // For a 4x4 Drumpad, use an array.
    reg b1EventId = -1;
    // Use a filmstrip to skin this button
    const var Button1 = Content.getComponent("Button1");
    // Make it momentary so that if you release the mouse, it will send a note off message
    Button1.set("isMomentary", true);
    // Make it non-persistent so that it won't get saved in presets and called on initialisation
    Button1.set("saveInPreset", false);
    function onNoteOn()
        // This makes the button go down if you play a MIDI note
        if(Message.getNoteNumber() == 60)
    function onNoteOff()
        if(Message.getNoteNumber() == 60)
    function onController()
    function onTimer()
    function onControl(number, value)
        // Button press
    	// Play a C4 and store the event id for the note off
            b1EventId = Synth.playNote(60, 127);
            // Use the event id to kill the note when you release the button

Log in to reply

Looks like your connection to Like a drumpad was lost, please wait while we try to reconnect.