resonance-audio / resonance-audio-web-sdk

Resonance Audio SDK for Web
https://resonance-audio.github.io/resonance-audio/
Apache License 2.0
200 stars 56 forks source link

Smooth transition when using sliders to set params #28

Open iooops opened 5 years ago

iooops commented 5 years ago

When I use a slider to change the value, e.g. setPosition, there're sometimes clipping sounds, especially when I am sliding fast. And I can't use linearRamp since it's not an audio node param. How could I resolve this?

drewbitllama commented 5 years ago

I would make sure you are updating position as often as you can, as the more continuous-like the position is, the less discontinuity you’ll hear. On Tue, Mar 12, 2019 at 5:33 AM iooops notifications@github.com wrote:

When I use a slider to change the value, e.g. setPosition, there're sometimes clipping sounds. And I can't use linearRamp since it's not an audio node param. How could I resolve this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/resonance-audio/resonance-audio-web-sdk/issues/28, or mute the thread https://github.com/notifications/unsubscribe-auth/AGDsNvsH-GPyAOZQOddO_pKbk6et8fxPks5vV3RUgaJpZM4bqbyn .

iooops commented 5 years ago

Can you add a linearRamp like function in the SDK? This can allow smooth transition.

iooops commented 5 years ago

Maybe can override omnitone's functions like setRotationMatrix3 & setRotationMatrix4 ?


/**
 * Updates the rotation matrix with 4x4 matrix.
 * @param {Number[]} rotationMatrix4 - A 4x4 rotation matrix. (column-major)
 */
FOARotator.prototype.setRotationMatrix4 = function(rotationMatrix4) {
  this._m0.gain.value = rotationMatrix4[0];
  this._m1.gain.value = rotationMatrix4[1];
  this._m2.gain.value = rotationMatrix4[2];
  this._m3.gain.value = rotationMatrix4[4];
  this._m4.gain.value = rotationMatrix4[5];
  this._m5.gain.value = rotationMatrix4[6];
  this._m6.gain.value = rotationMatrix4[8];
  this._m7.gain.value = rotationMatrix4[9];
  this._m8.gain.value = rotationMatrix4[10];
};

Instead of set the value directly, using setTargetAtTime to smooth out the transition?

If it should be done by myself, how could I override your functions then?