Skip to content

TGrains2/3 do not respond to 'amp' argument #286

Open
@Prosperoh

Description

@Prosperoh

The 'amp' argument given to TGrains2/3 does not seem to have any effect, all grains having maximum amplitude (though changing the window does have an effect).

Taking the same example as a similar issue that was found in TGrains (supercollider/supercollider#2807):

b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
{ // This should fade in... but starts at full volume
	TGrains2.ar(2, Impulse.ar(15), b, centerPos: Line.ar(0, 5, 10, doneAction: 2), amp: Line.ar(0, 1, 10));
}.play;

What seems to be going wrong: in BhobGrains.cpp, a 'const float amp' is declared in both UGens and takes the value of the parameter, but this value is never actually used. It is later shadowed by the 'amp' variable declared in the GRAIN_AMP_2/3 macros, which is computed from the window and then used by GRAIN2_LOOP_BODY_1/2/4 in defining 'outval', such that 'outval' is never scaled to the 'amp' argument.

I have a local solution that stores the 'amp' argument in the Grain2 struct and uses it in the GRAIN_AMP_2/3 macros, but I am not aware of any code guidelines for this specific structure, also since a similar issue has been fixed in the past for TGrains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions