-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenoise-tools-docs-combined.lua
7197 lines (5521 loc) · 255 KB
/
renoise-tools-docs-combined.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
--[[============================================================================
Renoise Scripting Reference and HOWTOs - Introduction
============================================================================]]--
Welcome to the Renoise scripting Guide. In all the various "Documention" files,
we will give you an overview on how to write tools for Renoise; how to debug
them, what's possible to "script", what's not, and much more. Please read this
introduction carefully to get an idea on how to get started, and to avoid common
pitfalls and FAQs.
---
## -- Scripting Development Tools in Renoise
By default Renoise has all scripting utilities hidden; to keep things as easy as
possible for those who don't want to mess around with code. If you want to write
scripts, then the first thing you have to do is enable the hidden development
tools that are built into Renoise. This can be done by:
- Launching the Renoise executable with the argument "--scripting-dev"
- Opening Renoise's config.xml file from the preferences folder, and setting the
<ShowScriptingDevelopmentTools> property to "true". This way, you don't have
to pass the above mentioned argument every time you launch Renoise.
Enabling scripting will add a new main menu entry "Tools" (or add new
entries there if it already exists).
In the "Tools" menu you will find:
- **Reload All Tools:** This will force a reload of all installed and running
scripting tools. This can be handy when adding new tools by hand or when
changing them.
- **Scripting Console & Editor:** This is the main developing scripting tool.
It allows you to:
- Evaluate scripts or commands in realtime with a terminal (command-line)
- Watch any script's output (all "print"s and errors will be redirected here)
- Create, view and edit Lua, text, and XML files that will make up tools
for Renoise. More about this later...
- Show **Example Tools** that target script developers.
---
## -- What can be scripted, what can't? What's this scripting all about?
Right now (in this Renoise release), you can make use of scripts in the
following places:
- Run scripts and commands via a terminal in realtime using the
"Scripting Console & Editor".
- Create tools: Add new and custom functionality to Renoise. Tools are small
file bundles with Lua script(s) and a description file (manifest.xml) that
make use of the Renoise API. Tools can be distributed and installed via
drag and drop (by bundling them and hiding the code). This way, not only
developers can use scripts, but also users who don't want to mess around with
technical details. We'll describe these types bundles later on...
Some examples of what you can do with Renoise Tools:
- New context menu entries and keyboard shortcuts. Think "My Improved Pattern
Jump", "My Bypass all DSP Devices in Track", "My Generate Chip Sound
Sample" commands, and so on.
- Custom graphical user interface elements with the look and feel of Renoise
itself. Perfectly integrate your tools into Renoise, and make them easy to
use for other users.
- Manipulate Renoise's main window or song (patterns, tracks, instruments,
anything that makes up a song). Generate, filter, or process song data in
any way you can think of. E.g. for algorithmic composition, instrument
creation, automation, etc. The sky is the limit.
- Nibbles ;)
- MIDI controller scripting: Create bidirectional MIDI or OSC implementations
for any controller hardware:
For example, make your Launchpad or Monome behave exactly how you want them
to, and share your settings with others. Tools like these can be a simple auto
mapping of your MIDI controller, like plug & play support for Mackie Control,
Behringer MIDI Mixers, and so on.
To make this easier, Renoise offers a tool called "Duplex" which already has
support for several MIDI/OSC controllers. Duplex is a very flexible,
object-oriented approach to handling MIDI controllers in Renoise, and also
offers virtual UIs for the MIDI controllers that are supported by Duplex.
This way you can virtually test and use such controllers in Renoise without
even owning them. ;)
NB: You don't have to use Duplex to write MIDI/OSC controller scripts in
Renoise, but it is a nice (and supported) framework that makes this type of
development easier.
- Create, configure, or override Renoise's default MIDI/OSC bindings:
Renoise has a default set of MIDI mappings that can be assigned manually by
the user. These can be inherited, extended and tweaked to fit your needs.
Renoise also has a default OSC implementation which can tweaked and overriden
to do "your stuff."
What's _NOT_ possible with Renoise tools:
- Change Renoise's existing behaviour. Like, you can't make all C-4s in the
pattern editor yellow instead of white. You can write your own pattern
editor, but not change the existing one.
- Realtime access. Except for OSC and MIDI IO, you can't write scripts that
run in the audio player. In other words, you can not script new realtime
DSPs - yet. But you can, for example, write a tool that creates samples or
manipulates existing samples. This limitation might change in the future.
For now you can make a VST, AudioUnit, or LADSPA/DSSI plug-in.
---
## -- Renoise Lua API Overview
The XXX.API files in this documentation folder will list all available Lua
functions and classes that can be accessed from scripts in Renoise.
If you are familiar with Renoise, the names of the classes, functions and
properties should be self explanitory.
Here is a small overview of what the API exposes:
**Renoise.API**
Renoise API version number and some global accessors like "song", "app" are here.
**Renoise.Application.API**
Access to the main Renoise application and window, main user interface.
**Renoise.Song.API**
Access to the song and all its components (instruments, samples, tracks...)
**Renoise.Document.API**
Generic "observer pattern" document creation and access, used by the
song/app and to create persistent data (preferences, presets).
**Renoise.ScriptingTool.API**
Available to XRNX tools only: Interact with Renoise; create menus, keybindings.
**Renoise.Socket.API**
Inter-process and network communication functions and classes.
**Renoise.OSC.API**
Tools to generate and receive OSC messages, bundles over the network.
**Renoise.Midi.API**
"Raw" MIDI device interaction (send, receive MIDI messages from any devices.)
A note about the general API design:
- Whatever you do with the API, you should never be able to fatally crash
Renoise. If you manage to do this, then please file a bug report in our forums
so we can fix it. All errors, as stupid they might be, should always result in
a clean error message from Lua.
- The Renoise Lua API also allows global File IO and external program execution
(via os.execute()) which can obviously be hazardous. Please be careful with
these, as you would with programming in general...
Some notes about the documentation, and a couple of tips:
- All classes, functions in the API, are nested in the namespace (Lua table)
"renoise". E.g: to get the application object, you will have to type
"renoise.app()"
- The API is object-oriented, and thus split into classes. The references
will first note the class name (e.g. 'renoise.Application'), then list its
Constants, Properties, Functions and Operators.
All properties and functions are always listed with their full path to make
it clear where they belong and how to access them.
- Return values (or arguments / types of properties) are listed in brackets.
"-> [string]" means that a string is returned. When no brackets are listed,
the function will not return anything.
- Nearly all functions are actually "methods", so you have to invoke them
via the colon operator ":" E.g. 'renoise.app():show_status("Status Message")'
If you're new to Lua, this takes a while to get used to. Don't worry, it'll
make sense sooner or later. ;)
- Properties are syntactic sugar for get/set functions. "song().comments"
will invoke a function which returns "comments". But not all properties
have setters, and thus can only be used as read-only "getters". Those are
marked as "[read-only, type]".
Again mind the colon; which you don't need when accessing properties!
- All exposed "objects" are read-only (you can not add new fields, properties).
In contrast, the "classes" are not. This means you can extend the API classes
with your own helper functions, if needed, but can not add new properties to
objects. Objects, like for example the result of "song()", are read-only to
make it easier to catch typos. `song().transport.bmp = 80` will fire an error,
because there is no such property 'bmp.' You probably meant
`song().transport.bpm = 80` here. If you need to store data somewhere,
do it in your own tables, objects instead of using the Renoise API objects.
- "some_property, \_observable" means, that there is also an observer object
available for the property. An observable object allows you to attach
notifiers (global functions or methods) that will be called as soon as a
value has changed. Please see Renoise.Document.API for more info about
observables and related classes.
A small example using bpm:
renoise.song().transport.bpm_observable:add_notifier(function()
print("bpm changed")
end)
-- will print "bpm changed", but only if the bpm was not 120 before
renoise.song().transport.bpm = 120
The above notifier is called when anything changes the bpm, including your
script, other scripts, or anything else in Renoise (you've automated the
BPM in the song, entered a new BPM value in Renoise's GUI, whatever...)
Lists like "renoise.song().tracks[]" can also have notifiers. But these
will only fire when the list layout has changed: an element was added,
removed or elements in the list changed their order. They will not fire when
the list values changed. Attach notifiers to the list elements to get such
notifications.
- Can't remember what the name of function XYZ was? In the scripting terminal
you can list all methods/properties of API objects (or your own class objects)
via the global function `oprint(some_object)` - e.g. `oprint(renoise.song())`.
To dump the renoise module/class layout, use `rprint(renoise)`.
---
## -- Creating Renoise Tools
- Developing XRNX tools:
As previously mentioned, Renoise tools are file bundles with an XRNX
extension. Tools have the following layout:
- /some.bundle.id.xrnx/
- manifest.xml -> XML file with information about the tool (author, id...)
- main.lua -> entry point: loaded by Renoise to execute the tool
You can import other Lua files into "main.lua" via Lua's "require" function
if appropriate, and also include resource files (icons, bitmaps, text files,
or executables) into your bundles as needed.
For a detailed description of the bundle layout and the main.lua,
manifest.lua specifications, have a look at the "com.renoise.Example.xrnx"
tool please.
- Distributing XRNX tools:
To share your tools with others, you can create Zip files out of your
bundles, which can then simply be dragged and dropped into Renoise by the
user.
To do so, zip all the bundle's content (the !content!, not the bundle folder
itself), and rename this Zip file to "SomeName.xrnx". Renoise will accept such
XRNX zips as drag and drop targets, copy, install and activate the tool
automatically.
---
## -- MIDI Controller Scripting with Duplex
If you want to add support for your MIDI controller into Duplex, or help extend
the Duplex framework, have a look at the Duplex XRNX tool.
In the XRNX bundle you'll find some information about the Duplex API and
how to create new controller mappings.
The Duplex code can also be viewed online in the XRNX repository at:
<https://github.com/renoise/xrnx/tree/master/Tools/com.renoise.Duplex.xrnx>
More information can be found in Duplex manual, available here:
<https://github.com/renoise/xrnx/blob/master/Tools/com.renoise.Duplex.xrnx/Docs/GettingStarted.md>
---
## -- Debugging Renoise Scripts
If tracing/debugging in the console with print, oprint and rprint isn't enough,
you can try attaching a command-line based debugger to your scripts. Have a look
at the Debugging document for more information and a small tutorial.
-- Enjoy extending, customizing and automating Renoise ;)
--[[============================================================================
Renoise Script Debugging HowTo
============================================================================]]--
In addition to the usual print & trace stuff via the Renoise scripting console
(all 'print's will be dumped there), Renoise offers a simple command-line
debugger. This debugger can even be used to debug scripts remotely; scripts
running on other computers.
Please read the INTRODUCTION first to get an overview about the complete
API, and scripting for Renoise in general...
--==============================================================================
-- Remdebug
--==============================================================================
Remdebug is a command-line based remote debugger for Lua, which is included with
Renoise.
---
## -- Prerequisites
To use the debugger you will need:
- Renoise's "remdebug" module, which can be found in "Scripts/Libraries/remdebug"
(no installation required - included in Renoise)
- Lua support on your system's command-line with the Lua "socket" module
See http://w3.impa.br/~diego/software/luasocket/
---
## -- Overview
The debugger will be controlled via a command-line Lua interpreter, outside
of Renoise via the remdebug/controller.lua script. To start a local debug
session from within Renoise you can use the function "debug.start()":
-- Opens a debugger controller in a new terminal/cmd window and
-- attaches the debugger to this script. Immediately breaks execution.
debug.start()
You can add this anywhere in any script that runs in Renoise. This will
work in a tool's main.lua main() body, just like a local function that you
include. It also works in the TestPad.lua script that is used in Renoise's
Scripting Editor.
---
## -- Step By Step Guide
Let's debug the following small test script, paste into
RENOISE_PREFERENCES/Scripts/TestPad.lua:
debug.start()
local function sum(a, b)
return a + b
end
local c = sum(1, 2)
print(c)
debug.stop()
- Launch Renoise's scripting editor, open "TestPad.lua", and hit the "Execute"
button to run the script.
If Lua is correctly installed on your system, and remdebug was found, Renoise
should be frozen now, with a terminal window opened showing something like:
> "Lua Remote Debugger"
> "Paused at file RENOISE_PREFERENCES_FOLDER/Scripts/TestPad.lua line 5"
>
> 1 debug.start()
> 2
> 3 local function sum(a, b)
> 4 return a + b
> 5*** end
> 6
> 7 local c = sum(1, 2)
> 8 print(c)
> 9
> 10 debug.stop()
>
>>
- To step through the code, you can use the "s" and "n" commands in the terminal.
Let's do so by entering "s" (Return) until we've reached line 8. Anything you
type into the debugger, which is not a debugger command, will get evaluated in
your running script as an expression. So let's try this by entering: `c=99`
- Then step over the line by entering "n" (Return) to evaluate the "print(c)"
on line 9 in the script. You should see a "99" dumped out. To watch the value
again, enter for example a `print(c)`. You should again see a "99" dumped out.
You can also set break and watchpoints in the debugger. Type 'help' in the
terminal to get more info about this. Those who are familiar with gdb on the
command-line may be able to quickly get up to speed when using the most common
shortcuts (c,b,q, and so on...).
Please note that although "debug.stop()" is not necessary (you can
simply quit the controller at any time to exit), its recommended and will
be more comfortable when running a session over and over again.
---
## -- Remote and Lua Editor debugging
Renoise's remdebug is fully compatible with the original remdebug controller
from the kepler project. This means you can, in theory, also use debugger GUIs
that use the original remdebug, like Lua Eclipse or SciTE for Lua.
However, this is often a PITA to setup and configure, and might not be
worth the trouble. Try at your own risk...
The debugger can also be used to remote debug scripts, scripts running on other
computers. To do so, use remdebug.engine.start/stop instead of "debug".
debug.start/stop is just a shortcut to remdebug.session.start/stop.
"remdebug.engine.start" will only attach the debugger to your script and break
execution. You then have to run the debugger controller manually on another
computer. To do so, launch the remdebug.controller.lua file manually in a
terminal:
- First we start the debugger controller. To do so, open a command-line on your
system and invoke the remdebug/controller.lua script. You should see
something like:
lua RENOISE_RESOURCE_FOLDER/Scripts/Libraries/remdebug/controller.lua
"Lua Remote Debugger"
"Run the program you wish to debug with 'remdebug.engine.start()' now"
- Now you can connect to this controller by running a script with
`remdebug.engine.start()`, configured to find the controller on another
machine (or the same one.)
require "remdebug.engine"
-- default config is "localhost" on port 8171
remdebug.engine.configure { host = "some_host", port = 1234 }
remdebug.engine.start()
--==============================================================================
-- Autoreloading Tool Scripts
--==============================================================================
When working with Renoise's Scripting Editor, saving a script will
automatically reload the tool that belongs to the file. This way you can simply
change your files and immediately see/test the changes.
When changing any files that are part of the "Libraries" folder, all scripts
will get reloaded.
When working with an external text editor, you can enable the following debug
option somewhere in the tool's main.lua file:
_AUTO_RELOAD_DEBUG = function()
-- do tests like showing a dialog, prompts whatever, or simply do nothing
end
As soon as you save your script outside of Renoise, and then focus Renoise again
(alt-tab to Renoise, for example), your script will instantly get reloaded and
the notifier is called.
If you don't need a notifier to be called each time the script reloads, you
can also simply set \_AUTO_RELOAD_DEBUG to true:
_AUTO_RELOAD_DEBUG = true
--[[============================================================================
Renoise Scripting Editor And Terminal
============================================================================]]--
The built-in Script Editor and Terminal can be opened by clicking "Scripting
Terminal & Editor..." in the "Tools" menu. It allows you to:
- Create, view and edit Lua, text, and XML files.
- Evaluate scripts or commands in realtime using the Terminal.
- Watch any scripts output in the Terminal. For example:
all "print"s and errors from scripts will be redirected here
---
## -- Browser Shortcuts
Note: 'Command' below is the _Control_ key on Windows & Linux, _Command_ on OSX.
- 'Command + E' Switch to Editor
- 'Command + N' Create a new File
- 'Command + O' Open an existing File
- 'Command + T' Switch to Terminal
---
## -- Editor Shortcuts
- 'Command + A' Select all
- 'Command + B' Switch to Browser
- 'Command + C' Copy
- 'Command + D' Delete
- 'Command + E' Set Find string from current selection
- 'Command + F' Open Find Dialog
- 'Command + F3' Find Next under Cursor or Selection
- 'Command + F4' Close current tab
- 'Command + G' Find Next
- 'Command + H' Replace Next
- 'Command + L' Jump to Line
- 'Command + N' Create a new File
- 'Command + O' Open an existing File
- 'Command + P' Paste
- 'Command + R' Save and Run the current Tabs File
- 'Command + S' Save current File (Tool Scripts will automatically reload)
- 'Command + Shift + F4' Close all except current Tab
- 'Command + Shift + S' Save all open files
- 'Command + Shift + Tab' Switch to Previous Tab
- 'Command + Shift + W' Close all except current Tab
- 'Command + T' Switch to Terminal
- 'Command + Tab' Switch to Next Tab
- 'Command + W' Close current tab
- 'Command + X' Cut
- 'Command + Y' Redo ('Command + Shift + Z' on OSX, LINUX)
- 'Command + Z' Undo
- 'F3' Find Next
- 'Shift + Tab' Unindent Selection
- 'Tab' Indent Selection
---
## -- Terminal Shortcuts
- 'Arrow Down' Next Command
- 'Arrow Up' Previous Command
- 'Command + B' Switch to Browser
- 'Command + C' Copy Selection \_in Output
- 'Command + E' Switch to Editor
- 'Command + K' Clear Output
- 'Command + L' Clear Output
- 'Command + N' Create a new File
- 'Command + O' Open an existing File
---
## -- Tips & Tricks
- To enter multiple lines in the terminal, end a line with a \
The terminal will then prompt for another line until you hit enter twice
- `oprint(some_object)` prints out info about a Lua class object:
try for example `oprint(renoise.song())` to see all properties
and methods for song(). To list all available modules, try `rprint(renoise)`
or `rprint(_G)`
- Take a look at the example tools in the 'Resource Scripts' node on the
left for a detailed description of a tool script's layout
- If you just want to test out some code without writing a 'tool', create a new
script file in the 'Scripts' folder and not in the 'Scripts/Tools' folder.
Such Scripts can then be launched by hitting the 'Run Script' button or
via 'Command + R'. A default file called 'TestPad.lua' should already
be present which you can use for testing.
- The full Renoise API reference is included in the left tree view
as well, in case you want to lookup something without leaving Renoise
--[[============================================================================
Lua Standard Library and Extensions
============================================================================]]--
--[[
This is a reference for standard global Lua functions and tools that were
added/changed by Renoise.
All standard Lua libraries are included in Renoise as well. You can find the
full reference here: <http://www.lua.org/manual/5.1/manual.html#5>
Do not try to execute this file. It uses a .lua extension for markup only.
]]--
---
## -- globals
-------- Added
-- An iterator like ipairs, but in reverse order
-- > examples: t = {"a", "b", "c"}
-- > for k,v in ripairs(t) do print(k, v) end -> "3 c, 2 b, 1 a"
ripairs(table) -> [iterator function]
-- Return a string which lists properties and methods of class objects
objinfo(class_object) -> [string]
-- Recursively dumps a table and all its members to the std out (console)
rprint(table)
-- Dumps properties and methods of class objects (like renoise.app())
oprint(table)
-------- Changed
-- Also returns a class object's type name. For all other types the standard
-- Lua type function is used
-- > examples: class "MyClass"; function MyClass:\_\_init() end
-- > print(type(MyClass)) -> "MyClass class"
-- > print(type(MyClass())) -> "MyClass"
type(class_object or class or anything else) -> [string]
-- Also compares object identities of Renoise API class objects:
-- > examples:
-- > print(rawequal(renoise.app(), renoise.app())) --> true
-- > print(rawequal(renoise.song().track[1],
-- > renoise.song().track[1]) --> true
-- > print(rawequal(renoise.song().track[1],
-- > renoise.song().track[2]) --> false
rawequal(obj1, obj2) -> [boolean]
---
## -- debug
------- Added
-- Shortcut to remdebug.session.start(), which starts a debug session:
-- launches the debugger controller and breaks script execution. See
-- "Debugging.txt" in the documentation root folder for more info.
debug.start()
-- Shortcut to remdebug.session.stop: stops a running debug session
debug.stop()
---
## -- table
------- Added
-- Create a new, or convert an exiting table to an object that uses the global
-- 'table.XXX' functions as methods, just like strings in Lua do.
-- > examples: t = table.create(); t:insert("a"); rprint(t) -> [1] = a;
-- t = table.create{1,2,3}; print(t:concat("|")); -> "1|2|3";
table.create([t]) -> [table]
-- Returns true when the table is empty, else false and will also work
-- for non indexed tables
-- > examples: t = {}; print(table.is_empty(t)); -> true;
-- > t = {66}; print(table.is_empty(t)); -> false;
-- > t = {["a"] = 1}; print(table.is_empty(t)); -> false;
table.is_empty(t) -> [boolean]
-- Count the number of items of a table, also works for non index
-- based tables (using pairs).
-- > examples: t = {["a"]=1, ["b"]=1}; print(table.count(t)) -> 2
table.count(t) -> [number]
-- Find first match of 'value' in the given table, starting from element
-- number 'start_index'. Returns the first !key! that matches the value or nil
-- > examples: t = {"a", "b"}; table.find(t, "a") -> 1;
-- > t = {a=1, b=2}; table.find(t, 2) -> "b"
-- > t = {"a", "b", "a"}; table.find(t, "a", 2) -> "3"
-- > t = {"a", "b"}; table.find(t, "c") -> nil
table.find(t, value [,start_index]) -> [key or nil]
-- Return an indexed table of all keys that are used in the table
-- > examples: t = {a="aa", b="bb"}; rprint(table.keys(t)); -> "a", "b"
-- > t = {"a", "b"}; rprint(table.keys(t)); -> 1, 2
table.keys(t) -> [table]
-- Return an indexed table of all values that are used in the table
-- > examples: t = {a="aa", b="bb"}; rprint(table.values(t)); -> "aa", "bb"
-- > t = {"a", "b"}; rprint(table.values(t)); -> "a", "b"
table.values(t) -> [table]
-- Copy the metatable and all first level elements of the given table into a
-- new table. Use table.rcopy to do a recursive copy of all elements
table.copy(t) -> [table]
-- Deeply copy the metatable and all elements of the given table recursively
-- into a new table - create a clone with unique references.
table.rcopy(t) -> [table]
-- Recursively clears and removes all table elements
table.clear(t)
---
## -- os
------- Added
-- Returns the platform the script is running on:
-- "WINDOWS", "MACINTOSH" or "LINUX"
os.platform() -> [string]
-- Returns the current working dir. Will always be the scripts directory
-- when executing a script from a file
os.currentdir() -> [string]
-- Returns a list of directory names (names, not full paths) for the given
-- parent directory. Passed directory must be valid, or an error will be thrown.
os.dirnames(path) -> [table of strings]
-- Returns a list file names (names, not full paths) for the given
-- parent directory. Second optional argument is a list of file extensions that
-- should be searched for, like {"_.wav", "_.txt"}. By default all files are
-- matched. The passed directory must be valid, or an error will be thrown.
os.filenames(path [, {file_extensions}]) -> [table of strings]
-- Creates a new directory. mkdir can only create one new sub directory at the
-- same time. If you need to create more than one sub dir, call mkdir multiple
-- times. Returns true if the operation was successful; in case of error, it
-- returns nil plus an error string.
os.mkdir(path) -> [boolean, error_string or nil]
-- Moves a file or a directory from path 'src' to 'dest'. Unlike 'os.rename'
-- this also supports moving a file from one file system to another one. Returns
-- true if the operation was successful; in case of error, it returns nil plus
-- an error string.
os.move(src, dest) -> [boolean, error_string or nil]
------- Changed
-- Replaced with a temp directory and name which renoise will clean up on exit
-- extension will be ".tmp" when not specified
os.tmpname([extension]) -> [string]
-- Replaced with a high precision timer (still expressed in milliseconds)
os.clock() -> [number]
-- Will not exit, but fire an error that os.exit() can not be called
os.exit()
---
## -- io
------- Added
-- Returns true when a file, folder or link at the given path and name exists
io.exists(filename) -> [boolean]
-- Returns a table with status info about the file, folder or link at the given
-- path and name, else nil the error and the error code is returned.
--
-- The returned valid stat table contains the following fields:
--
-- + dev, (number): device number of filesystem
-- + ino, (number): inode number
-- + mode, (number): unix styled file permissions
-- + type, (string): type ("file", "directory", "link", "socket",
-- "named pipe", "char device" or "block device")
-- + nlink, (number): number of (hard) links to the file
-- + uid, (number): numeric user ID of file's owner
-- + gid, (number): numeric group ID of file's owner
-- + rdev, (number): the device identifier (special files only)
-- + size, (number): total size of file, in bytes
-- + atime, (number): last access time in seconds since the epoch
-- + mtime, (number): last modify time in seconds since the epoch
-- + ctime, (number): inode change time (NOT creation time!) in seconds
io.stat(filename) -> [table or (nil, error, error no)]
-- Change permissions of a file, folder or link. mode is a unix permission
-- styled octal number (like 755 - WITHOUT a leading octal 0). Executable,
-- group and others flags are ignored on windows and won't fire errors
io.chmod(filename, mode) -> [true or (nil, error, error no)]
------- Changed
-- All io functions use UTF8 as encoding for the file names and paths. UTF8
-- is used for LUA in the whole API as default string encoding...
---
## -- math
------- Added
-- Converts a linear value to a db value. db values will be clipped to
-- math.infdb
-- > example: print(math.lin2db(1.0)) -> 0
-- > print(math.lin2db(0.0)) -> -200 (math.infdb)
math.lin2db(number) -> [number]
-- Converts a dB value to a linear value
-- > example: print(math.db2lin(math.infdb)) -> 0
-- > print(math.db2lin(6.0)) -> 1.9952623149689
math.db2lin(number) -> [number]
-- Converts a dB value to a normalized linear fader value between 0-1 within
-- the given dB range.
-- > example: print(math.db2fader(-96, 0, 1)) -> 0
-- > print(math.db2fader(-48, 6, 0)) -> 0.73879611492157
math.db2fader(min_dB, max_dB, dB_to_convert)
-- Converts a normalized linear mixer fader value to a db value within
-- the given dB range.
-- > example: print(math.fader2db(-96, 0, 1)) -> 0
-- > print(math.fader2db(-96, 0, 0)) -> -96
math.fader2db(min_dB, max_dB, fader_value)
-- db values at and below this value will be treated as silent (linearly 0)
math.infdb -> [-200]
---
## -- bit (added)
-- Integer, Bit Operations, provided by <http://bitop.luajit.org/>
-- Take a look at <http://bitop.luajit.org/api.html> for the complete reference
-- and examples please...
-- Normalizes a number to the numeric range for bit operations and returns it.
-- This function is usually not needed since all bit operations already
-- normalize all of their input arguments.
bit.tobit(x) -> [number]
-- Converts its first argument to a hex string. The number of hex digits is
-- given by the absolute value of the optional second argument. Positive
-- numbers between 1 and 8 generate lowercase hex digits. Negative numbers
-- generate uppercase hex digits. Only the least-significant 4\*|n| bits are
-- used. The default is to generate 8 lowercase hex digits.
bit.tohex(x [,n]) -> [string]
-- Returns the bitwise not of its argument.
bit.bnot(x) -> [number]
-- Returns either the bitwise or, bitwise and, or bitwise xor of all of its
-- arguments. Note that more than two arguments are allowed.
bit.bor(x1 [,x2...]) -> [number]
bit.band(x1 [,x2...]) -> [number]
bit.bxor(x1 [,x2...]) -> [number]
-- Returns either the bitwise logical left-shift, bitwise logical right-shift,
-- or bitwise arithmetic right-shift of its first argument by the number of
-- bits given by the second argument.
bit.lshift(x, n) -> [number]
bit.rshift(x, n) -> [number]
bit.arshift(x, n) -> [number]
-- Returns either the bitwise left rotation, or bitwise right rotation of its
-- first argument by the number of bits given by the second argument. Bits
-- shifted out on one side are shifted back in on the other side.
bit.rol(x, n) -> [number]
bit.ror(x, n) -> [number]
-- Swaps the bytes of its argument and returns it. This can be used to convert
-- little-endian 32 bit numbers to big-endian 32 bit numbers or vice versa.
bit.bswap(x) -> [number]
--[[============================================================================
Renoise Application API Reference
============================================================================]]--
--[[
This reference lists the content of the main "renoise" namespace. All Renoise
related functions and classes are nested in this namespace.
Please read the INTRODUCTION first to get an overview about the complete
API, and scripting for Renoise in general...
Do not try to execute this file. It uses a .lua extension for markup only.
]]--
---
## -- renoise
-------- Constants
-- Currently 6.1. Any changes in the API which are not backwards compatible,
-- will increase the internal API's major version number (e.g. from 1.4 -> 2.0).
-- All other backwards compatible changes, like new functionality, new functions
-- and classes which do not break existing scripts, will increase only the minor
-- version number (e.g. 1.0 -> 1.1).
renoise.API_VERSION -> [number]
-- Renoise Version "Major.Minor.Revision[ AlphaBetaRcVersion][ demo]"
renoise.RENOISE_VERSION -> [string]
-------- Functions
renoise.app() -> [renoise.Application object]
renoise.song() -> [renoise.Song object]
renoise.tool() -> [renoise.ScriptingTool object]
-- Not much else going on here...
-- for renoise.Application, see Renoise.Application.API,
-- for renoise.Song, see Renoise.Song.API,
-- for renoise.ScriptingTool, see Renoise.ScriptingTool.API,
-- and so on.
--[[============================================================================
Renoise Application API Reference
============================================================================]]--
--[[
This reference lists all available Lua functions and classes that control
the Renoise application. The Application is the Lua interface to Renoise's main
GUI and window (Application and ApplicationWindow).
Please read the INTRODUCTION first to get an overview about the complete
API, and scripting for Renoise in general...
Do not try to execute this file. It uses a .lua extension for markup only.
]]--
---
## -- renoise
-------- Functions
renoise.app()
-> [renoise.Application object]
---
## -- renoise.Application
-------- Functions
-- Shows an info message dialog to the user.
renoise.app():show_message(message)
-- Shows an error dialog to the user.
renoise.app():show_error(message)
-- Shows a warning dialog to the user.
renoise.app():show_warning(message)
-- Shows a message in Renoise's status bar to the user.
renoise.app():show_status(message)
-- Opens a modal dialog with a title, text and custom button labels.
renoise.app():show_prompt(title, message, {button_labels})
-> [pressed_button_label]
-- Opens a modal dialog with a title, custom content and custom button labels.
-- See Renoise.ViewBuilder.API for more info. key_handler is an optional
-- notifier function for keyboard events in the dialog. key_handler_options is
-- an optional table with the fields
-- { "send_key_repeat": true/false, "send_key_release": true/false }
-- when not specified, "send_key_repeat" = true and "send_key_release" = false
renoise.app():show_custom_prompt(title, content_view,
{button_labels} [, key_handler, key_handler_options])
-> [pressed_button_label]
-- Shows a non modal dialog (a floating tool window) with custom content.
-- Again see Renoise.ViewBuilder.API for more info about custom views.
-- key_handler is an optional notifier function for keyboard events that are
-- received by the dialog. key_handler_options is an optional table with the
-- fields { "send_key_repeat": true/false, "send_key_release": true/false }
renoise.app():show_custom_dialog(title, content_view
[, key_handler, key_handler_options])
-> [renoise.Dialog object]
-- Opens a modal dialog to query an existing directory from the user.
renoise.app():prompt_for_path(dialog_title)
-> [valid path or empty string]
-- Opens a modal dialog to query a filename and path to read from a file.
-- The given extension(s) should be something like {"wav", "aiff"
-- or "\*" (any file) }
renoise.app():prompt_for_filename_to_read({file_extensions}, dialog_title)
-> [filename or empty string]
-- Same as 'prompt_for_filename_to_read' but allows the user to select
-- more than one file.
renoise.app():prompt_for_multiple_filenames_to_read({file_extensions}, dialog_title)
-> [list of filenames or empty list]
-- Open a modal dialog to get a filename and path for writing.
-- When an existing file is selected, the dialog will ask whether or not to
-- overwrite it, so you don't have to take care of this on your own.
renoise.app():prompt_for_filename_to_write(file_extension, dialog_title)
-> [filename or empty string]
-- Opens the default internet browser with the given URL. The URL can also be
-- a file that browsers can open (like xml, html files...).
renoise.app():open_url(url)
-- Opens the default file browser (explorer, finder...) with the given path.
renoise.app():open_path(file_path)
-- Install, update or uninstall a tool. Any errors are shown to the user
-- during (un)installation. Installing an already existing tool will upgrade
-- the tool without confirmation. Upgraded tools will automatically be
-- re-enabled, if necessary.
renoise.app().install_tool(file_path_to_xrnx)
renoise.app().uninstall_tool(file_path_to_xrnx)
-- Create a new song document (will ask the user to save changes if needed).
-- The song is not created immediately, but soon after the call was made and
-- the user did not aborted the operation. In order to continue execution
-- with the new song, attach a notifier to 'app_new_document_observable'
-- See renoise.ScriptingTool.API.lua for more info.
renoise.app():new_song()
renoise.app():new_song_no_template()
-- Load a new song document from the given filename (will ask to save
-- changes if needed, any errors are shown to the user).
-- Just like new_song(), the song is not loaded immediately, but soon after
-- the call was made. See 'renoise.app():new_song()' for details.
renoise.app():load_song(filename)
-- Load a file into the currently selected components (selected instrument,
-- track, sampl, ...) of the song. If no component is selected it will be
-- created when possible. Any errors during the export are shown to the user.
-- returns success.
renoise.app():load_track_device_chain(filename)
-> [boolean]
renoise.app():load_track_device_preset(filename)