Fix the documentation of stretch

This commit is contained in:
Václav Volhejn 2025-10-18 12:14:39 +02:00
parent 0ecacae71e
commit 3373fa39a6

View file

@ -1935,12 +1935,16 @@ export const { compressorRelease } = registerControl('compressorRelease');
export const { speed } = registerControl('speed'); export const { speed } = registerControl('speed');
/** /**
* Changes the speed of sample playback, i.e. a cheap way of changing pitch. * Changes the pitch of the sample without changing its speed.
* The frequencies are multiplied by (factor + 1) for positive numbers
* and by max(factor / 4 + 1, 0) for negative numbers.
* So tuning up by octaves can be done with 1, 3, 7, ...
* and tuning down by octaves with -2, -3, -3.5...
* *
* @name stretch * @name stretch
* @param {number | Pattern} factor -inf to inf, negative numbers play the sample backwards. * @param {number | Pattern} factor between `-4` and `inf`. Positive increases pitch, 0 does nothing, negative decreases the pitch.
* @example * @example
* s("gm_flute").stretch("1 2 .5") * s("gm_flute").stretch("<3 2 1 0 -2>")
* *
*/ */
export const { stretch } = registerControl('stretch'); export const { stretch } = registerControl('stretch');