-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PakettiMidi.lua
1691 lines (1442 loc) · 74.7 KB
/
PakettiMidi.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--- This is the way
-- function(message) if message:is_trigger() then
-------------------------------------------------------------------------------------------------------------------------------
--Groove Settings, re-written and simplified by mxb
--Control Grooves with a slider
renoise.tool():add_midi_mapping{name="Paketti:Groove Settings Groove #1 x[Knob]",
invoke=function(midi_message)
local ga=renoise.song().transport.groove_amounts
if not renoise.song().transport.groove_enabled then renoise.song().transport.groove_enabled=true end
renoise.app().window.active_lower_frame=1
renoise.song().transport.groove_amounts = {midi_message.int_value/127, ga[2], ga[3], ga[4]}
end}
renoise.tool():add_midi_mapping{name="Paketti:Groove Settings Groove #2 x[Knob]",
invoke=function(midi_message)
local ga=renoise.song().transport.groove_amounts
if not renoise.song().transport.groove_enabled then renoise.song().transport.groove_enabled=true end
renoise.app().window.active_lower_frame=1
renoise.song().transport.groove_amounts = {ga[1], midi_message.int_value/127, ga[3], ga[4]}
end}
renoise.tool():add_midi_mapping{name="Paketti:Groove Settings Groove #3 x[Knob]",
invoke=function(midi_message)
local ga=renoise.song().transport.groove_amounts
if not renoise.song().transport.groove_enabled then renoise.song().transport.groove_enabled=true end
renoise.app().window.active_lower_frame=1
renoise.song().transport.groove_amounts = {ga[1], ga[2], midi_message.int_value/127, ga[4]}
end}
renoise.tool():add_midi_mapping{name="Paketti:Groove Settings Groove #4 x[Knob]",
invoke=function(midi_message)
local ga=renoise.song().transport.groove_amounts
if not renoise.song().transport.groove_enabled then renoise.song().transport.groove_enabled=true end
renoise.app().window.active_lower_frame=1
renoise.song().transport.groove_amounts = {ga[1], ga[2], ga[3], midi_message.int_value/127}
end}
-----------------------------------------------------------------------------------------------------------------------------------------
-- Control Computer Keyboard Velocity with a slider.
renoise.tool():add_midi_mapping{name="Paketti:Computer Keyboard Velocity Slider x[Knob]",
invoke=function(midi_message)
local t=renoise.song().transport
if t.keyboard_velocity_enabled==false then t.keyboard_velocity_enabled=true end
t.keyboard_velocity=midi_message.int_value end}
-- Destructively control Sample volume with a slider
renoise.tool():add_midi_mapping{name="Paketti:Change Selected Sample Volume x[Slider]",invoke=function(midi_message)
renoise.app().window.active_middle_frame=5
renoise.song().selected_sample.volume=midi_message.int_value/127
end}
renoise.tool():add_midi_mapping{name="Paketti:Delay Column (DEPRECATED) x[Slider]",invoke=function(midi_message)
renoise.song().selected_track.delay_column_visible=true
renoise.app().window.active_middle_frame=1
local results = nil
results=midi_message.int_value/127
renoise.song().selected_note_column.delay_value = math.max(0, math.min(257, midi_message.int_value * 2))
-- if midi_message.int_value > 64 then columns(1,1)
-- else if midi_message.int_value < 64 then columns(-1,1)
-- end
-- end
end}
-------------------------------------------------------------------------------------------------------------------------------------
--Midi Mapping for Metronome On/Off Toggle
renoise.tool():add_midi_mapping{name="Paketti:Metronome On/Off x[Toggle]",invoke=function(message) if message:is_trigger() then MetronomeOff() end end}
--Midi Mapping for Expand/Collapse
renoise.tool():add_midi_mapping{name="Paketti:Uncollapser",invoke=function(message) if message:is_trigger() then Uncollapser() end end}
renoise.tool():add_midi_mapping{name="Paketti:Collapser",invoke=function(message) if message:is_trigger() then Collapser() end end}
-------------------------------------------------------------------------------------------------------------------------------------
--- Show or hide pattern matrix
function showhidepatternmatrix()
local pmi=renoise.app().window.pattern_matrix_is_visible
if pmi==true then pmi=false else pmi=true end
end
renoise.tool():add_midi_mapping{name="Paketti:Show/Hide Pattern Matrix x[Toggle]", invoke=function(message) if message:is_trigger() then showhidepatternmatrix() end end}
-----------------------------------------------------------------------------------------------------------------------------------------
--- Show or hide pattern matrix
function MidiRecordAndFollowToggle()
local t=renoise.song().transport
local w=renoise.app().window
if t.edit_mode == true then
t.edit_mode = false
t.follow_player = false
t.playing = false
else
t.edit_mode = true
t.follow_player = true
t.playing = true
w.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_PATTERN_EDITOR
w.lock_keyboard_focus = true
end
end
renoise.tool():add_midi_mapping{name="Paketti:Record and Follow x[Toggle]", invoke=function(message) if message:is_trigger() then MidiRecordAndFollowToggle() end end}
renoise.tool():add_midi_mapping{name="Paketti:Record and Follow On/Off x[Knob]", invoke=function(midi_message)
--Aided by dblue
local t=renoise.song().transport
local w=renoise.app().window
if (midi_message.int_value == 127) then t.edit_mode = true t.follow_player = true t.playing = true
w.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_PATTERN_EDITOR
w.lock_keyboard_focus = true
else end
if (midi_message.int_value == 0) then t.edit_mode = false t.follow_player = false t.playing = false
else end
if (midi_message.int_value >= 100) then
t.edit_mode = true
t.follow_player = true
w.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_PATTERN_EDITOR
w.lock_keyboard_focus = true
else
t.edit_mode = false
t.follow_player = false
end
end}
---------------------------------------------------------------------------------------------------------------------------
--Record Quantize On/Off for Midi_Mapping
renoise.tool():add_midi_mapping{name="Paketti:Record Quantize On/Off x[Toggle]",
invoke=function(message) if message:is_trigger() then
if renoise.song().transport.record_quantize_enabled==true then
renoise.song().transport.record_quantize_enabled=false
else
renoise.song().transport.record_quantize_enabled=true
end end
end}
-----------------------------------------------------------------------------------------------------------------------------------------
renoise.tool():add_midi_mapping{name="Paketti:Impulse Tracker F7 Start Playback from Cursor Row x[Toggle]", invoke=function(message) if message:is_trigger() then ImpulseTrackerPlayFromLine() end end}
renoise.tool():add_midi_mapping{name="Paketti:Stop Playback (Panic) x[Toggle]", invoke=function(message) if message:is_trigger() then ImpulseTrackerStop() end end}
renoise.tool():add_midi_mapping{name="Paketti:Play Current Line & Advance by EditStep x[Toggle]", invoke=function(message) if message:is_trigger() then PlayCurrentLine() end end}
renoise.tool():add_midi_mapping{name="Paketti:Impulse Tracker Pattern (Next) x[Toggle]", invoke=function(message) if message:is_trigger() then ImpulseTrackerNextPattern() end end}
renoise.tool():add_midi_mapping{name="Paketti:Impulse Tracker Pattern (Previous) x[Toggle]", invoke=function(message) if message:is_trigger() then ImpulseTrackerPrevPattern() end end}
renoise.tool():add_midi_mapping{name="Paketti:Impulse Tracker F5 Start Playback x[Toggle]", invoke=function(message) if message:is_trigger() then ImpulseTrackerPlaySong() end end}
renoise.tool():add_midi_mapping{name="Paketti:Impulse Tracker F8 Stop Playback (Panic) x[Toggle]", invoke=function(message) if message:is_trigger() then ImpulseTrackerStop() end end}
renoise.tool():add_midi_mapping{name="Paketti:Switch to Automation",invoke=function(message) if message:is_trigger() then
local w=renoise.app().window
local raw=renoise.ApplicationWindow
if raw.MIDDLE_FRAME_MIXER == false and w.active_lower_frame == raw.LOWER_FRAME_TRACK_AUTOMATION
then w.active_middle_frame=raw.MIDDLE_FRAME_MIXER return
else w.active_middle_frame=raw.MIDDLE_FRAME_MIXER end
showAutomation() end end}
renoise.tool():add_midi_mapping{name="Paketti:Wipe&Slice (004) x[Toggle]",invoke=function(message) if message:is_trigger() then slicerough(4) end end}
renoise.tool():add_midi_mapping{name="Paketti:Wipe&Slice (008) x[Toggle]",invoke=function(message) if message:is_trigger() then slicerough(8) end end}
renoise.tool():add_midi_mapping{name="Paketti:Wipe&Slice (016) x[Toggle]",invoke=function(message) if message:is_trigger() then slicerough(16) end end}
renoise.tool():add_midi_mapping{name="Paketti:Wipe&Slice (032) x[Toggle]",invoke=function(message) if message:is_trigger() then slicerough(32) end end}
renoise.tool():add_midi_mapping{name="Paketti:Wipe&Slice (064) x[Toggle]",invoke=function(message) if message:is_trigger() then slicerough(64) end end}
renoise.tool():add_midi_mapping{name="Paketti:Wipe&Slice (128) x[Toggle]",invoke=function(message) if message:is_trigger() then slicerough(128) end end}
renoise.tool():add_midi_mapping{name="Paketti:Set Delay (+1) x[Toggle]", invoke=function(message) if message:is_trigger() then delayInput(1) end end}
renoise.tool():add_midi_mapping{name="Paketti:Set Delay (-1) x[Toggle]", invoke=function(message) if message:is_trigger() then delayInput(-1) end end}
-----------------------------------------------------------------------------------------------------------------------------------------
-- //TODO check that these work
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 0 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(0) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 1 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(1) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 2 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(2) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 3 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(3) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 4 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(4) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 5 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(5) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 6 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(6) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 7 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(7) end end}
renoise.tool():add_midi_mapping{name="Paketti:Numpad SelectPlay 8 x[Toggle]", invoke=function(message) if message:is_trigger() then selectplay(8) end end}
renoise.tool():add_midi_mapping{name="Paketti:Capture Nearest Instrument and Octave", invoke=function(message) if message:is_trigger() then capture_ins_oct() end end}
renoise.tool():add_midi_mapping{name="Paketti:Simple Play",invoke=function(message) if message:is_trigger() then simpleplay() end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Delay Increase (+1) x[Toggle]",invoke=function(message) if message:is_trigger() then columns(1,1) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Delay Decrease (-1) x[Toggle]",invoke=function(message) if message:is_trigger() then columns(-1,1) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Panning Increase (+1) x[Toggle]",invoke=function(message) if message:is_trigger() then columns(1,2) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Panning Decrease (-1) x[Toggle]",invoke=function(message) if message:is_trigger() then columns(-1,2) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Volume Increase (+1) x[Toggle]",invoke=function(message) if message:is_trigger() then columns(1,3) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Volume Decrease (-1) x[Toggle]",invoke=function(message) if message:is_trigger() then columns(-1,3) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Effect Number Increase (+1) x[Toggle]",invoke=function(message) if message:is_trigger() then columnspart2(1,4) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Effect Number Decrease (-1) x[Toggle]",invoke=function(message) if message:is_trigger() then columnspart2(-1,4) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Effect Amount Increase (+1) x[Toggle]",invoke=function(message) if message:is_trigger() then columnspart2(1,5) end end}
renoise.tool():add_midi_mapping{name="Paketti:Columnizer Effect Amount Decrease (-1) x[Toggle]",invoke=function(message) if message:is_trigger() then columnspart2(-1,5) end end}
--[[renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Disk Browser Focus",invoke=function()
renoise.app().window.lock_keyboard_focus=false
renoise.app().window:select_preset(7) end}
renoise.tool():add_midi_mapping{name="Pattern Editor:Paketti:Disk Browser Focus",invoke=function() renoise.app().window:select_preset(8) end}
]]--
renoise.tool():add_midi_mapping{name="Paketti:Change Selected Sample Loop Mode x[Knob]",
invoke = function(midi_message)
local value = midi_message.int_value
local loop_modes = {
[0] = 1, -- No Loop
[1] = 2, -- Forward Loop
[2] = 3, -- Backward Loop
[3] = 4 -- PingPong Loop
}
if value == 0 then
renoise.song().selected_sample.loop_mode = loop_modes[0] -- No Loop
elseif value >= 1 and value <= 63 then
renoise.song().selected_sample.loop_mode = loop_modes[1] -- Forward Loop
elseif value >= 64 and value <= 126 then
renoise.song().selected_sample.loop_mode = loop_modes[2] -- Backward Loop
elseif value == 127 then
renoise.song().selected_sample.loop_mode = loop_modes[3] -- PingPong Loop
end
end
}
function selectedSampleLoopTo(loopMode)
renoise.song().selected_sample.loop_mode=loopMode
end
function toggleSelectedSampleLoopTo(loopMode)
if renoise.song().selected_sample.loop_mode==loopMode
then renoise.song().selected_sample.loop_mode = 1
else renoise.song().selected_sample.loop_mode=loopMode
end
end
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 1 No Loop x[On]", invoke=function() selectedSampleLoopTo(1) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 2 Forward x[On]", invoke=function() selectedSampleLoopTo(2) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 3 Backward x[On]", invoke=function() selectedSampleLoopTo(3) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 4 PingPong x[On]", invoke=function() selectedSampleLoopTo(4) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 1 No Loop x[Toggle]", invoke=function() toggleSelectedSampleLoopTo(1) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 2 Forward x[Toggle]", invoke=function() toggleSelectedSampleLoopTo(2) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 3 Backward x[Toggle]", invoke=function() toggleSelectedSampleLoopTo(3) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Sample Loop to 4 PingPong x[Toggle]", invoke=function() toggleSelectedSampleLoopTo(4) end}
renoise.tool():add_midi_mapping{name="Paketti:Record to Current Track x[Toggle]", invoke=function()
recordtocurrenttrack()
local t=renoise.song().transport
if t.playing==false then t.playing=true end
t.loop_block_enabled=false
t.follow_player=true
renoise.app().window.active_lower_frame=2
renoise.app().window.lower_frame_is_visible=true
-- Uncomment and refine these for specific playback position control if needed:
-- local startpos = t.playback_pos
-- startpos.line = renoise.song().selected_line_index
-- startpos.sequence = renoise.song().selected_sequence_index
-- t.playback_pos = startpos
-- t:start(renoise.Transport.PLAYMODE_CONTINUE_PATTERN)
end}
renoise.tool():add_midi_mapping{name="Paketti:Simple Play Record Follow",invoke=function() simpleplayrecordfollow() end}
--------------
function midiEnableDSP(deviceNumber,onOrOff)
if #renoise.song().selected_track.devices < 2 then return
else
local deviceNumberActual = deviceNumber+1
if #renoise.song().selected_track.devices < deviceNumberActual then return
else
renoise.song().selected_track.devices[deviceNumberActual].is_active = onOrOff
end
end
end
function midiToggleDSP(deviceNumber)
if #renoise.song().selected_track.devices < 2 then return
else
local deviceNumberActual = deviceNumber+1
if #renoise.song().selected_track.devices < deviceNumberActual then return
else
if renoise.song().selected_track.devices[deviceNumberActual].is_active == true then
renoise.song().selected_track.devices[deviceNumberActual].is_active = false
else
renoise.song().selected_track.devices[deviceNumberActual].is_active = true
end
end
end
end
for i = 1, 9 do
renoise.tool():add_midi_mapping{name="Paketti:Enable Track DSP Device 0" .. i, invoke=function() midiEnableDSP(i, true) end}
end
for i = 10, 32 do
renoise.tool():add_midi_mapping{name="Paketti:Enable Track DSP Device " .. i, invoke=function() midiEnableDSP(i, true) end}
end
for i = 1, 9 do
renoise.tool():add_midi_mapping{name="Paketti:Disable Track DSP Device 0" .. i, invoke=function() midiEnableDSP(i, false) end}
end
for i = 10, 32 do
renoise.tool():add_midi_mapping{name="Paketti:Disable Track DSP Device " .. i, invoke=function() midiEnableDSP(i, false) end}
end
for i = 1, 9 do
renoise.tool():add_midi_mapping{name="Paketti:Toggle Track DSP Device 0" .. i, invoke=function() midiToggleDSP(i) end}
end
for i = 10, 32 do
renoise.tool():add_midi_mapping{name="Paketti:Toggle Track DSP Device " .. i, invoke=function() midiToggleDSP(i) end}
end
-------
renoise.tool():add_midi_mapping{name="Paketti:Midi Change EditStep 1-64 x[Knob]",
invoke = function(message)
if message:is_abs_value() then
-- Pass the actual property object, not just the value
midiValues(1, 64, renoise.song().transport, 'edit_step', message.int_value)
end
end}
renoise.tool():add_midi_mapping {name="Paketti:Midi Change EditStep 0-64 x[Knob]",
invoke = function(message)
if message:is_abs_value() then
-- Pass the actual property object, not just the value
midiValues(0, 64, renoise.song().transport, 'edit_step', message.int_value)
end
end}
-- A function to handle MIDI input and map it to a specified range and property
function midiValues(minValue, maxValue, object, propertyName, midiInput)
local scaledValue = scaleValue(midiInput, 0, 127, minValue, maxValue)
-- Set the property on the object using propertyName
object[propertyName] = math.floor(math.max(minValue, math.min(scaledValue, maxValue)))
end
-- Scales an input value from a given input range to a specified output range
function scaleValue(input, inputMin, inputMax, outputMin, outputMax)
local scale = (outputMax - outputMin) / (inputMax - inputMin)
local output = (input - inputMin) * scale + outputMin
return output
end
function midiMappedEditStep(stepNumber)
renoise.song().transport.edit_step = stepNumber
end
for i=0,9 do
renoise.tool():add_midi_mapping{name="Paketti:Set EditStep to 0" .. i, invoke=function() midiMappedEditStep(i) end}
end
for i=10,64 do
renoise.tool():add_midi_mapping{name="Paketti:Set EditStep to " .. i, invoke=function() midiMappedEditStep(i) end}
end
------
renoise.tool():add_midi_mapping{name="Paketti:Midi Select Group (Previous)",invoke=function(message) if message:is_trigger() then selectPreviousGroupTrack() end end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Select Group (Next)",invoke=function(message) if message:is_trigger() then selectNextGroupTrack() end end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Select Track (Previous)",invoke=function(message) if message:is_trigger() then selectPreviousTrack() end end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Select Track (Next)",invoke=function(message) if message:is_trigger() then selectNextTrack() end end}
-----
-- Retrieve all group track indices
function groupTrackIndices()
local song = renoise.song()
local indices = {}
for i = 1, #song.tracks do
if song.tracks[i].type == renoise.Track.TRACK_TYPE_GROUP then
table.insert(indices, i)
end
end
return indices
end
-- Function to select a group track by index
function selectGroupTrackByIndex(index)
local song = renoise.song()
local groups = groupTrackIndices()
if #groups > 0 and index >= 1 and index <= #groups then
song.selected_track_index = groups[index]
end
end
-- Handle MIDI input and map it to group track selection
function changeGroupTrackWithMidi(message)
if message:is_abs_value() then
local group_count = #groupTrackIndices()
local index = scaleValue(message.int_value, 0, 127, 1, group_count)
selectGroupTrackByIndex(math.floor(index))
end
end
renoise.tool():add_midi_mapping{name="Paketti:Midi Select Group Tracks x[Knob]", invoke=changeGroupTrackWithMidi}
--------
--
renoise.tool():add_midi_mapping{name="Paketti:Midi Change Octave x[Knob]",
invoke = function(message)
if message:is_abs_value() then
midiValues(0, 8, renoise.song().transport, 'octave', message.int_value)
end
end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Change Selected Track x[Knob]",
invoke = function(message)
if message:is_abs_value() then
local trackCount = #renoise.song().tracks
midiValues(1, trackCount, renoise.song(), 'selected_track_index', message.int_value)
end
end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Change Selected Track DSP Device x[Knob]",
invoke = function(message)
if message:is_abs_value() then
local deviceCount = #renoise.song().selected_track.devices
if deviceCount < 2 then
renoise.app():show_status("There are no Track DSP Devices on this channel.")
else
midiValues(2, deviceCount, renoise.song(), 'selected_device_index', message.int_value)
end
end
end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Change Selected Instrument x[Knob]",
invoke = function(message)
if message:is_abs_value() then
local instrumentCount = #renoise.song().instruments
midiValues(1, instrumentCount, renoise.song(), 'selected_instrument_index', message.int_value)
end
end}
----------------
renoise.tool():add_midi_mapping{name="Paketti:Midi Change Selected Sample Loop 01 Start x[Knob]",
invoke = function(message)
if message:is_abs_value() then
local sampleEndPosition = renoise.song().selected_sample.loop_end -1
midiValues(1, sampleEndPosition, renoise.song().selected_sample, 'loop_start', message.int_value)
end
end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Change Selected Sample Loop 02 End x[Knob]",
invoke = function(message)
if message:is_abs_value() then
local loopStart = renoise.song().selected_sample.loop_start
midiValues(loopStart, renoise.song().selected_sample.sample_buffer.number_of_frames, renoise.song().selected_sample, 'loop_end', message.int_value)
end
end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Sample Buffer Selection 01 Start x[Knob]",
invoke = function(message)
if message:is_abs_value() then
local selectionEnd=renoise.song().selected_sample.sample_buffer.selection_end
local selectionStart=renoise.song().selected_sample.sample_buffer.selection_start
local range=renoise.song().selected_sample.sample_buffer.selection_range
midiValues(1, renoise.song().selected_sample.sample_buffer.number_of_frames, renoise.song().selected_sample.sample_buffer, 'selection_start', message.int_value)
end
end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Sample Buffer Selection 02 End x[Knob]",
invoke = function(message)
if message:is_abs_value() then
local selectionEnd=renoise.song().selected_sample.sample_buffer.selection_end
local selectionStart=renoise.song().selected_sample.sample_buffer.selection_start
local range=renoise.song().selected_sample.sample_buffer.selection_range
midiValues(1, renoise.song().selected_sample.sample_buffer.number_of_frames, renoise.song().selected_sample.sample_buffer, 'selection_end', message.int_value)
end
end}
----------
-- List of available automation curve functions
local automation_curves = {
"apply_constant_automation_bottom_to_bottom", -- 0 to 0
"apply_selection_up_linear", -- line 0..1
"apply_exponential_automation_curveUP", -- curve 0..1
"apply_constant_automation_top_to_top", -- 1 to 1
"apply_selection_down_linear", -- line 1..0
"apply_exponential_automation_curveDOWN", -- exp 1..0
"apply_constant_automation_bottom_to_bottom", -- 0 to 0
}
-- Function to apply the selected automation curve based on index
function apply_automation_curve_by_index(index, curves)
local curve_function_name = curves[index]
if curve_function_name and _G[curve_function_name] then
_G[curve_function_name]()
end
end
renoise.tool():add_midi_mapping{name="Track Automation:Paketti:Midi Automation Curve Draw Selection x[Knob]",
invoke=function(message)
if message:is_abs_value() then
local selected_parameter = renoise.song().selected_automation_parameter
local curves_to_use = automation_curves
local num_curves = #automation_curves
-- Check if the selected automation parameter is PitchBend, Pitch, or Panning
if selected_parameter and (
selected_parameter.name == "PitchBend" or
selected_parameter.name == "Pitchbend" or
selected_parameter.name == "Pitch" or
selected_parameter.name == "Panning"
) then
-- Filter the curves for the specific parameter
curves_to_use = {
"set_to_center",
"center_up_linear", -- line center->up
"apply_exponential_automation_curve_center_to_top", -- curve center->up
"apply_constant_automation_top_to_top", -- max up
"up_center_linear", -- line up->center
"apply_exponential_automation_curve_top_to_center", -- curve up->center
"center_down_linear", -- line center->down
"apply_exponential_automation_curve_center_to_bottom", -- curve center->down
"apply_constant_automation_bottom_to_bottom", -- min bottom
"down_center_linear", -- line down->center
"apply_exponential_automation_curve_bottom_to_center", -- curve down->center
"set_to_center" -- set to center
}
num_curves = #curves_to_use
end
local step = 128 / num_curves
local index = math.floor(message.int_value / step) + 1
index = math.min(index, num_curves) -- Ensure the index is within bounds
apply_automation_curve_by_index(index, curves_to_use)
end
end
}
-- Define the function to set the automation point value based on MIDI input
function midiValuesAutomation(start_point, end_point, automation, property, value)
-- Convert MIDI value (0-127) to automation range (start_point to end_point)
local converted_value = start_point + (value / 127) * (end_point - start_point)
local selection_range = automation.selection_range
if property == 'selection_start' then
selection_range[1] = converted_value
if selection_range[2] < selection_range[1] then
selection_range[2] = selection_range[1]
end
elseif property == 'selection_end' then
selection_range[2] = converted_value
if selection_range[1] > selection_range[2] then
selection_range[1] = selection_range[2]
end
end
automation.selection_range = selection_range
end
-- MIDI mapping for changing the start point of the automation selection
renoise.tool():add_midi_mapping{name="Paketti:Midi Automation Selection 01 Start x[Knob]",
invoke=function(message)
if message:is_abs_value() then
local automation = renoise.song().selected_pattern_track:find_automation(renoise.song().selected_automation_parameter)
if automation then
local start_point = 1
local end_point = automation.length + 1
midiValuesAutomation(start_point, end_point, automation, 'selection_start', message.int_value)
end
end
end
}
-- MIDI mapping for changing the end point of the automation selection
renoise.tool():add_midi_mapping{name="Paketti:Midi Automation Selection 02 End x[Knob]",
invoke=function(message)
if message:is_abs_value() then
local automation = renoise.song().selected_pattern_track:find_automation(renoise.song().selected_automation_parameter)
if automation then
local start_point = 1
local end_point = automation.length + 1
midiValuesAutomation(start_point, end_point, automation, 'selection_end', message.int_value)
end
end
end
}
renoise.tool():add_midi_mapping{name="Paketti:Create New Instrument & Loop from Selection", invoke=function(message) if message:is_trigger() then create_new_instrument_from_selection() end end}
--------------
-- Global table to keep track of added MIDI mappings
local added_midi_mappings = {}
-- Function to map MIDI values to macro values
function map_midi_value_to_macro(macro_index, midi_value)
-- Ensure renoise.song() is available
if not pcall(renoise.song) then
renoise.app():show_status("No song is currently loaded.")
return
end
-- Ensure the macro index is within the valid range (1 to 8)
if macro_index < 1 or macro_index > 8 then
renoise.app():show_status("Macro index must be between 1 and 8")
return
end
-- Ensure the MIDI value is within the valid range (0 to 127)
if midi_value < 0 or midi_value > 127 then
renoise.app():show_status("MIDI value must be between 0 and 127")
return
end
-- Convert the MIDI value to a range of 0 to 1
local macro_value = midi_value / 127
-- Set the value of the specified macro
renoise.song().selected_instrument.macros[macro_index].value = macro_value
end
-- Static MIDI mappings for each of the 8 macros
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 1 (PitchBend)", invoke=function(midi_message) map_midi_value_to_macro(1, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 2 (Cutoff)", invoke=function(midi_message) map_midi_value_to_macro(2, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 3 (Resonance)", invoke=function(midi_message) map_midi_value_to_macro(3, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 4 (Cutoff LfoAmp)", invoke=function(midi_message) map_midi_value_to_macro(4, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 5 (Cutoff LfoFreq)", invoke=function(midi_message) map_midi_value_to_macro(5, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 6 (Overdrive)", invoke=function(midi_message) map_midi_value_to_macro(6, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 7 (ParallelCompression)", invoke=function(midi_message) map_midi_value_to_macro(7, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 8 (Glide Inertia)", invoke=function(midi_message) map_midi_value_to_macro(8, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 1 (2nd) (PitchBend)", invoke=function(midi_message) map_midi_value_to_macro(1, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 2 (2nd) (Cutoff)", invoke=function(midi_message) map_midi_value_to_macro(2, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 3 (2nd) (Resonance)", invoke=function(midi_message) map_midi_value_to_macro(3, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 4 (2nd) (Cutoff LfoAmp)", invoke=function(midi_message) map_midi_value_to_macro(4, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 5 (2nd) (Cutoff LfoFreq)", invoke=function(midi_message) map_midi_value_to_macro(5, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 6 (2nd) (Overdrive)", invoke=function(midi_message) map_midi_value_to_macro(6, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 7 (2nd) (ParallelCompression)", invoke=function(midi_message) map_midi_value_to_macro(7, midi_message.int_value) end}
renoise.tool():add_midi_mapping{name="Paketti:Midi Selected Instrument Macro 8 (2nd) (Glide Inertia)", invoke=function(midi_message) map_midi_value_to_macro(8, midi_message.int_value) end}
----------------
-- Script to map MIDI values to sample modulation set filter types in Renoise
-- Ensure this script is named 'Paketti_Midi_Change_Sample_Modulation_Set_Filter.lua'
-- Define a function to change the sample modulation set filter type based on MIDI value
function change_sample_modulation_set_filter(midi_value)
-- Get the current song
local song = renoise.song()
-- Check if a sample and modulation set are selected
if song.selected_sample and song.selected_sample_modulation_set then
-- Get the available filter types
local filter_types = song.selected_sample_modulation_set.available_filter_types
-- Calculate the index in the filter types list based on the MIDI value
local index = math.floor((midi_value / 127) * (#filter_types - 1)) + 1
-- Set the filter type
song.selected_sample_modulation_set.filter_type = filter_types[index]
-- Show status message with the selected filter type
renoise.app():show_status("Selected Filter Type: " .. filter_types[index])
else
-- Show status message if no sample or modulation set is selected
renoise.app():show_status("No sample or modulation set selected")
end
end
-- Add MIDI mapping for the function
renoise.tool():add_midi_mapping{name="Paketti:Midi Change Sample Modulation Set Filter",invoke=function(message)
-- Call the function with the MIDI value
change_sample_modulation_set_filter(message.int_value)
end}
---------
function midiprogram(change)
local midi=renoise.song().selected_instrument.midi_output_properties
local currentprg=midi.program
currentprg = math.max(0, math.min(128, currentprg + change))
rprint (currentprg)
renoise.song().selected_instrument.midi_output_properties.program = currentprg
renoise.song().transport:panic()
end
renoise.tool():add_keybinding{name="Global:Paketti:Selected Instrument Midi Program +1 (Next)", invoke=function() midiprogram(1) end}
renoise.tool():add_keybinding{name="Global:Paketti:Selected Instrument Midi Program -1 (Previous)", invoke=function() midiprogram(-1) end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Instrument Midi Program +1 (Next)", invoke=function(message) if message:is_trigger() then midiprogram(1) end end}
renoise.tool():add_midi_mapping{name="Paketti:Selected Instrument Midi Program -1 (Previous)", invoke=function(message) if message:is_trigger() then midiprogram(-1) end end}
-----------
function pakettiMidiValuesColumn(minValue, maxValue, note_column_index, propertyName, midiInput)
local scaledValue = pakettiScaleValuesColumn(midiInput, 0, 127, minValue, maxValue)
local song = renoise.song()
local selection = song.selection_in_pattern
-- Handle cases where no note column is selected
if renoise.song().selected_note_column_index == nil or renoise.song().selected_note_column_index == 0 then
note_column_index = 1
end
if selection then
-- Loop through the selected tracks
for track_idx = selection.start_track, selection.end_track do
local track = song:track(track_idx)
-- Skip group, send, or master tracks (track types 2, 3, 4)
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
local visible_note_columns = track.visible_note_columns or 0 -- Handle cases with 0 or no note columns
-- Only process if the track has visible note columns
if visible_note_columns > 0 then
-- Loop through the selected lines
for line = selection.start_line, selection.end_line do
local line_data = song:pattern(song.selected_pattern_index):track(track_idx):line(line)
-- Determine the column range for this track
local start_column = (track_idx == selection.start_track) and selection.start_column or 1
local end_column = (track_idx == selection.end_track) and selection.end_column or visible_note_columns
-- Modify the note columns in the selected range
for col_idx = start_column, end_column do
if col_idx <= visible_note_columns then
local note_col = line_data.note_columns[col_idx]
if note_col then
note_col[propertyName] = math.floor(math.max(minValue, math.min(scaledValue, maxValue)))
end
end
end
end
end
end
end
else
-- Single-line modification if no selection
local track = song:track(song.selected_track_index)
-- Skip group, send, or master tracks
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
if track.visible_note_columns and track.visible_note_columns > 0 then
local note_col = song.selected_line.note_columns[note_column_index]
if note_col then
note_col[propertyName] = math.floor(math.max(minValue, math.min(scaledValue, maxValue)))
end
end
end
end
end
-- Scales an input value from a given input range to a specified output range
function pakettiScaleValuesColumn(input, inputMin, inputMax, outputMin, outputMax)
local scale = (outputMax - outputMin) / (inputMax - inputMin)
local output = (input - inputMin) * scale + outputMin
return output
end
-- Volume Column MIDI Mapping
renoise.tool():add_midi_mapping{name="Paketti:Midi Change 01 Volume Column Value x[Knob]", invoke=function(message)
if message:is_abs_value() then
local song = renoise.song()
local selection = song.selection_in_pattern
-- Check if there's an active selection in the pattern
if selection then
-- Iterate over all tracks in the selection
for track_idx = selection.start_track, selection.end_track do
local track = song:track(track_idx)
-- Set the volume column visible if the track is a sequencer track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.volume_column_visible = true
end
end
else
-- If no selection, apply to the currently selected track
local track = song.selected_track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.volume_column_visible = true
end
end
-- Apply the volume value change using the pakettiMidiValuesColumn function
pakettiMidiValuesColumn(0, 128, song.selected_note_column_index, 'volume_value', message.int_value)
end
end}
-- Panning Column MIDI Mapping
renoise.tool():add_midi_mapping{name="Paketti:Midi Change 02 Panning Column Value x[Knob]", invoke=function(message)
if message:is_abs_value() then
local song = renoise.song()
local selection = song.selection_in_pattern
-- Check if there's an active selection in the pattern
if selection then
-- Iterate over all tracks in the selection
for track_idx = selection.start_track, selection.end_track do
local track = song:track(track_idx)
-- Set the panning column visible if the track is a sequencer track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.panning_column_visible = true
end
end
else
-- If no selection, apply to the currently selected track
local track = song.selected_track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.panning_column_visible = true
end
end
-- Apply the panning value change using the pakettiMidiValuesColumn function
pakettiMidiValuesColumn(0, 128, song.selected_note_column_index, 'panning_value', message.int_value)
end
end}
-- Delay Column MIDI Mapping
renoise.tool():add_midi_mapping{name="Paketti:Midi Change 03 Delay Column Value x[Knob]", invoke=function(message)
if message:is_abs_value() then
local song = renoise.song()
local selection = song.selection_in_pattern
-- Check if there's an active selection in the pattern
if selection then
-- Iterate over all tracks in the selection
for track_idx = selection.start_track, selection.end_track do
local track = song:track(track_idx)
-- Set the delay column visible if the track is a sequencer track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.delay_column_visible = true
end
end
else
-- If no selection, apply to the currently selected track
local track = song.selected_track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.delay_column_visible = true
end
end
-- Apply the delay value change using the pakettiMidiValuesColumn function
pakettiMidiValuesColumn(0, 255, song.selected_note_column_index, 'delay_value', message.int_value)
end
end}
-- Sample FX Column MIDI Mapping
renoise.tool():add_midi_mapping{name="Paketti:Midi Change 04 Sample FX Column Value x[Knob]", invoke=function(message)
if message:is_abs_value() then
local song = renoise.song()
local selection = song.selection_in_pattern
-- Check if there's an active selection in the pattern
if selection then
-- Iterate over all tracks in the selection
for track_idx = selection.start_track, selection.end_track do
local track = song:track(track_idx)
-- Set the sample effects column visible if the track is a sequencer track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.sample_effects_column_visible = true
end
end
else
-- If no selection, apply to the currently selected track
local track = song.selected_track
if track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
track.sample_effects_column_visible = true
end
end
-- Apply the sample FX value change using the pakettiMidiValuesColumn function
pakettiMidiValuesColumn(0, 255, song.selected_note_column_index, 'effect_amount_value', message.int_value)
end
end}
-- Function to process MIDI values and set the appropriate property
function pakettiMidiValuesEffectColumn(minValue, maxValue, effect_column_index, propertyName, midiInput)
local scaledValue = pakettiScaleValuesColumn(midiInput, 0, 127, minValue, maxValue)
local song = renoise.song()
local selection = song.selection_in_pattern
if selection then
for track_idx = selection.start_track, selection.end_track do
local track = song:track(track_idx)
local visible_note_columns = track.visible_note_columns or 0 -- Handle cases where note columns might be 0 or nil
local visible_effect_columns = track.visible_effect_columns
local total_visible_columns = visible_note_columns + visible_effect_columns
-- For each line within the selected range
for line = selection.start_line, selection.end_line do
local line_data = song:pattern(song.selected_pattern_index):track(track_idx):line(line)
-- Determine the column range based on track index
local start_column = (track_idx == selection.start_track) and selection.start_column or 1
local end_column = (track_idx == selection.end_track) and selection.end_column or total_visible_columns
-- Adjust the selected columns to match the effect columns in this track
for col_idx = start_column, end_column do
if col_idx > visible_note_columns then
local effect_col_idx = col_idx - visible_note_columns
if effect_col_idx <= visible_effect_columns then
-- Modify the effect column
local effect_column = line_data.effect_columns[effect_col_idx]
if effect_column then
effect_column[propertyName] = math.floor(math.max(minValue, math.min(scaledValue, maxValue)))
end
end
end
end
end
end
else
-- Handle single-line modification if no selection is available
if renoise.song().selected_effect_column_index ~= 0 then
local effect_col_idx = renoise.song().selected_effect_column_index
local effect_column = song.selected_line.effect_columns[effect_col_idx]
if effect_column then
effect_column[propertyName] = math.floor(math.max(minValue, math.min(scaledValue, maxValue)))
end
else
local effect_column = song.selected_line.effect_columns[1]
if effect_column then
effect_column[propertyName] = math.floor(math.max(minValue, math.min(scaledValue, maxValue)))
end
end
end
end
-- Scales an input value from a given input range to a specified output range
function pakettiScaleValuesEffectColumn(input, inputMin, inputMax, outputMin, outputMax)
local scale = (outputMax - outputMin) / (inputMax - inputMin)
local output = (input - inputMin) * scale + outputMin
return output
end
renoise.tool():add_midi_mapping{name="Paketti:Midi Change 05 Effect Column Value x[Knob]",invoke=function(message)
if message:is_abs_value() then
if renoise.song().selected_track.visible_effect_columns == 0 then
renoise.song().selected_track.visible_effect_columns = 1 end
pakettiMidiValuesEffectColumn(0, 255, 1, 'amount_value', message.int_value)
end
end}
--------
-- Function to double the edit step
function PakettiEditStepDouble()
local transport = renoise.song().transport
local current_step = transport.edit_step
if current_step == 0 then
current_step = 1
else
current_step = current_step * 2
end
transport.edit_step = math.min(current_step, 64)
renoise.app():show_status("EditStep doubled to " .. transport.edit_step)
end
-- Function to halve the edit step
function PakettiEditStepHalve()
local transport = renoise.song().transport
local current_step = transport.edit_step
if current_step > 1 then
current_step = math.floor(current_step / 2)
end
transport.edit_step = current_step
renoise.app():show_status("EditStep halved to " .. transport.edit_step)
end
-- Adding the MIDI mappings
renoise.tool():add_midi_mapping{name="Paketti:EditStep Double x[Button]",invoke=function(message) if message:is_trigger() then PakettiEditStepDouble() end end}
renoise.tool():add_midi_mapping{name="Paketti:EditStep Halve x[Button]",invoke=function(message) if message:is_trigger() then PakettiEditStepHalve() end end}
------
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Left by 10",invoke=function(message) if message:is_trigger() then move_slice_start_left_10() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Right by 10",invoke=function(message) if message:is_trigger() then move_slice_start_right_10() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Left by 10",invoke=function(message) if message:is_trigger() then move_slice_end_left_10() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Right by 10",invoke=function(message) if message:is_trigger() then move_slice_end_right_10() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Left by 100",invoke=function(message) if message:is_trigger() then move_slice_start_left_100() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Right by 100",invoke=function(message) if message:is_trigger() then move_slice_start_right_100() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Left by 100",invoke=function(message) if message:is_trigger() then move_slice_end_left_100() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Right by 100",invoke=function(message) if message:is_trigger() then move_slice_end_right_100() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Left by 300",invoke=function(message) if message:is_trigger() then move_slice_start_left_300() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Right by 300",invoke=function(message) if message:is_trigger() then move_slice_start_right_300() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Left by 300",invoke=function(message) if message:is_trigger() then move_slice_end_left_300() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Right by 300",invoke=function(message) if message:is_trigger() then move_slice_end_right_300() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Left by 500",invoke=function(message) if message:is_trigger() then move_slice_start_left_500() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice Start Right by 500",invoke=function(message) if message:is_trigger() then move_slice_start_right_500() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Left by 500",invoke=function(message) if message:is_trigger() then move_slice_end_left_500() end end}
renoise.tool():add_midi_mapping{name="Sample Editor:Paketti:Move Slice End Right by 500",invoke=function(message) if message:is_trigger() then move_slice_end_right_500() end end}
----------------
renoise.tool():add_midi_mapping{name="Paketti:Set Beatsync Value x[Knob]",invoke=function(message)
if message:is_abs_value() then
if renoise.song().selected_instrument ~= nil and renoise.song().selected_sample ~= nil then
renoise.song().selected_sample.beat_sync_enabled=true
midiValues(1, 128, renoise.song().selected_sample, 'beat_sync_lines', message.int_value)
else renoise.app():show_status("There is no Instrument and no Sample.") end
end
end}
---
function PakettiMidiSendBang(number)
local selected_track = renoise.song().selected_track
local send_devices = {}
-- Collect indices of all send devices on the track
for i = 1, #selected_track.devices do
local device = selected_track.devices[i]
if device.device_path == "Audio/Effects/Native/#Send" or
device.device_path == "Audio/Effects/Native/#Multiband Send" then
table.insert(send_devices, i)
end
end
-- Check if there are any send devices
if #send_devices == 0 then
renoise.app():show_status("No send tracks available.")
return
end