├── .gitignore ├── src ├── Resources.nkc ├── Resources.nkr ├── Pianobook Piano Template.nki ├── Resources │ └── pictures │ │ ├── ARC_Knob.png │ │ ├── BLANK_ICON.png │ │ ├── Template_Skin.png │ │ ├── Vertical_Slider.png │ │ ├── Template_Skin_with_Mic_Levels.png │ │ ├── ARC_Knob.txt │ │ ├── BLANK_ICON.txt │ │ ├── Template_Skin.txt │ │ ├── Vertical_Slider.txt │ │ └── Template_Skin_with_Mic_Levels.txt ├── Graphic Design │ ├── Template_Skin.psd │ ├── Vertical_Slider.knob │ └── Template_Skin_with_Mic_Levels.psd ├── Samples │ └── IR Samples │ │ └── long warm.wav ├── Pianobook Piano Template (with Mic Levels).nki ├── Pianobook Piano Template - UI.ksp ├── Pianobook Piano Template - UI (with Mic Levels).ksp ├── Pianobook Piano Template - Voice Triggering.ksp └── Pianobook Piano Template - Voice Triggering (with Mic Levels).ksp ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | Workfiles 3 | Icon? 4 | .DS_Store -------------------------------------------------------------------------------- /src/Resources.nkc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Resources.nkc -------------------------------------------------------------------------------- /src/Resources.nkr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Resources.nkr -------------------------------------------------------------------------------- /src/Pianobook Piano Template.nki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Pianobook Piano Template.nki -------------------------------------------------------------------------------- /src/Resources/pictures/ARC_Knob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Resources/pictures/ARC_Knob.png -------------------------------------------------------------------------------- /src/Graphic Design/Template_Skin.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Graphic Design/Template_Skin.psd -------------------------------------------------------------------------------- /src/Resources/pictures/BLANK_ICON.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Resources/pictures/BLANK_ICON.png -------------------------------------------------------------------------------- /src/Samples/IR Samples/long warm.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Samples/IR Samples/long warm.wav -------------------------------------------------------------------------------- /src/Graphic Design/Vertical_Slider.knob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Graphic Design/Vertical_Slider.knob -------------------------------------------------------------------------------- /src/Resources/pictures/Template_Skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Resources/pictures/Template_Skin.png -------------------------------------------------------------------------------- /src/Resources/pictures/Vertical_Slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Resources/pictures/Vertical_Slider.png -------------------------------------------------------------------------------- /src/Pianobook Piano Template (with Mic Levels).nki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Pianobook Piano Template (with Mic Levels).nki -------------------------------------------------------------------------------- /src/Graphic Design/Template_Skin_with_Mic_Levels.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Graphic Design/Template_Skin_with_Mic_Levels.psd -------------------------------------------------------------------------------- /src/Resources/pictures/Template_Skin_with_Mic_Levels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhilowitz/kontakt-piano-template/HEAD/src/Resources/pictures/Template_Skin_with_Mic_Levels.png -------------------------------------------------------------------------------- /src/Resources/pictures/ARC_Knob.txt: -------------------------------------------------------------------------------- 1 | Has Alpha Channel: Yes 2 | Number of Animations: 31 3 | Horizontal Animation: no 4 | Vertical Resizable: no 5 | Fixed Top: 0 6 | Fixed Bottom: 0 7 | Fixed Left: 0 8 | Fixed Right: 0 9 | 10 | -------------------------------------------------------------------------------- /src/Resources/pictures/BLANK_ICON.txt: -------------------------------------------------------------------------------- 1 | Has Alpha Channel: Yes 2 | Number of Animations: 31 3 | Horizontal Animation: no 4 | Vertical Resizable: no 5 | Fixed Top: 0 6 | Fixed Bottom: 0 7 | Fixed Left: 0 8 | Fixed Right: 0 9 | 10 | -------------------------------------------------------------------------------- /src/Resources/pictures/Template_Skin.txt: -------------------------------------------------------------------------------- 1 | Has Alpha Channel: Yes 2 | Number of Animations: 31 3 | Horizontal Animation: no 4 | Vertical Resizable: no 5 | Fixed Top: 0 6 | Fixed Bottom: 0 7 | Fixed Left: 0 8 | Fixed Right: 0 9 | 10 | -------------------------------------------------------------------------------- /src/Resources/pictures/Vertical_Slider.txt: -------------------------------------------------------------------------------- 1 | Has Alpha Channel: Yes 2 | Number of Animations: 31 3 | Horizontal Animation: no 4 | Vertical Resizable: no 5 | Fixed Top: 0 6 | Fixed Bottom: 0 7 | Fixed Left: 0 8 | Fixed Right: 0 9 | 10 | -------------------------------------------------------------------------------- /src/Resources/pictures/Template_Skin_with_Mic_Levels.txt: -------------------------------------------------------------------------------- 1 | Has Alpha Channel: Yes 2 | Number of Animations: 31 3 | Horizontal Animation: no 4 | Vertical Resizable: no 5 | Fixed Top: 0 6 | Fixed Bottom: 0 7 | Fixed Left: 0 8 | Fixed Right: 0 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kontakt Piano Template 2 | 3 | A piano template for anyone looking to make a piano instrument in Kontakt 4 | 5 | Round robins, sustain pedals, and release trigger code by Dave Hilowitz. UI code by Angus Roberts-Carey. 6 | 7 | ## Features 8 | - Support for round robin 9 | - Support pedal up and pedal up sounds 10 | - Support for release trigger sounds 11 | - Release triggers sound even when the sustain pedal is down 12 | - Support for Multiple Mics 13 | 14 | ## Video Walkthrough 15 | 16 | Check out this video walkthrough of the template: 17 | https://youtu.be/0gcaZatfFmw 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 David Hilowitz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Pianobook Piano Template - UI.ksp: -------------------------------------------------------------------------------- 1 | { 2 | 3 | PIANOBOOK PIANO TEMPLATE - UI SCRIPT 4 | 5 | There are two scripts in this template. The first script is the UI Portion. 6 | The second script controls the triggering of piano groups. The two scripts 7 | can be used independently of eachother. There are also two versions of the UI script: 8 | a simple version and a multiple mic version. This is the simple version. 9 | 10 | UI scripts by Dave Hilowitz & Angus-Roberts Carey (ARC Samples) 11 | 12 | } 13 | 14 | on init 15 | 16 | { These variables are used by the Notes, RT, and Pedal knobs. 17 | Remember to change the size of the arrays (the number 18 | in brackets after the array name) if you add multiple groups to any of these.} 19 | declare const $NUM_MICS := 1 20 | declare const $NUM_GROUPS_PER_MIC := 20 21 | 22 | declare %note_groups[8] := (0,1,2,3,4,5,6,7) 23 | declare %release_trigger_groups[4] := (8,9,10,11) 24 | declare %pedal_groups[8] := (12,13,14,15,16,17,18,19) 25 | 26 | { This controls how responsive the knobs are. Make sure to keep this negative if you want this to be controllable via vertical dragging. } 27 | declare $controlSensitivity := -500 28 | 29 | { DON'T EDIT BELOW THIS POINT UNLESS YOU KNOW WHAT YOU'RE DOING } 30 | 31 | message("") 32 | 33 | { Group Busses } 34 | declare $bus := 0 35 | declare $group := 0 36 | declare $i 37 | while ($bus < $NUM_MICS) 38 | $i := 0 39 | message($group) 40 | while ($i < $NUM_GROUPS_PER_MIC) 41 | set_engine_par($ENGINE_PAR_OUTPUT_CHANNEL, $NI_BUS_OFFSET + $bus, $group, -1, -1) 42 | inc($group) 43 | inc($i) 44 | end while 45 | inc($bus) 46 | end while 47 | 48 | { UI Stuff } 49 | { Tell Kontakt we want a visible Performance View } 50 | make_perfview 51 | 52 | { Set the UI height and width for a our Performance View } 53 | set_ui_height_px(280) 54 | set_ui_width_px(633) 55 | 56 | set_control_par_str($INST_ICON_ID,$CONTROL_PAR_PICTURE,"BLANK_ICON") 57 | set_control_par_str($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE,"Template_Skin") 58 | 59 | { This variable will be used for setting volumes in the knob handlers below. } 60 | declare $count 61 | 62 | { Declare top row of controls. These control volumes for the three busses. } 63 | declare ui_slider $NotesSlider(1, 630000) 64 | $NotesSlider := 630000 65 | set_knob_defval($NotesSlider, 630000) 66 | make_persistent($NotesSlider) 67 | declare $NotesSliderId 68 | $NotesSliderId := get_ui_id($NotesSlider) 69 | set_control_par_str($NotesSliderId, $CONTROL_PAR_PICTURE, "ARC_Knob") 70 | set_control_par($NotesSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 71 | 72 | declare ui_slider $RTSlider(1, 630000) 73 | $RTSlider := 630000 74 | set_knob_defval($RTSlider, 630000) 75 | make_persistent($RTSlider) 76 | declare $RTSliderId 77 | $RTSliderId := get_ui_id($RTSlider) 78 | set_control_par_str($RTSliderId, $CONTROL_PAR_PICTURE, "ARC_Knob") 79 | set_control_par($RTSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 80 | 81 | declare ui_slider $PedalsSlider(1, 630000) 82 | $PedalsSlider := 630000 83 | set_knob_defval($PedalsSlider, 630000) 84 | make_persistent($PedalsSlider) 85 | declare $PedalsSliderId 86 | $PedalsSliderId := get_ui_id($PedalsSlider) 87 | set_control_par_str($PedalsSliderId, $CONTROL_PAR_PICTURE, "ARC_Knob") 88 | set_control_par($PedalsSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 89 | 90 | { Positions the top row of controls } 91 | move_control_px($NotesSlider, 195,95) 92 | move_control_px($RTSlider, 295,95) 93 | move_control_px($PedalsSlider, 395,95) 94 | 95 | { Declare knobs for the bottom row of controls } 96 | declare ui_slider $Vol(0, 100) 97 | $Vol := 100 98 | set_knob_defval($Vol, 100) 99 | make_persistent($Vol) 100 | declare $VolId 101 | $VolId := get_ui_id($Vol) 102 | set_control_par_str($VolId, $CONTROL_PAR_PICTURE, "ARC_Knob") 103 | set_control_par($VolId,$CONTROL_PAR_MOUSE_BEHAVIOUR,$controlSensitivity) 104 | 105 | declare ui_slider $FxOne(1, 1000000) 106 | $FxOne := 0 107 | set_knob_defval($FxOne, 0) 108 | make_persistent($FxOne) 109 | declare $FxOneId 110 | $FxOneId := get_ui_id($FxOne) 111 | set_control_par_str($FxOneId, $CONTROL_PAR_PICTURE, "ARC_Knob") 112 | set_control_par($FxOneId,$CONTROL_PAR_MOUSE_BEHAVIOUR,$controlSensitivity) 113 | 114 | declare ui_slider $FxTwo(1, 500000) 115 | $FxTwo := 0 116 | set_knob_defval($FxTwo, 0) 117 | make_persistent($FxTwo) 118 | declare $FxTwoId 119 | $FxTwoId := get_ui_id($FxTwo) 120 | set_control_par_str($FxTwoId, $CONTROL_PAR_PICTURE, "ARC_Knob") 121 | set_control_par($FxTwoId,$CONTROL_PAR_MOUSE_BEHAVIOUR,$controlSensitivity) 122 | 123 | { Positions the bottom row of controls } 124 | move_control_px($Vol, 195, 195) 125 | move_control_px($FxOne, 295, 195) 126 | move_control_px($FxTwo, 395, 195) 127 | 128 | declare $VolLevel 129 | 130 | end on 131 | 132 | on ui_control($NotesSlider) 133 | { Sets the volume of the `Notes` groups. } 134 | $count := 0 135 | while($count < num_elements(%note_groups)) 136 | set_engine_par($ENGINE_PAR_VOLUME, $NotesSlider, %note_groups[$count], -1, -1) 137 | inc($count) 138 | end while 139 | end on 140 | 141 | on ui_control($RTSlider) 142 | { Sets the volume of the `Release Trigger` groups. } 143 | $count := 0 144 | while($count < num_elements(%release_trigger_groups)) 145 | set_engine_par($ENGINE_PAR_VOLUME, $RTSlider, %release_trigger_groups[$count], -1, -1) 146 | inc($count) 147 | end while 148 | end on 149 | 150 | on ui_control($PedalsSlider) 151 | { Sets the volume of the `Pedal` groups. } 152 | $count := 0 153 | while($count < num_elements(%pedal_groups)) 154 | set_engine_par($ENGINE_PAR_VOLUME, $PedalsSlider, %pedal_groups[$count], -1, -1) 155 | inc($count) 156 | end while 157 | end on 158 | 159 | on ui_control($Vol) 160 | $VolLevel := 6300 * $Vol 161 | set_engine_par($ENGINE_PAR_VOLUME, $VolLevel, -1, -1, $NI_BUS_OFFSET) 162 | end on 163 | 164 | on ui_control($FxOne) 165 | set_engine_par($ENGINE_PAR_CUTOFF, $FxOne, -1,0,1) 166 | end on 167 | 168 | on ui_control($FxTwo) 169 | set_engine_par($ENGINE_PAR_SENDLEVEL_0, $FxTwo,-1,7 ,0) 170 | end on 171 | 172 | -------------------------------------------------------------------------------- /src/Pianobook Piano Template - UI (with Mic Levels).ksp: -------------------------------------------------------------------------------- 1 | { 2 | 3 | PIANOBOOK PIANO TEMPLATE - UI SCRIPT (WITH MIC LEVEL SLIDERS) 4 | 5 | There are two scripts in this template. The first script is the UI Portion. 6 | The second script controls the triggering of piano groups. The two scripts 7 | can be used independently of eachother. There are also two versions of the UI script: 8 | a simple version and a multiple mic version. This is the multiple mic version. 9 | 10 | UI scripts by Dave Hilowitz & Angus-Roberts Carey (ARC Samples) 11 | 12 | } 13 | 14 | on init 15 | 16 | { These variables are used by the Notes, RT, and Pedal knobs. Make sure you include 17 | the groups for all the mics. Remember to change the size of the arrays (the number 18 | in brackets after the array name) if you add multiple groups to any of these.} 19 | declare const $NUM_MICS := 3 20 | declare const $NUM_GROUPS_PER_MIC := 20 21 | 22 | { Groups for Mic 1 Groups for Mic 2 Groups for Mic 3 } 23 | { vvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvv } 24 | declare %note_groups[24] := (0,1,2,3,4,5,6,7, 20,21,22,23,24,25,26,27, 40,41,42,43,44,45,46,47) 25 | declare %release_trigger_groups[12] := (8,9,10,11, 28,29,30,31, 48,49,50,51) 26 | declare %pedal_groups[24] := (12,13,14,15,16,17,18,19, 32,33,34,35,36,37,38,39, 52,53,54,55,56,57,58,59) 27 | 28 | { This controls how responsive the knobs are. Make sure to keep this negative if you want this to be controllable via vertical dragging. } 29 | declare $controlSensitivity := -500 30 | 31 | { DON'T EDIT BELOW THIS POINT UNLESS YOU KNOW WHAT YOU'RE DOING } 32 | 33 | message("") 34 | 35 | { Group Busses } 36 | declare $bus := 0 37 | declare $group := 0 38 | declare $i 39 | while ($bus < $NUM_MICS) 40 | $i := 0 41 | message($group) 42 | while ($i < $NUM_GROUPS_PER_MIC) 43 | set_engine_par($ENGINE_PAR_OUTPUT_CHANNEL, $NI_BUS_OFFSET + $bus, $group, -1, -1) 44 | inc($group) 45 | inc($i) 46 | end while 47 | inc($bus) 48 | end while 49 | 50 | { UI Stuff } 51 | { Tell Kontakt we want a visible Performance View } 52 | make_perfview 53 | 54 | { Set the UI height and width for a our Performance View } 55 | set_ui_height_px(280) 56 | set_ui_width_px(633) 57 | 58 | set_control_par_str($INST_ICON_ID,$CONTROL_PAR_PICTURE,"BLANK_ICON") 59 | set_control_par_str($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE,"Template_Skin_with_Mic_Levels") 60 | 61 | { This variable will be used for setting volumes in the knob handlers below. } 62 | declare $count 63 | 64 | { Declare top row of controls. These control volumes for the three busses. } 65 | declare ui_slider $MicOneSlider(1, 6300) 66 | set_knob_defval($MicOneSlider, 6300) 67 | $MicOneSlider := 6300 68 | make_persistent($MicOneSlider) 69 | declare $MicOneSliderId 70 | $MicOneSliderId := get_ui_id($MicOneSlider) 71 | set_control_par_str($MicOneSliderId, $CONTROL_PAR_PICTURE, "Vertical_Slider") 72 | set_control_par($MicOneSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 73 | 74 | declare ui_slider $MicTwoSlider(1, 6300) 75 | set_knob_defval($MicTwoSlider, 6300) 76 | $MicTwoSlider := 6300 77 | make_persistent($MicTwoSlider) 78 | declare $MicTwoSliderId 79 | $MicTwoSliderId := get_ui_id($MicTwoSlider) 80 | set_control_par_str($MicTwoSliderId, $CONTROL_PAR_PICTURE, "Vertical_Slider") 81 | set_control_par($MicTwoSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 82 | 83 | declare ui_slider $MicThreeSlider(1, 6300) 84 | set_knob_defval($MicThreeSlider, 6300) 85 | $MicThreeSlider := 6300 86 | make_persistent($MicThreeSlider) 87 | declare $MicThreeSliderId 88 | $MicThreeSliderId := get_ui_id($MicThreeSlider) 89 | set_control_par_str($MicThreeSliderId, $CONTROL_PAR_PICTURE, "Vertical_Slider") 90 | set_control_par($MicThreeSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 91 | 92 | { Positions the top row of controls } 93 | move_control_px($MicOneSlider, 122, 155) 94 | move_control_px($MicTwoSlider, 167, 155) 95 | move_control_px($MicThreeSlider,212, 155) 96 | 97 | { Declare knobs for the middle row of controls } 98 | declare ui_slider $NotesSlider(1, 630000) 99 | $NotesSlider := 630000 100 | set_knob_defval($NotesSlider, 630000) 101 | make_persistent($NotesSlider) 102 | declare $NotesSliderId 103 | $NotesSliderId := get_ui_id($NotesSlider) 104 | set_control_par_str($NotesSliderId, $CONTROL_PAR_PICTURE, "ARC_Knob") 105 | set_control_par($NotesSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 106 | 107 | declare ui_slider $RTSlider(1, 630000) 108 | $RTSlider := 630000 109 | set_knob_defval($RTSlider, 630000) 110 | make_persistent($RTSlider) 111 | declare $RTSliderId 112 | $RTSliderId := get_ui_id($RTSlider) 113 | set_control_par_str($RTSliderId, $CONTROL_PAR_PICTURE, "ARC_Knob") 114 | set_control_par($RTSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 115 | 116 | declare ui_slider $PedalsSlider(1, 630000) 117 | $PedalsSlider := 630000 118 | set_knob_defval($PedalsSlider, 630000) 119 | make_persistent($PedalsSlider) 120 | declare $PedalsSliderId 121 | $PedalsSliderId := get_ui_id($PedalsSlider) 122 | set_control_par_str($PedalsSliderId, $CONTROL_PAR_PICTURE, "ARC_Knob") 123 | set_control_par($PedalsSliderId,$CONTROL_PAR_MOUSE_BEHAVIOUR, $controlSensitivity) 124 | 125 | { Positions the top row of controls } 126 | move_control_px($NotesSlider, 295, 95) 127 | move_control_px($RTSlider, 395, 95) 128 | move_control_px($PedalsSlider, 495, 95) 129 | 130 | { Declare knobs for the bottom row of controls } 131 | declare ui_slider $Vol(0, 100) 132 | $Vol := 100 133 | set_knob_defval($Vol, 100) 134 | make_persistent($Vol) 135 | declare $VolId 136 | $VolId := get_ui_id($Vol) 137 | set_control_par_str($VolId, $CONTROL_PAR_PICTURE, "ARC_Knob") 138 | set_control_par($VolId,$CONTROL_PAR_MOUSE_BEHAVIOUR,$controlSensitivity) 139 | 140 | declare ui_slider $FxOne(1, 1000000) 141 | $FxOne := 0 142 | set_knob_defval($FxOne, 0) 143 | make_persistent($FxOne) 144 | declare $FxOneId 145 | $FxOneId := get_ui_id($FxOne) 146 | set_control_par_str($FxOneId, $CONTROL_PAR_PICTURE, "ARC_Knob") 147 | set_control_par($FxOneId,$CONTROL_PAR_MOUSE_BEHAVIOUR,$controlSensitivity) 148 | 149 | declare ui_slider $FxTwo(1, 500000) 150 | $FxTwo := 0 151 | set_knob_defval($FxTwo, 0) 152 | make_persistent($FxTwo) 153 | declare $FxTwoId 154 | $FxTwoId := get_ui_id($FxTwo) 155 | set_control_par_str($FxTwoId, $CONTROL_PAR_PICTURE, "ARC_Knob") 156 | set_control_par($FxTwoId,$CONTROL_PAR_MOUSE_BEHAVIOUR,$controlSensitivity) 157 | 158 | { Positions the bottom row of controls } 159 | move_control_px($Vol, 295, 195) 160 | move_control_px($FxOne, 395, 195) 161 | move_control_px($FxTwo, 495, 195) 162 | 163 | declare $VolLevel 164 | 165 | end on 166 | 167 | on ui_control($MicOneSlider) 168 | { Sets the volume of the `Group 1` bus. } 169 | $VolLevel := $MicOneSlider * $Vol 170 | set_engine_par($ENGINE_PAR_VOLUME, $VolLevel, -1, -1, $NI_BUS_OFFSET + 0) 171 | end on 172 | 173 | on ui_control($MicTwoSlider) 174 | { Sets the volume of the `Group 2` bus. } 175 | $VolLevel := $MicTwoSlider * $Vol 176 | set_engine_par($ENGINE_PAR_VOLUME, $VolLevel, -1, -1, $NI_BUS_OFFSET + 1) 177 | end on 178 | 179 | on ui_control($MicThreeSlider) 180 | { Sets the volume of the `Group 3` bus. } 181 | $VolLevel := $MicThreeSlider * $Vol 182 | set_engine_par($ENGINE_PAR_VOLUME, $VolLevel, -1, -1, $NI_BUS_OFFSET + 2) 183 | end on 184 | 185 | on ui_control($NotesSlider) 186 | { Sets the volume of the `Notes` groups. } 187 | $count := 0 188 | while($count < num_elements(%note_groups)) 189 | set_engine_par($ENGINE_PAR_VOLUME, $NotesSlider, %note_groups[$count], -1, -1) 190 | inc($count) 191 | end while 192 | end on 193 | 194 | on ui_control($RTSlider) 195 | { Sets the volume of the `Release Trigger` groups. } 196 | $count := 0 197 | while($count < num_elements(%release_trigger_groups)) 198 | set_engine_par($ENGINE_PAR_VOLUME, $RTSlider, %release_trigger_groups[$count], -1, -1) 199 | inc($count) 200 | end while 201 | end on 202 | 203 | on ui_control($PedalsSlider) 204 | { Sets the volume of the `Pedal` groups. } 205 | $count := 0 206 | while($count < num_elements(%pedal_groups)) 207 | set_engine_par($ENGINE_PAR_VOLUME, $PedalsSlider, %pedal_groups[$count], -1, -1) 208 | inc($count) 209 | end while 210 | end on 211 | 212 | on ui_control($Vol) 213 | { This loops through all groups and sets their volume according to the $Vol knob. } 214 | $count := 0 215 | while ($count < 3) 216 | select ($count) 217 | case 0 218 | $VolLevel := $MicOneSlider * $Vol 219 | case 1 220 | $VolLevel := $MicTwoSlider * $Vol 221 | case 2 222 | $VolLevel := $MicThreeSlider * $Vol 223 | end select 224 | set_engine_par($ENGINE_PAR_VOLUME, $VolLevel, -1, -1, $NI_BUS_OFFSET + $count) 225 | inc($count) 226 | end while 227 | end on 228 | 229 | on ui_control($FxOne) 230 | set_engine_par($ENGINE_PAR_CUTOFF, $FxOne, -1,0,1) 231 | end on 232 | 233 | on ui_control($FxTwo) 234 | set_engine_par($ENGINE_PAR_SENDLEVEL_0, $FxTwo,-1,7 ,0) 235 | end on 236 | 237 | -------------------------------------------------------------------------------- /src/Pianobook Piano Template - Voice Triggering.ksp: -------------------------------------------------------------------------------- 1 | { 2 | 3 | PIANOBOOK PIANO TEMPLATE - VOICE TRIGGERING SCRIPT 4 | 5 | There are two scripts in this template. The first script is the UI Portion. 6 | The second script controls the triggering of piano groups. The two scripts 7 | can be used independently of eachother. 8 | 9 | Note triggering scripts by Dave Hilowitz 10 | UI scripts by Angus-Roberts Carey (ARC Samples) 11 | 12 | } 13 | 14 | on init 15 | 16 | { SETTINGS: 17 | Set the values below to the correct groups for your instrument. 18 | If you don't have samples for one of these group types, leave the 19 | array empty. An empty array looks like this: (). 20 | 21 | You must at least have a $note_without_pedal_group. 22 | You do not need to use the round robin functionality of this template. 23 | It is perfectly find to have only one group in each of these arrays. 24 | It is assumed that if there is more than one group in any of 25 | these, we will do round robins. Remember to change the size of 26 | the arrays (the number in brackets after the array name) if you 27 | add multiple groups to any of these. } 28 | 29 | declare %note_without_pedal_groups[4] := (0,1,2,3) 30 | declare %note_with_pedal_groups[4] := (4,5,6,7) 31 | declare %release_trigger_groups[4] := (8,9,10,11) 32 | declare %pedal_down_groups[4] := (12,13,14,15) 33 | declare %pedal_up_groups[4] := (16,17,18,19) 34 | { Release time that gets used when finger is let up on keys } 35 | declare $key_up_release_time_ms := 400 36 | { If you set this to 0, the round robins will be sequential, otherwise 37 | they will be random (but with code to prevent the same sample triggering twice 38 | in a row).} 39 | declare $randomize_round_robins := 1 40 | 41 | SET_CONDITION(NO_SYS_SCRIPT_PEDAL) 42 | SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG) 43 | message("") 44 | declare $i 45 | declare $tmp_note_id 46 | declare $tmp_event_note 47 | declare polyphonic $ignored_event_id 48 | declare const $ARRAY_SIZE := 500 49 | declare %tmp_event_ids[$ARRAY_SIZE] 50 | 51 | declare $pedal_down := 0 52 | declare $func_play_note_midi_note 53 | declare $func_play_note_velocity 54 | declare $func_play_note_type 55 | declare $func_stop_note_midi_note 56 | 57 | { Round robin tracking stuff } 58 | declare $tmp_rr := 0 59 | declare $tmp_num_round_robins 60 | declare $tmp_last_rr 61 | declare $note_without_pedal_last_rr := 0 62 | declare $note_with_pedal_last_rr := 0 63 | declare $release_trigger_last_rr := 0 64 | declare $pedal_down_last_rr := 0 65 | declare $pedal_up_last_rr := 0 66 | declare %notes_playing[128] 67 | 68 | end on 69 | 70 | function func_play_note 71 | { 72 | Inputs: 73 | - the group that we are working with 74 | - the last RR for that group 75 | - the number of round robins for the group 76 | - the number of mics } 77 | 78 | { message("func_play_generic_note") } 79 | select($func_play_note_type) 80 | case 1 81 | $tmp_num_round_robins := num_elements(%note_without_pedal_groups) 82 | $tmp_last_rr := $note_without_pedal_last_rr 83 | case 2 84 | $tmp_num_round_robins := num_elements(%note_with_pedal_groups) 85 | $tmp_last_rr := $note_with_pedal_last_rr 86 | case 3 87 | $tmp_num_round_robins := num_elements(%release_trigger_groups) 88 | $tmp_last_rr := $release_trigger_last_rr 89 | case 4 90 | $tmp_num_round_robins := num_elements(%pedal_down_groups) 91 | $tmp_last_rr := $pedal_down_last_rr 92 | $func_play_note_midi_note := 64 93 | $func_play_note_velocity := 64 94 | case 5 95 | $tmp_num_round_robins := num_elements(%pedal_up_groups) 96 | $tmp_last_rr := $pedal_up_last_rr 97 | $func_play_note_midi_note := 64 98 | $func_play_note_velocity := 64 99 | end select 100 | 101 | if($tmp_num_round_robins <= 0) 102 | exit 103 | else 104 | if($tmp_num_round_robins = 1) 105 | $tmp_rr := 0 106 | else 107 | if($tmp_num_round_robins = 2) 108 | $tmp_rr := 1 - $tmp_last_rr 109 | else 110 | if($randomize_round_robins = 1) 111 | $tmp_rr := random(0,$tmp_num_round_robins - 1) 112 | while($tmp_rr = $tmp_last_rr) 113 | $tmp_rr := random(0,$tmp_num_round_robins - 1) 114 | end while 115 | else 116 | if (($tmp_last_rr + 1) > ($tmp_num_round_robins - 1)) 117 | $tmp_rr := 0 118 | else 119 | $tmp_rr := $tmp_last_rr + 1 120 | end if 121 | end if 122 | end if 123 | end if 124 | end if 125 | 126 | 127 | $tmp_note_id := play_note($func_play_note_midi_note, $func_play_note_velocity, 0, -1) 128 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,0,$ALL_GROUPS) 129 | 130 | if($func_play_note_type = 1) 131 | if (%notes_playing[$func_play_note_midi_note] > 0) 132 | fade_out(%notes_playing[$func_play_note_midi_note], 20000, 1) 133 | end if 134 | %notes_playing[$func_play_note_midi_note] := $tmp_note_id 135 | end if 136 | 137 | { message("RR: " & $tmp_rr) } 138 | 139 | select($func_play_note_type) 140 | case 1 141 | $note_without_pedal_last_rr := $tmp_rr 142 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1,%note_without_pedal_groups[$tmp_rr]) 143 | case 2 144 | $note_with_pedal_last_rr := $tmp_rr 145 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1,%note_with_pedal_groups[$tmp_rr]) 146 | case 3 147 | $release_trigger_last_rr := $tmp_rr 148 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1,%release_trigger_groups[$tmp_rr]) 149 | case 4 150 | $pedal_down_last_rr := $tmp_rr 151 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1,%pedal_down_groups[$tmp_rr]) 152 | case 5 153 | $pedal_up_last_rr := $tmp_rr 154 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1,%pedal_up_groups[$tmp_rr]) 155 | end select 156 | end function 157 | 158 | function func_stop_all_non_held_notes 159 | { message("func_stop_all_non_held_notes called") } 160 | get_event_ids(%tmp_event_ids) 161 | $i := 0 162 | { $note_count := 0 } 163 | while($i < $ARRAY_SIZE and %tmp_event_ids[$i] # 0) 164 | { message("event found: " & %tmp_event_ids[$i]) } 165 | $tmp_event_note := get_event_par(%tmp_event_ids[$i], $EVENT_PAR_NOTE) 166 | { message("event " & %tmp_event_ids[$i] & "; MIDI note " & $tmp_event_note & "; keydown=" & %KEY_DOWN[$tmp_event_note]) } 167 | if (%KEY_DOWN[$tmp_event_note] = 0) 168 | { message("Stopping MIDI note: " & $tmp_event_note) } 169 | { stop it! } 170 | fade_out(%tmp_event_ids[$i], $key_up_release_time_ms * 1000, 1) 171 | { note_off($i) } 172 | { %notes_playing[$tmp_event_note] := 0 } 173 | end if 174 | inc($i) 175 | end while 176 | { message("Active Events: " & $note_count) } 177 | end function 178 | 179 | { cycle through all events that are currently taking place 180 | and stop any note that has the same MIDI note number } 181 | 182 | function func_stop_midi_note_if_playing 183 | { message("func_stop_midi_note_if_playing called") } 184 | get_event_ids(%tmp_event_ids) 185 | $i := 0 186 | while($i < $ARRAY_SIZE and %tmp_event_ids[$i] # 0) 187 | if (event_status(%tmp_event_ids[$i]) = $EVENT_STATUS_NOTE_QUEUE and %tmp_event_ids[$i] # $ignored_event_id) 188 | { message("event found: " & %tmp_event_ids[$i]) } 189 | $tmp_event_note := get_event_par(%tmp_event_ids[$i], $EVENT_PAR_NOTE) 190 | { message("event " & %tmp_event_ids[$i] & "; MIDI note " & $tmp_event_note & "; keydown=" & %KEY_DOWN[$tmp_event_note]) } 191 | if ($func_stop_note_midi_note = $tmp_event_note) 192 | { message("Stopping MIDI note: " & $tmp_event_note) } 193 | { stop it! } 194 | fade_out(%tmp_event_ids[$i], $key_up_release_time_ms * 1000, 1) 195 | { note_off($i) } 196 | end if 197 | end if 198 | inc($i) 199 | end while 200 | 201 | { %notes_playing[$func_stop_note_midi_note] := 0 } 202 | end function 203 | 204 | on controller 205 | if ($CC_NUM = 64) 206 | if (%CC[64] > 64) 207 | if($pedal_down = 0) 208 | $func_play_note_type := 4 209 | call func_play_note 210 | $pedal_down := 1 211 | end if 212 | else 213 | if($pedal_down = 1) 214 | call func_stop_all_non_held_notes 215 | $func_play_note_type := 5 216 | call func_play_note 217 | $pedal_down := 0 218 | end if 219 | end if 220 | end if 221 | end on 222 | 223 | on note 224 | ignore_event($EVENT_ID) 225 | { message($EVENT_ID) } 226 | $ignored_event_id := $EVENT_ID 227 | 228 | $func_play_note_midi_note := $EVENT_NOTE 229 | $func_play_note_velocity := $EVENT_VELOCITY 230 | 231 | if (%CC[64] >= 64) 232 | $func_play_note_type := 2 233 | call func_play_note 234 | else 235 | 236 | $func_stop_note_midi_note := $func_play_note_midi_note 237 | call func_stop_midi_note_if_playing 238 | $func_play_note_type := 1 239 | call func_play_note 240 | end if 241 | end on 242 | 243 | on release 244 | ignore_event($EVENT_ID) 245 | { message("release event: " & $EVENT_ID) } 246 | if($EVENT_ID = $ignored_event_id) 247 | exit 248 | end if 249 | 250 | if(%CC[64] < 64) 251 | $func_stop_note_midi_note := $EVENT_NOTE 252 | call func_stop_midi_note_if_playing 253 | end if 254 | 255 | { We play the release trigger regardless of whether or not the pedal is down. } 256 | 257 | $func_play_note_midi_note := $EVENT_NOTE 258 | $func_play_note_velocity := $EVENT_VELOCITY 259 | $func_play_note_type := 3 260 | call func_play_note 261 | end on 262 | 263 | -------------------------------------------------------------------------------- /src/Pianobook Piano Template - Voice Triggering (with Mic Levels).ksp: -------------------------------------------------------------------------------- 1 | { 2 | 3 | PIANOBOOK PIANO TEMPLATE - VOICE TRIGGERING SCRIPT 4 | 5 | There are two scripts in this template. The first script is the UI Portion. 6 | The second script controls the triggering of piano groups. The two scripts 7 | can be used independently of eachother. 8 | 9 | Note triggering scripts by Dave Hilowitz 10 | UI scripts by Angus-Roberts Carey (ARC Samples) 11 | 12 | } 13 | 14 | on init 15 | 16 | { SETTINGS: 17 | Set the values below to the correct groups for your instrument. 18 | If you don't have samples for one of these group types, leave the 19 | array empty. An empty array looks like this: (). 20 | 21 | You must at least have a $note_without_pedal_group. 22 | By default, this template is set up with four round robins per sound type– 23 | that's why there's a number 4 in the array declarations below, eg. 4 * $NUM_MICS. 24 | If you change the number of round robins, you'll also want to change this number. 25 | You do not need to use the round robin functionality of this template. 26 | It is perfectly fine to have only one group in each of these arrays. 27 | It is assumed that if there is more than one group in any of 28 | these, we will do round robins. Remember to change the size of 29 | the arrays (the first number in brackets after the array name) if you 30 | add multiple groups to any of these. } 31 | 32 | declare const $NUM_MICS := 3 33 | 34 | { Groups for... Mic 1 Mic 2 Mic 3 } 35 | declare %note_without_pedal_groups[4 * $NUM_MICS] := (0,1,2,3, 20,21,22,23, 40,41,42,43) 36 | declare %note_with_pedal_groups[4 * $NUM_MICS] := (4,5,6,7, 24,25,26,27, 44,45,46,47) 37 | declare %release_trigger_groups[4 * $NUM_MICS] := (8,9,10,11, 28,29,30,31, 48,49,50,51) 38 | declare %pedal_down_groups[4 * $NUM_MICS] := (12,13,14,15, 32,33,34,35, 52,53,54,55) 39 | declare %pedal_up_groups[4 * $NUM_MICS] := (16,17,18,19, 36,37,38,39, 56,57,58,59) 40 | 41 | { Release time that gets used when finger is let up on keys } 42 | declare $key_up_release_time_ms := 400 43 | { If you set this to 0, the round robins will be sequential, otherwise 44 | they will be random (but with code to prevent the same sample triggering twice 45 | in a row).} 46 | declare $randomize_round_robins := 1 47 | 48 | { DON'T EDIT BELOW THIS POINT UNLESS YOU KNOW WHAT YOU'RE DOING } 49 | 50 | SET_CONDITION(NO_SYS_SCRIPT_PEDAL) 51 | SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG) 52 | message("") 53 | declare $i 54 | declare $tmp_note_id 55 | declare $tmp_event_note 56 | declare polyphonic $ignored_event_id 57 | declare const $ARRAY_SIZE := 500 58 | declare %tmp_event_ids[$ARRAY_SIZE] 59 | 60 | declare $pedal_down := 0 61 | declare $func_play_note_midi_note 62 | declare $func_play_note_velocity 63 | declare $func_play_note_type 64 | declare $func_stop_note_midi_note 65 | 66 | { Round robin tracking stuff } 67 | declare $tmp_rr := 0 68 | declare $tmp_num_round_robins 69 | declare $tmp_last_rr 70 | declare %last_rr[5] := (0,0,0,0,0) 71 | declare %notes_playing[128] 72 | 73 | end on 74 | 75 | function func_play_note 76 | { message("func_play_generic_note") } 77 | $tmp_last_rr := %last_rr[$func_play_note_type-1] 78 | select($func_play_note_type) 79 | case 1 80 | $tmp_num_round_robins := num_elements(%note_without_pedal_groups) / $NUM_MICS 81 | case 2 82 | $tmp_num_round_robins := num_elements(%note_with_pedal_groups) / $NUM_MICS 83 | case 3 84 | $tmp_num_round_robins := num_elements(%release_trigger_groups) / $NUM_MICS 85 | case 4 86 | $tmp_num_round_robins := num_elements(%pedal_down_groups) / $NUM_MICS 87 | $func_play_note_midi_note := 64 88 | $func_play_note_velocity := 64 89 | case 5 90 | $tmp_num_round_robins := num_elements(%pedal_up_groups) / $NUM_MICS 91 | $func_play_note_midi_note := 64 92 | $func_play_note_velocity := 64 93 | end select 94 | 95 | if($tmp_num_round_robins <= 0) 96 | exit 97 | else 98 | if($tmp_num_round_robins = 1) 99 | $tmp_rr := 0 100 | else 101 | if($tmp_num_round_robins = 2) 102 | $tmp_rr := 1 - $tmp_last_rr 103 | else 104 | if($randomize_round_robins = 1) 105 | $tmp_rr := random(0,$tmp_num_round_robins - 1) 106 | while($tmp_rr = $tmp_last_rr) 107 | $tmp_rr := random(0,$tmp_num_round_robins - 1) 108 | end while 109 | else 110 | if (($tmp_last_rr + 1) > ($tmp_num_round_robins - 1)) 111 | $tmp_rr := 0 112 | else 113 | $tmp_rr := $tmp_last_rr + 1 114 | end if 115 | end if 116 | end if 117 | end if 118 | end if 119 | 120 | 121 | $tmp_note_id := play_note($func_play_note_midi_note, $func_play_note_velocity, 0, -1) 122 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,0,$ALL_GROUPS) 123 | 124 | if($func_play_note_type = 1) 125 | if (%notes_playing[$func_play_note_midi_note] > 0) 126 | fade_out(%notes_playing[$func_play_note_midi_note], 20000, 1) 127 | end if 128 | %notes_playing[$func_play_note_midi_note] := $tmp_note_id 129 | end if 130 | 131 | { message("RR: " & $tmp_rr) } 132 | %last_rr[$func_play_note_type-1] := $tmp_rr 133 | $i:= 0 134 | while($i<$NUM_MICS) 135 | select($func_play_note_type) 136 | case 1 137 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1, %note_without_pedal_groups[$i*$tmp_num_round_robins + $tmp_rr]) 138 | case 2 139 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1, %note_with_pedal_groups[$i*$tmp_num_round_robins + $tmp_rr]) 140 | case 3 141 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1, %release_trigger_groups[$i*$tmp_num_round_robins + $tmp_rr]) 142 | case 4 143 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1, %pedal_down_groups[$i*$tmp_num_round_robins + $tmp_rr]) 144 | case 5 145 | set_event_par_arr($tmp_note_id,$EVENT_PAR_ALLOW_GROUP,1, %pedal_up_groups[$i*$tmp_num_round_robins + $tmp_rr]) 146 | end select 147 | inc($i) 148 | end while 149 | end function 150 | 151 | function func_stop_all_non_held_notes 152 | { message("func_stop_all_non_held_notes called") } 153 | get_event_ids(%tmp_event_ids) 154 | $i := 0 155 | { $note_count := 0 } 156 | while($i < $ARRAY_SIZE and %tmp_event_ids[$i] # 0) 157 | { message("event found: " & %tmp_event_ids[$i]) } 158 | $tmp_event_note := get_event_par(%tmp_event_ids[$i], $EVENT_PAR_NOTE) 159 | { message("event " & %tmp_event_ids[$i] & "; MIDI note " & $tmp_event_note & "; keydown=" & %KEY_DOWN[$tmp_event_note]) } 160 | if (%KEY_DOWN[$tmp_event_note] = 0) 161 | { message("Stopping MIDI note: " & $tmp_event_note) } 162 | { stop it! } 163 | fade_out(%tmp_event_ids[$i], $key_up_release_time_ms * 1000, 1) 164 | { note_off($i) } 165 | { %notes_playing[$tmp_event_note] := 0 } 166 | end if 167 | inc($i) 168 | end while 169 | { message("Active Events: " & $note_count) } 170 | end function 171 | 172 | { cycle through all events that are currently taking place 173 | and stop any note that has the same MIDI note number } 174 | 175 | function func_stop_midi_note_if_playing 176 | { message("func_stop_midi_note_if_playing called") } 177 | get_event_ids(%tmp_event_ids) 178 | $i := 0 179 | while($i < $ARRAY_SIZE and %tmp_event_ids[$i] # 0) 180 | if (event_status(%tmp_event_ids[$i]) = $EVENT_STATUS_NOTE_QUEUE and %tmp_event_ids[$i] # $ignored_event_id) 181 | { message("event found: " & %tmp_event_ids[$i]) } 182 | $tmp_event_note := get_event_par(%tmp_event_ids[$i], $EVENT_PAR_NOTE) 183 | { message("event " & %tmp_event_ids[$i] & "; MIDI note " & $tmp_event_note & "; keydown=" & %KEY_DOWN[$tmp_event_note]) } 184 | if ($func_stop_note_midi_note = $tmp_event_note) 185 | { message("Stopping MIDI note: " & $tmp_event_note) } 186 | { stop it! } 187 | fade_out(%tmp_event_ids[$i], $key_up_release_time_ms * 1000, 1) 188 | { note_off($i) } 189 | end if 190 | end if 191 | inc($i) 192 | end while 193 | 194 | { %notes_playing[$func_stop_note_midi_note] := 0 } 195 | end function 196 | 197 | on controller 198 | if ($CC_NUM = 64) 199 | if (%CC[64] > 64) 200 | if($pedal_down = 0) 201 | $func_play_note_type := 4 202 | call func_play_note 203 | $pedal_down := 1 204 | end if 205 | else 206 | if($pedal_down = 1) 207 | call func_stop_all_non_held_notes 208 | $func_play_note_type := 5 209 | call func_play_note 210 | $pedal_down := 0 211 | end if 212 | end if 213 | end if 214 | end on 215 | 216 | on note 217 | ignore_event($EVENT_ID) 218 | { message($EVENT_ID) } 219 | $ignored_event_id := $EVENT_ID 220 | 221 | $func_play_note_midi_note := $EVENT_NOTE 222 | $func_play_note_velocity := $EVENT_VELOCITY 223 | 224 | if (%CC[64] >= 64) 225 | $func_play_note_type := 2 226 | call func_play_note 227 | else 228 | 229 | $func_stop_note_midi_note := $func_play_note_midi_note 230 | call func_stop_midi_note_if_playing 231 | $func_play_note_type := 1 232 | call func_play_note 233 | end if 234 | end on 235 | 236 | on release 237 | ignore_event($EVENT_ID) 238 | { message("release event: " & $EVENT_ID) } 239 | if($EVENT_ID = $ignored_event_id) 240 | exit 241 | end if 242 | 243 | if(%CC[64] < 64) 244 | $func_stop_note_midi_note := $EVENT_NOTE 245 | call func_stop_midi_note_if_playing 246 | end if 247 | 248 | { We play the release trigger regardless of whether or not the pedal is down. } 249 | 250 | $func_play_note_midi_note := $EVENT_NOTE 251 | $func_play_note_velocity := $EVENT_VELOCITY 252 | $func_play_note_type := 3 253 | call func_play_note 254 | end on 255 | 256 | --------------------------------------------------------------------------------