elektron-lfo 1.0.9 → 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 CHANGED
@@ -66,7 +66,7 @@ function generateSquare(phase) {
66
66
  return phase < 0.5 ? 1 : -1;
67
67
  }
68
68
  function generateSawtooth(phase) {
69
- return phase * 2 - 1;
69
+ return 1 - phase * 2;
70
70
  }
71
71
  function generateExponential(phase) {
72
72
  const k = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elektron-lfo",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Elektron LFO engine simulator implementation with CLI visualization",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.ts",
@@ -39,10 +39,10 @@ export function generateSquare(phase: number): number {
39
39
 
40
40
  /**
41
41
  * Sawtooth waveform - Bipolar
42
- * Linear rise from -1 to +1 (matches Digitakt II behavior)
42
+ * Linear fall from +1 to -1 (matches Digitakt II behavior)
43
43
  */
44
44
  export function generateSawtooth(phase: number): number {
45
- return phase * 2 - 1;
45
+ return 1 - phase * 2;
46
46
  }
47
47
 
48
48
  /**
@@ -123,22 +123,22 @@ describe('Square Waveform', () => {
123
123
  });
124
124
 
125
125
  describe('Sawtooth Waveform', () => {
126
- test('starts at -1 at phase 0', () => {
127
- expect(generateSawtooth(0)).toBe(-1);
126
+ test('starts at +1 at phase 0', () => {
127
+ expect(generateSawtooth(0)).toBe(1);
128
128
  });
129
129
 
130
130
  test('is 0 at phase 0.5', () => {
131
131
  expect(generateSawtooth(0.5)).toBe(0);
132
132
  });
133
133
 
134
- test('approaches +1 at phase ~1', () => {
135
- expect(generateSawtooth(1)).toBe(1);
136
- expect(generateSawtooth(0.999)).toBeCloseTo(1, 2);
134
+ test('approaches -1 at phase ~1', () => {
135
+ expect(generateSawtooth(1)).toBe(-1);
136
+ expect(generateSawtooth(0.999)).toBeCloseTo(-1, 2);
137
137
  });
138
138
 
139
- test('is bipolar and linear (rising)', () => {
140
- expect(generateSawtooth(0.25)).toBeCloseTo(-0.5, 5);
141
- expect(generateSawtooth(0.75)).toBeCloseTo(0.5, 5);
139
+ test('is bipolar and linear (falling)', () => {
140
+ expect(generateSawtooth(0.25)).toBeCloseTo(0.5, 5);
141
+ expect(generateSawtooth(0.75)).toBeCloseTo(-0.5, 5);
142
142
  });
143
143
  });
144
144