diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-28 20:27:25 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-28 20:27:25 +0100 |
| commit | 340fdb217c629803eafd4b13731044adf6f5fb3d (patch) | |
| tree | 2f4725ed0c3d6962d946bcac0254a807d1ec7a9a /tools/editor/dct.js | |
| parent | 9b677566c18aab7b77b9f4e6c3cf9ce89a02e886 (diff) | |
feat(gemini): Add .geminiignore file
Propose and add a .geminiignore file to exclude build artifacts, dependency build outputs, archives, temporary files, and IDE configurations from Gemini's analysis and operations.
Diffstat (limited to 'tools/editor/dct.js')
| -rw-r--r-- | tools/editor/dct.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/editor/dct.js b/tools/editor/dct.js new file mode 100644 index 0000000..f60f27e --- /dev/null +++ b/tools/editor/dct.js @@ -0,0 +1,29 @@ +// --- Utility Functions for Audio Processing --- +// JavaScript equivalent of C++ idct_512 +function javascript_idct_512(input) { + const output = new Float32Array(dctSize); + const PI = Math.PI; + const N = dctSize; + + for (let n = 0; n < N; ++n) { + let sum = input[0] / 2.0; + for (let k = 1; k < N; ++k) { + sum += input[k] * Math.cos((PI / N) * k * (n + 0.5)); + } + output[n] = sum * (2.0 / N); + } + return output; +} + +// Hanning window for smooth audio transitions (JavaScript equivalent) +function hanningWindow(size) { + const window = new Float32Array(size); + const PI = Math.PI; + for (let i = 0; i < size; i++) { + window[i] = 0.5 * (1 - Math.cos((2 * PI * i) / (size - 1))); + } + return window; +} + +const hanningWindowArray = hanningWindow(dctSize); // Pre-calculate window + |
