Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken TGrains amp handling #2809

Merged
merged 2 commits into from
Apr 22, 2017
Merged

Fix broken TGrains amp handling #2809

merged 2 commits into from
Apr 22, 2017

Conversation

mossheim
Copy link
Contributor

Fixes #2807, a regression caused by #2136 (f35a3f7).

This should work correctly now:

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

\#2136 missed a use of TGrains' `amp` parameter that left it unused
in the graph function. This commit adds it back based on where it
previously resided.
@mossheim mossheim added this to the 3.9 milestone Mar 21, 2017
@ghost
Copy link

ghost commented Mar 21, 2017

some suggestions (sent from a library computer, may not compile due to an eventual error. i am sorry if that's the case)


~myBuffer = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");


{ // This should fade in... but starts at full volume
	TGrains.ar(~myBuffer.numChannels, Impulse.kr(200), ~myBuffer.bufnum, 
                   centerPos: Line.ar(0, 5, 10, doneAction: 2) + TRand.kr(0, 0.01, Impulse.kr(400)), 
                   pan: WhiteNoise.kr(0.6), amp: Line.ar(0, 1, 10), interp: 4);
}.scope(s);


_

ever tried ever failed no matter try again fail again fail better

_

@mossheim
Copy link
Contributor Author

@tiagmoraismorgado Make sure you understand the PR before commenting please. This is just about making sure the amp parameter to TGrains functions correctly.

pan1 = grain->pan1 = cos(panangle);
pan2 = grain->pan2 = sin(panangle);
pan1 = grain->pan1 = amp * cos(panangle);
pan2 = grain->pan2 = amp * sin(panangle);
} else {
grain->chan = 0;
pan1 = grain->pan1 = 1.;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to multiply by amp in the one-channel case too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

@nhthn nhthn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took so long.

@nhthn nhthn merged commit 365e16b into supercollider:master Apr 22, 2017
@mossheim mossheim deleted the patch/tgrains-amp branch April 22, 2017 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants