@gentleclockdivider, You can experience what you can do with the MUC (MIDI Universal Controller) tool, with the Waveform Sampler module, called “Wave Builder”. You can download the Demo version and try what it is capable of doing. You can use the mouse for this. You will see that iteration is a widely used resource!!!
Basically, it is about creating points on an X-Y surface (frames-samples, amplitude) using mathematical formulas and destructively if you change the number of frames, simply combining the access provided by the API with the capabilities of Lua 5.1. This last condition of the change in the number of frames is slower or much slower as the table becomes larger. But, if you do not change the number of frames, it is not necessary to destroy the buffer to recreate it, so the result is very fast, even “in long audio waves”.
You can also work in mono (one channel) or stereo (two channels, twice as slow).
The problem with Renoise and its API is that to manipulate an audio wave of different duration (change in the number of frames) it is necessary to rebuild the buffer, that is, delete and create again, and if the buffer is large, the experience is becomes slow. So you have 3 scenarios with the same sample rate:
- Very fast. If the resulting audio wave lasts the same as the original. Here you don’t destroy the buffer, you just change the width of each frame. This is lightning fast.
- Fast: If the original and resulting audio wave are of short duration, 3-10 seconds, or something like that.
- Slow: if the original wave or the resulting wave has a very long and different duration. Rather the resulting wave, because it is necessary to destroy the original buffer and create a new long-lasting one.
In the MUC tool there are many examples of short and long waves. That’s why a small clock icon may appear in the process. It even allows you to save and tag your own created audio waves to reuse them later. It’s like a briefcase of audio waves with the ability to create/delete and reuse. I guess all this will give you an idea of what you can achieve. But the difficulty here is not the API or Lua, but the mathematical sciences.
In summary, if you work with audio waves with few frames (short duration), with a contained number of frames (see sample rate), you will have an instantaneous result in the user experience, it seems almost real time. And don’t forget that this is a CPU process. The faster the processor, the faster the user experience. Obvious.
Last added thoughts…
If you want to create an effective and fast tool, you can focus on always using a fixed number of frames, for example, with a specific sample rate that lasts about 5 or 10 seconds. This way you always use the same buffer (non-destructive) and you only need to change the amplitude of each frame. Then, you can create a silence at the end in each type of audio waveform (the last frames with amplitude=0).
That is, for example you can create waves of 1 second, 3 seconds or 10 seconds (all with 10 seconds):
- 1 second of wave, 9 seconds of silence.
- 3 seconds of wave, 7 seconds of silence.
- 10 seconds of wave, 0 seconds of silence.
This approach would practically allow changing the audio waveform “in real time” (instantaneous, with very few milliseconds of execution). You could even build a Lua tool that allows you to change the audio waveform on the fly linked to new pattern effects commands. No one has ever programmed that, but I’m sure it’s possible.
I’m not talking about whether such a tool would be useful or not. Perhaps it would even be absurd, since you can save an infinite number of audio waves before composing a pattern. But on an experimental basis it would be a lot of fun to create music with this approach, where even randomization according to certain parameters could create very fun sound things.
This thread should be here: https://forum.renoise.com/c/renoise-tool-development/