While this doesn’t answer the question about the code, if you haven’t already you can install a tool called “paketti” which adds the possibility to assign keyboard shortcuts to change the sample loop mode. This at least makes the process quite a bit faster compared to using a mouse to change the mode.
I will try this! I hope it works, because that waveform generator does some wicked FM/PM stuff that none of the others do. I contacted @It-Alien, maybe I’ll get a hint of what could be fixed/updated to create such a thing, maybe Paketti will do it. I’ll try right now.
Edit: Yep, does make the sample loop adjustment quicker! That being said, there is no way to hear a semi-live update of parameter changes, which I believe could be done if the loop was on constantly. I hope there’s a solution. If the MilkyWaves generator can do it, I believe this could also be applied to the Custom Wave Generator. The world may never know…
Perfect, thank you so much 
Now I can make all sorts of gonzo waveforms, this is incredible. With all the FM/PM going on in here. WOWEEEEE!!!
Ahhhh… crashed the Tool:
std::logic_error: ‘add notifier: the given function was already registered to this notifier.’
stack traceback:
[C]: in function ‘add_notifier’
./gui.lua:40: in function <./gui.lua:34>
yes, when i use in op2 type Morpher or wave then crash.
./operators.lua:137: attempt to index local 'buffer' (a number value)
stack traceback:
./operators.lua:137: in function '?'
main.lua:326: in function 'operate'
main.lua:431: in function 'process_data'
main.lua:528: in function 'generate'
./gui.lua:572: in function <./gui.lua:569>
or
./operators.lua:27: attempt to index local 'arr_real_sources' (a number value)
stack traceback:
./operators.lua:27: in function '?'
main.lua:326: in function 'operate'
main.lua:431: in function 'process_data'
main.lua:528: in function 'generate'
./gui.lua:572: in function <./gui.lua:569>
Probably buggy under 3.4.
Can you post an example xrns that will crash this? My attempts to replicate all seem to work fine. No crashing
Oh, I did manage a different error : )
'C:\Users\james\AppData\Roaming\Renoise\V3.4.0\Scripts\Tools\com.renoise.CustomWave.xrnx\main.lua' failed in one of its notifiers.
Please contact the author (Fabio Napodano | It-Alien (it-alien@renoise.com)) for assistance...
std::logic_error: 'trying to access a nil object of type 'class Sample'. the object is not or no longer available.'
stack traceback:
[C]: ?
[C]: in function '__index'
[string "do..."]:37: in function <[string "do..."]:35>
.\operators.lua:137: in function '?'
main.lua:326: in function 'operate'
main.lua:444: in function 'process_data'
main.lua:528: in function 'generate'
.\gui.lua:572: in function <.\gui.lua:569>
[C]: ?
[C]: in function '__newindex'
[string "do..."]:22: in function <[string "do..."]:9>
.\gui.lua:121: in function 'change_tab'
.\gui.lua:987: in function 'show_dialog'
main.lua:120: in function <main.lua:120>
This is after I was successful in creating a wav, and then going back to edit it. It crashes, and it seems the sample that was there vanishes.
I wish there were decent debugging tools for these sorts of things besides println and stuff.
I will try again - the Morpher waveform is where it happened for me and for @martblek. For me, it first just went silent and would no longer generate sound, although I could get the waveform to show up and change.
I wasn’t able to crash it this time, but I do notice that the portion of the menu that the Morpher has - “Mod. Amplitude of” keeps resetting to “None”. May be part of the issue as well. Here’s an image and a file.

Custom Wave Generator Hack-Test.xrns (8.6 KB)
and another:
No matching overload found, candidates:
void (Slider*,custom [double])
stack traceback:
[C]: ?
[C]: in function ‘__newindex’
[string “do…”]:22: in function <[string “do…”]:9>
./gui.lua:110: in function ‘change_tab’
./gui.lua:526: in function <./gui.lua:525>
hi,
little step forward.
I’m playing with wave type, first I had to create some wave in tool 1 (my previous first mistake). everything worked before I set “cycles” to more than 1.0.

after adjusting the source code in gui.lua to a max value of 1.0 in cycles no crash yet.
fingers crossed ![]()
@martblek Would love to have a copy of this, if you’ve got the time to share it! Next album is in the works and new waveforms are always a thing that is absolutely necessary ![]()
yes, but samples will be very short with this hack ![]()
Ah, I see. Still, I’d rather a crash-free version than get creative and have it fail ![]()
@martblek Something that is also occurring to me, may be part of the issue. The amount of cycles via slider does not adjust via round numbers. Meaning, there’s a lot of decimal places. I wonder if the slider was adjusted to calculate only total cycles (1, 2, 5, 10, etc.) instead of say, 3.076, maybe it wouldn’t crash?
Not knowing anything about coding, but found this here:
max = SAMPLE_FREQUENCY/100, — to allow for finer tweaking, big values are too sluggish
Maybe, SAMPLE_FREQUENCY/100 is way too big, and has to do a lot of calculation. At what point, beyond human hearing, is this useful?
Thank you! I’ll give it a go right now ![]()
EDIT: @4tey’s ‘stay looping’ function is disabled. I wonder what he did to make that stay “ON”? Do you know?