Skip to content

How to use a ramp down on MegaDrone or similar? #1196

Answered by philburk
YousefJayrwandi asked this question in Q&A
Discussion options

You must be logged in to vote

You could use a RampLinear object. But that would involve switching over to using the flowgraph library and that is not well documented.

I would suggest making a smaller modification to your program. Basically you just want to multiply your output by an amplitude variable. If amplitude=0.0 then the output will be silent. If amplitude=1.0 then the output will be heard at full volume. Then ramp the amplitude up or down when you touch the screen.

amplitude += amplitudeDelta;
amplitude = std::min(1.0, std::max(0.0, amplitude)); // clip to range
output = signal * amplitude;

When you tap down:

amplitudeDelta = 0.001; // positive, so it will ramp up

When you lift your finger:

amplitudeDelta = …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@YousefJayrwandi
Comment options

Answer selected by philburk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants