From 3373fa39a6be2d2d3765dcbd52b63c30e4f3b10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Volhejn?= Date: Sat, 18 Oct 2025 12:14:39 +0200 Subject: [PATCH] Fix the documentation of `stretch` --- packages/core/controls.mjs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 7e3c2a8e..13060844 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -1935,12 +1935,16 @@ export const { compressorRelease } = registerControl('compressorRelease'); 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 - * @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 - * s("gm_flute").stretch("1 2 .5") + * s("gm_flute").stretch("<3 2 1 0 -2>") * */ export const { stretch } = registerControl('stretch');