-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdeepglyph_engine.js
More file actions
22 lines (17 loc) · 750 Bytes
/
deepglyph_engine.js
File metadata and controls
22 lines (17 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const AudioContext = window.AudioContext || window.webkitAudioContext;
const audioCtx = new AudioContext();
export function activateGlyph(glyph) {
const { frequency, harmonics } = glyph.resonance;
const { shape, color, scale } = glyph.geometry;
// 🎵 Аудио резонанс
const base = audioCtx.createOscillator();
base.frequency.value = frequency;
base.type = 'sine';
const gain = audioCtx.createGain();
gain.gain.value = 0.2;
base.connect(gain).connect(audioCtx.destination);
base.start();
setTimeout(() => base.stop(), 1000);
// 🌀 Визуализация (в консоль, но может быть на canvas)
console.log(`%c${glyph.glyph} ${glyph.name}`, `color: ${color}; font-size: ${scale}em`);
}