Buffer gain

Hi, just curious if there’s a better way to do this:

Normalizing a buffer is easy and quick:

~buf.normalize

But I can’t find a way to easily tweak the gain by some specified amount, this is what I came up with:

~buf.loadToFloatArray(0, -1, { |arr|
  arr = arr * 2;
  ~buf.loadCollection(arr);
})

which even for a five minute buffer takes many seconds. Is there a better way?

not quite what you’re asking but don’t forget that normalize takes a newmax arg so you can at least quickly scale a buffer down once it is normalized: a.normalize(-6.dbamp) etc

Hm, \normalize and \wnormalize are not documented in the Server Command Reference – should file an issue for that.

Also a \b_gen \gain function would be great (but doesn’t exist now), and probably not hard to do in C++.

hjh

Is it any quicker if you use the Signal method fade (which does fade in place)?