elektron-lfo 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/engine/lfo.ts +1 -1
- package/src/engine/waveforms.ts +8 -10
package/dist/index.js
CHANGED
|
@@ -122,7 +122,7 @@ function generateWaveform(waveform, phase, state) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
function isUnipolar(waveform) {
|
|
125
|
-
return waveform === "
|
|
125
|
+
return waveform === "RMP" || waveform === "EXP";
|
|
126
126
|
}
|
|
127
127
|
function getWaveformRange(waveform) {
|
|
128
128
|
if (isUnipolar(waveform)) {
|
package/package.json
CHANGED
package/src/engine/lfo.ts
CHANGED
package/src/engine/waveforms.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Waveform generators for Elektron Digitakt II LFO
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* - Unipolar (0 to +1): EXP, RMP
|
|
4
|
+
* Most waveforms are bipolar (-1 to +1).
|
|
5
|
+
* RMP and EXP are unipolar (0 to +1) - depth parameter handles negative modulation.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
import type { Waveform, LFOState } from './types';
|
|
@@ -40,7 +39,7 @@ export function generateSquare(phase: number): number {
|
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* Sawtooth waveform - Bipolar
|
|
43
|
-
* Linear fall from +1 to -1 (
|
|
42
|
+
* Linear fall from +1 to -1 (matches Digitakt II behavior)
|
|
44
43
|
*/
|
|
45
44
|
export function generateSawtooth(phase: number): number {
|
|
46
45
|
return 1 - phase * 2;
|
|
@@ -48,21 +47,19 @@ export function generateSawtooth(phase: number): number {
|
|
|
48
47
|
|
|
49
48
|
/**
|
|
50
49
|
* Exponential waveform - Unipolar (0 to +1)
|
|
51
|
-
* Decaying curve from 1 to 0 (matches Digitakt II behavior)
|
|
50
|
+
* Decaying curve from +1 to 0 (matches Digitakt II behavior)
|
|
52
51
|
* Fast initial decay, slowing toward the end (true exponential decay shape)
|
|
53
52
|
*/
|
|
54
53
|
export function generateExponential(phase: number): number {
|
|
55
54
|
const k = 3; // Decay rate - controls steepness of decay
|
|
56
|
-
// True exponential decay
|
|
57
|
-
// Formula: (exp(-phase * k) - exp(-k)) / (1 - exp(-k))
|
|
58
|
-
// This normalizes to exactly [1, 0] range
|
|
55
|
+
// True exponential decay normalized to [1, 0]
|
|
59
56
|
const expK = Math.exp(-k);
|
|
60
57
|
return (Math.exp(-phase * k) - expK) / (1 - expK);
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
/**
|
|
64
61
|
* Ramp waveform - Unipolar (0 to +1)
|
|
65
|
-
* Linear rise from 0 to +1
|
|
62
|
+
* Linear rise from 0 to +1 (matches Digitakt II behavior)
|
|
66
63
|
*/
|
|
67
64
|
export function generateRamp(phase: number): number {
|
|
68
65
|
return phase;
|
|
@@ -141,9 +138,10 @@ export function generateWaveform(
|
|
|
141
138
|
|
|
142
139
|
/**
|
|
143
140
|
* Check if a waveform is unipolar (0 to +1) vs bipolar (-1 to +1)
|
|
141
|
+
* RMP and EXP are unipolar - depth parameter handles negative modulation
|
|
144
142
|
*/
|
|
145
143
|
export function isUnipolar(waveform: Waveform): boolean {
|
|
146
|
-
return waveform === '
|
|
144
|
+
return waveform === 'RMP' || waveform === 'EXP';
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
/**
|