How do I smooth incoming data? [SOLVED]

0 favourites
  • 6 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Hi,

    every tick I'm receiving the Volume-Level of an incoming microphone. Because I need multiple audio-inputs, not directly via the audio-plugin, but with small extra-java-prog via the windows-mixer and with websocket into construct. Then, I'm storing it in a global variable and link the data to the position of a sprite. So far so good. But the sprite is changing it's position too rapidly.

    Can anybody help me out smoothing the data, so the sprite won't change so rapidly it's position?

    Thanks!

    held

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Set Global-Variable to lerp(Global-Variable,Volume-Level,speed*dt)

    Set Volume to Global-Variable

  • Thanks already!

    my global variable is called "Audio_In_01"

    my incoming data is "WebSocket.MessageText"

    I tried your tip with:

    every tick > set lerp(Audio_In_01,WebSocket.MessageText,speed*dt)

    and can't get it to work. Could you give my another, little harder hint :)

    Thanks!

  • every tick > set global variable Audio_In_01 to lerp(Audio_In_01,int(WebSocket.MessageText),1*dt)

    every tick > set volume to global variable Audio_In_01

    I have no idea what your speed of interpolation would be.

    Websocket text is obviously a string.

  • sorry for syntax-lacks!

    Now, c2 accepts it. The result is not noticeable, no matter what x*dt

    I'm am wrong again, right :)

    Thanks 4 your patience.

  • I finally got it working!

    As the incoming data is a floating point number, I changed the "int" to "float" and got the movement smooth as silk.

    Thanks for your decisive help!

    held

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