how to normalize a sample with lua?

Hi, I’m working at trying to make the Disk Browser a bit faster to use for loading samples. This leads me to wanting to be able to normalize with a lua script (so can normalize a loaded-in-sample while cursor focus is on the disk browser).

What is the process of normalizing the currently_selected_/visible_sample in the sample editor, please?

i suppose undo should be somehow taken into consideration. uhh.

It has been suggested that the LUA api can invoke methods from the sample editor. But, currently the script would have to process the sample, frame-by-frame. The code would be simple enough - iterate through samples, find the peak, apply this to all frames… But this approach is not exactly fast - on short samples, you might not notice, but long ones…:urgh:

Also, it’s a bit tricky to trigger lua when a sample has loaded - there’s no apparent “a sample has been loaded” event.
But you can of course perform educated guesses - name has changed, sample data has arrived, buffer length changed, etc…

So, what you’re suggesting could be done, but it would require tackling quite a bunch of obstacles first.

1 Like

maybe some command line tools available cross platform could do that job in a fluent way?

what weirds me out is this though, okay, let’s say I have this:[].samples[].sample_buffer_observable

and it has changed from false to true.

but if i make a notifier based on this change, it’ll be tied to a specific instrument and a specific sample slot.

So, how do I make it global? that everytime any sample is loaded, a specific bunch of commands are run?