How do I use ramps on volume and pitch changes?

0 favourites
  • 8 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • 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: , 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!

  • Any idea?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • You can add a gain effect and ramp its gain parameter.

  • Ashley : Thank you very much, that's perfect!

  • @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?

  • also, I am very beginner with Construct 2. So be gentle if possible

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)