You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be able to adjust the pitch of each Sound. This probably should be restricted to Sound and unavailable on Stack or Earwurm.
Unlike playbackRate, there does not appear to be a simple solution to changing pitch. While there is a detune property on a AudioBufferSourceNode, apparently it is:
Not supported in Safari.
Appears to be the same as playbackRate but for cents instead of a "multiplier".
This will need to be investigated, as current solutions seem to indicate a new for a AudioWorklet:
this._pitch=1;getpitch(){returnthis._pitch;}setpitch(value: number){constoldPitch=this._pitch;constnewPitch=clamp(tokens.minPitch,value,tokens.maxPitch);if(oldPitch===newPitch)return;this._pitch=newPatch;this.emit('pitch',newPitch);// Do something to actually change sound pitch...}
Usage
constsound1=awaitstack.prepare();// Should be `1` by default.constcurrentPitch=sound1.pitch;// If using a Setter:sound1.pitch=2;// Otherwise, if we prefer a method:sound1.setPitch(2,1000);constsound2=awaitstack.prepare({pitch: 2});constsound3=newSound(...props,{pitch: 2});
We should be able to adjust the
pitch
of eachSound
. This probably should be restricted toSound
and unavailable onStack
orEarwurm
.Unlike
playbackRate
, there does not appear to be a simple solution to changingpitch
. While there is adetune
property on aAudioBufferSourceNode
, apparently it is:playbackRate
but forcents
instead of a "multiplier".This will need to be investigated, as current solutions seem to indicate a new for a
AudioWorklet
:Implementation
Usage
Key points
1
.constructor
?The text was updated successfully, but these errors were encountered: