How do I use ramps on volume and pitch changes?

Get help using Construct 2

Post » Fri Mar 13, 2015 10:50 pm

Hi community,

I have a question about modulating volume and pitch of a sound.

Lowering or raising volume every tick "manually" is of course possible, but since that is not smooth enough (one frame step is ~17ms at least) it
does not produce convincing quality fades, even if the app is running smooth with the highest possible 60 fps.

There is a way to use ramped value changes (lin. and exp.) on audio effects only, that seems to solve just this problem. That kind of value shifting over time appears to be with a much higher rate (and resolution), sounding quite great.

Is that somehow possible with volume and/or pitch as well? Or are we stuck just at this two very fundamental audio modulation features depending on the frame rate?

The only workaround I found is the tremolo effect, which can only be used to fade out, besides its obvious purpose. (Since it's phase always starts with 100% volume, only fading out is possible: if you add tremolo fx to audio and stop it, when the volume is lowest, you have had a smooth fade out.)

> @ashley , @Kyatric please take a quick look, if you have any hints or ideas for me to work out a solution. I think that is a quite "advanced" use of audio in C2.

You can see here: viewtopic.php?f=180&t=126638 , one example I need it for.
I would like to do more complex synthesizers, but it does not make sense, if I can not solve at least the harsh volume stepping-problem.


Thanks!
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Mon Mar 16, 2015 11:34 am

Any idea?
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Mon Mar 16, 2015 2:08 pm

if fading with a variable doesn't convince you, try using lerp or qlerp or the other similar. I don't think you can "escape" the fps thing since all the code is executed on ticks...even if you use the gametime expression (or something like that) and put it into a variable, the volume fade is executed on ticks.
Image
B
46
S
12
G
6
Posts: 270
Reputation: 11,616

Post » Sun Mar 29, 2015 3:57 pm

> @danuyos

Thanks for your comment.

I do use sine and other functions combined with lerp, but as I wrote, it is not of convincing quality for musical use, due to the 60 fps (or ticks per second) limitation of the browser.

That is why I am looking for a similar high resolution workaround, like changing the effect parameters over a given time with linear or exp. ramp settings. That seems to be independent from the actual ticks, or am I wrong?

< @Ashley : Please give me a short answer, if there is an alternative solution for this issue... Thanks.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Mon Mar 30, 2015 10:40 am

You can add a gain effect and ramp its gain parameter.
Scirra Founder
B
362
S
216
G
75
Posts: 23,064
Reputation: 180,315

Post » Mon Mar 30, 2015 3:40 pm

> @Ashley : Thank you very much, that's perfect!
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Thu Jun 11, 2015 7:11 pm

>@MultipleChoice: I really like your tutorial with the synthesizer. I'm making a music game and I'm having similar trouble like the question you were asking.

I'm using a gamepad, and basically my game is you hit the A button and a note or a chord plays. Right now I have it set so that when you release the A button it just stops immediately, which isn't very musicy. I want the sound to fade as it would in real life on a real instrument. I tried it with the gain effect and it sounds pretty good but then I can't play the same sound immediately after it. One A button press/release will work, but the next won't.

Any ideas on how to make this happen?
B
9
S
1
Posts: 38
Reputation: 501

Post » Thu Jun 11, 2015 7:12 pm

also, I am very beginner with Construct 2. So be gentle if possible
B
9
S
1
Posts: 38
Reputation: 501


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests