audiora 1.0.1 → 2.0.0
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/CHANGELOG.md +43 -0
- package/README.md +39 -0
- package/dist/ai/index.cjs +6 -0
- package/dist/ai/index.cjs.map +1 -0
- package/dist/ai/index.d.cts +12 -0
- package/dist/ai/index.d.ts +12 -0
- package/dist/ai/index.js +6 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/types-Cm-vGOKS.d.cts +258 -0
- package/dist/types-Cm-vGOKS.d.ts +258 -0
- package/package.json +45 -9
- package/docs/API.md +0 -345
- package/src/Audiora.ts +0 -296
- package/src/core/AudioEngine.ts +0 -108
- package/src/core/ImageProcessor.ts +0 -180
- package/src/core/Scanner.ts +0 -183
- package/src/core/Scheduler.ts +0 -105
- package/src/core/State.ts +0 -86
- package/src/core/Synthesizer.ts +0 -196
- package/src/core/constants.ts +0 -70
- package/src/core/presets.ts +0 -166
- package/src/core/types.ts +0 -54
- package/src/core/utils.ts +0 -47
- package/src/core/wav.ts +0 -60
- package/src/index.ts +0 -9
- package/src/ui/Renderer.ts +0 -145
- package/src/ui/Tweener.ts +0 -71
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
interface PresetData {
|
|
2
|
+
osc_type: string;
|
|
3
|
+
scale_name: string;
|
|
4
|
+
base_note: number;
|
|
5
|
+
bpm: number;
|
|
6
|
+
speed: number;
|
|
7
|
+
note_mult: number;
|
|
8
|
+
volume: number;
|
|
9
|
+
vibrato_rate: number;
|
|
10
|
+
vibrato_depth: number;
|
|
11
|
+
tremolo_rate: number;
|
|
12
|
+
tremolo_depth: number;
|
|
13
|
+
fifth_lvl: number;
|
|
14
|
+
oct_lvl: number;
|
|
15
|
+
filter_base: number;
|
|
16
|
+
filter_track: number;
|
|
17
|
+
resonance: number;
|
|
18
|
+
reverb_mix: number;
|
|
19
|
+
reverb_time: number;
|
|
20
|
+
bass_gain: number;
|
|
21
|
+
block_w: number;
|
|
22
|
+
block_h: number;
|
|
23
|
+
scan_mode: string;
|
|
24
|
+
pan_amount: number;
|
|
25
|
+
timing_mode: string;
|
|
26
|
+
timing_intensity: number;
|
|
27
|
+
}
|
|
28
|
+
type FormatFn = (v: number) => string;
|
|
29
|
+
|
|
30
|
+
type TweenTickHandler = (key: string, value: number) => void;
|
|
31
|
+
|
|
32
|
+
type ImageSource = string | File | Blob | HTMLImageElement;
|
|
33
|
+
|
|
34
|
+
type AudioraEventType = "start" | "stop" | "noteplay" | "imageload" | "error";
|
|
35
|
+
interface AudioraStartEvent extends CustomEvent<{
|
|
36
|
+
timestamp: number;
|
|
37
|
+
}> {
|
|
38
|
+
readonly type: "start";
|
|
39
|
+
}
|
|
40
|
+
interface AudioraStopEvent extends CustomEvent<{
|
|
41
|
+
timestamp: number;
|
|
42
|
+
duration: number;
|
|
43
|
+
}> {
|
|
44
|
+
readonly type: "stop";
|
|
45
|
+
}
|
|
46
|
+
interface AudioraNotePlayEvent extends CustomEvent<{
|
|
47
|
+
freq: number;
|
|
48
|
+
vel: number;
|
|
49
|
+
pan: number;
|
|
50
|
+
blockIndex: number;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
}> {
|
|
53
|
+
readonly type: "noteplay";
|
|
54
|
+
}
|
|
55
|
+
interface AudioraImageLoadEvent extends CustomEvent<{
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
blockCount: number;
|
|
59
|
+
}> {
|
|
60
|
+
readonly type: "imageload";
|
|
61
|
+
}
|
|
62
|
+
interface AudioraErrorEvent extends CustomEvent<{
|
|
63
|
+
error: Error;
|
|
64
|
+
context: string;
|
|
65
|
+
}> {
|
|
66
|
+
readonly type: "error";
|
|
67
|
+
}
|
|
68
|
+
interface AudioraEventMap {
|
|
69
|
+
start: AudioraStartEvent;
|
|
70
|
+
stop: AudioraStopEvent;
|
|
71
|
+
noteplay: AudioraNotePlayEvent;
|
|
72
|
+
imageload: AudioraImageLoadEvent;
|
|
73
|
+
error: AudioraErrorEvent;
|
|
74
|
+
}
|
|
75
|
+
type AudioraEvent = AudioraEventMap[AudioraEventType];
|
|
76
|
+
|
|
77
|
+
interface RenderOptions {
|
|
78
|
+
image?: ImageSource;
|
|
79
|
+
params?: Partial<PresetData>;
|
|
80
|
+
duration?: number;
|
|
81
|
+
sampleRate?: number;
|
|
82
|
+
}
|
|
83
|
+
type AudioraMode = "instrument" | "multimodal";
|
|
84
|
+
type VisionProviderName = "gemini" | "openai" | "anthropic" | "ollama";
|
|
85
|
+
type AudioraProviders = {
|
|
86
|
+
vision?: string;
|
|
87
|
+
audio?: "browser";
|
|
88
|
+
embeddings?: "local" | string;
|
|
89
|
+
speech?: "browser" | string;
|
|
90
|
+
browserAccess?: boolean;
|
|
91
|
+
};
|
|
92
|
+
interface LiveOptions {
|
|
93
|
+
waveCanvas?: HTMLCanvasElement;
|
|
94
|
+
mapCanvas?: HTMLCanvasElement;
|
|
95
|
+
onTweenTick?: TweenTickHandler;
|
|
96
|
+
mode?: AudioraMode;
|
|
97
|
+
providers?: AudioraProviders;
|
|
98
|
+
}
|
|
99
|
+
interface LoadedImageSample {
|
|
100
|
+
pixels: Uint8ClampedArray;
|
|
101
|
+
width: number;
|
|
102
|
+
height: number;
|
|
103
|
+
blockCount: number;
|
|
104
|
+
}
|
|
105
|
+
interface Audiora {
|
|
106
|
+
addEventListener<K extends AudioraEventType>(type: K, listener: (this: Audiora, event: AudioraEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
107
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
108
|
+
removeEventListener<K extends AudioraEventType>(type: K, listener: (this: Audiora, event: AudioraEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
109
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
110
|
+
}
|
|
111
|
+
declare class Audiora extends EventTarget {
|
|
112
|
+
private readonly state;
|
|
113
|
+
private readonly engine;
|
|
114
|
+
private readonly imageProcessor;
|
|
115
|
+
private readonly grid;
|
|
116
|
+
private readonly seq;
|
|
117
|
+
private readonly synth;
|
|
118
|
+
private readonly scheduler;
|
|
119
|
+
private readonly tweener;
|
|
120
|
+
private renderer;
|
|
121
|
+
private reverbDebounce;
|
|
122
|
+
private loadedImage;
|
|
123
|
+
private playStartTime;
|
|
124
|
+
private speechSource;
|
|
125
|
+
constructor(options?: LiveOptions);
|
|
126
|
+
get playing(): boolean;
|
|
127
|
+
attachVisuals(waveCanvas: HTMLCanvasElement, mapCanvas: HTMLCanvasElement): void;
|
|
128
|
+
resizeVisuals(): void;
|
|
129
|
+
readLoadedImage(): LoadedImageSample | null;
|
|
130
|
+
loadImage(image: ImageSource): Promise<void>;
|
|
131
|
+
play(soundscape?: Soundscape): Promise<void>;
|
|
132
|
+
stop(): void;
|
|
133
|
+
warmUp(): Promise<void>;
|
|
134
|
+
getParam(key: keyof PresetData): string | number;
|
|
135
|
+
setParam(key: keyof PresetData, value: string | number): void;
|
|
136
|
+
applyParams(patch: Partial<PresetData>, options?: {
|
|
137
|
+
tween?: boolean;
|
|
138
|
+
}): void;
|
|
139
|
+
captureParams(): Partial<PresetData>;
|
|
140
|
+
toAudioBuffer(options?: RenderOptions): Promise<AudioBuffer>;
|
|
141
|
+
toBlob(options?: RenderOptions): Promise<Blob>;
|
|
142
|
+
playDetachedAudio(bytes: ArrayBuffer): Promise<void>;
|
|
143
|
+
private stopSpeech;
|
|
144
|
+
private renderOffline;
|
|
145
|
+
private rebuildGrid;
|
|
146
|
+
private applyParamSideEffects;
|
|
147
|
+
private syncLiveAudioFromState;
|
|
148
|
+
private emit;
|
|
149
|
+
private emitError;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
type AnalysisTask = "description" | "color-analysis" | "sound-mapping" | "text-mapping" | "audio-intelligence" | "soundscape" | "semantic" | "narration";
|
|
153
|
+
type AudioIntelligence = {
|
|
154
|
+
duration: number;
|
|
155
|
+
sampleRate: number;
|
|
156
|
+
channels: number;
|
|
157
|
+
peak: number;
|
|
158
|
+
rms: number;
|
|
159
|
+
zeroCrossingRate: number;
|
|
160
|
+
spectralCentroid: number;
|
|
161
|
+
label: "dark" | "warm" | "bright" | "dense" | "sparse";
|
|
162
|
+
summary: string;
|
|
163
|
+
};
|
|
164
|
+
type ColorAnalysis = {
|
|
165
|
+
width: number;
|
|
166
|
+
height: number;
|
|
167
|
+
blockCount: number;
|
|
168
|
+
average: {
|
|
169
|
+
h: number;
|
|
170
|
+
s: number;
|
|
171
|
+
l: number;
|
|
172
|
+
};
|
|
173
|
+
palette: Array<{
|
|
174
|
+
h: number;
|
|
175
|
+
s: number;
|
|
176
|
+
l: number;
|
|
177
|
+
weight: number;
|
|
178
|
+
}>;
|
|
179
|
+
};
|
|
180
|
+
type Soundscape = {
|
|
181
|
+
source: "image" | "text" | "prompt";
|
|
182
|
+
label: string;
|
|
183
|
+
patch: PresetData;
|
|
184
|
+
};
|
|
185
|
+
type AnalyzeInput = {
|
|
186
|
+
image?: ImageSource;
|
|
187
|
+
text?: string;
|
|
188
|
+
prompt?: string;
|
|
189
|
+
buffer?: AudioBuffer;
|
|
190
|
+
tasks: AnalysisTask[];
|
|
191
|
+
onText?: (chunk: string) => void;
|
|
192
|
+
};
|
|
193
|
+
type ShortcutOptions = {
|
|
194
|
+
prompt?: string;
|
|
195
|
+
onText?: (chunk: string) => void;
|
|
196
|
+
};
|
|
197
|
+
type SemanticAudio = {
|
|
198
|
+
tags: string[];
|
|
199
|
+
mood: string;
|
|
200
|
+
embedding?: number[];
|
|
201
|
+
};
|
|
202
|
+
type ProviderKind = "vision" | "embeddings" | "speech";
|
|
203
|
+
type SpeechOutput = {
|
|
204
|
+
text: string;
|
|
205
|
+
} | {
|
|
206
|
+
audio: ArrayBuffer;
|
|
207
|
+
mimeType: string;
|
|
208
|
+
text?: string;
|
|
209
|
+
};
|
|
210
|
+
interface VisionAdapter {
|
|
211
|
+
kind: "vision";
|
|
212
|
+
name: string;
|
|
213
|
+
describe(input: {
|
|
214
|
+
image: ImageSource;
|
|
215
|
+
prompt?: string;
|
|
216
|
+
onText?: (chunk: string) => void;
|
|
217
|
+
browserAccess?: boolean;
|
|
218
|
+
}): Promise<string>;
|
|
219
|
+
}
|
|
220
|
+
interface EmbeddingsAdapter {
|
|
221
|
+
kind: "embeddings";
|
|
222
|
+
name: string;
|
|
223
|
+
embed(input: {
|
|
224
|
+
text: string;
|
|
225
|
+
browserAccess?: boolean;
|
|
226
|
+
}): Promise<number[]>;
|
|
227
|
+
}
|
|
228
|
+
interface SpeechAdapter {
|
|
229
|
+
kind: "speech";
|
|
230
|
+
name: string;
|
|
231
|
+
narrate(input: {
|
|
232
|
+
image?: ImageSource;
|
|
233
|
+
text?: string;
|
|
234
|
+
onText?: (chunk: string) => void;
|
|
235
|
+
browserAccess?: boolean;
|
|
236
|
+
}): Promise<SpeechOutput>;
|
|
237
|
+
}
|
|
238
|
+
type AnalyzeResult = {
|
|
239
|
+
description?: string;
|
|
240
|
+
color?: ColorAnalysis;
|
|
241
|
+
soundscape?: Soundscape;
|
|
242
|
+
audio?: AudioIntelligence;
|
|
243
|
+
semantic?: SemanticAudio;
|
|
244
|
+
narration?: string | SpeechOutput;
|
|
245
|
+
soundscapes?: Soundscape[];
|
|
246
|
+
};
|
|
247
|
+
interface Multimodal {
|
|
248
|
+
analyze(input: AnalyzeInput): Promise<AnalyzeResult>;
|
|
249
|
+
playSoundscape(soundscape: Soundscape): Promise<void>;
|
|
250
|
+
speak(value?: string | SpeechOutput): void | Promise<void>;
|
|
251
|
+
describe(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
252
|
+
soundify(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
253
|
+
interpret(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
254
|
+
narrate(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
255
|
+
explore(image: ImageSource): Promise<AnalyzeResult>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export { Audiora as A, type ColorAnalysis as C, type EmbeddingsAdapter as E, type FormatFn as F, type ImageSource as I, type LiveOptions as L, type Multimodal as M, type ProviderKind as P, type RenderOptions as R, type SpeechAdapter as S, type VisionAdapter as V, type AudioraProviders as a, type AnalysisTask as b, type AnalyzeInput as c, type AnalyzeResult as d, type AudioIntelligence as e, type SemanticAudio as f, type ShortcutOptions as g, type Soundscape as h, type SpeechOutput as i, type VisionProviderName as j, type PresetData as k, type AudioraErrorEvent as l, type AudioraEvent as m, type AudioraEventMap as n, type AudioraEventType as o, type AudioraImageLoadEvent as p, type AudioraMode as q, type AudioraNotePlayEvent as r, type AudioraStartEvent as s, type AudioraStopEvent as t };
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
interface PresetData {
|
|
2
|
+
osc_type: string;
|
|
3
|
+
scale_name: string;
|
|
4
|
+
base_note: number;
|
|
5
|
+
bpm: number;
|
|
6
|
+
speed: number;
|
|
7
|
+
note_mult: number;
|
|
8
|
+
volume: number;
|
|
9
|
+
vibrato_rate: number;
|
|
10
|
+
vibrato_depth: number;
|
|
11
|
+
tremolo_rate: number;
|
|
12
|
+
tremolo_depth: number;
|
|
13
|
+
fifth_lvl: number;
|
|
14
|
+
oct_lvl: number;
|
|
15
|
+
filter_base: number;
|
|
16
|
+
filter_track: number;
|
|
17
|
+
resonance: number;
|
|
18
|
+
reverb_mix: number;
|
|
19
|
+
reverb_time: number;
|
|
20
|
+
bass_gain: number;
|
|
21
|
+
block_w: number;
|
|
22
|
+
block_h: number;
|
|
23
|
+
scan_mode: string;
|
|
24
|
+
pan_amount: number;
|
|
25
|
+
timing_mode: string;
|
|
26
|
+
timing_intensity: number;
|
|
27
|
+
}
|
|
28
|
+
type FormatFn = (v: number) => string;
|
|
29
|
+
|
|
30
|
+
type TweenTickHandler = (key: string, value: number) => void;
|
|
31
|
+
|
|
32
|
+
type ImageSource = string | File | Blob | HTMLImageElement;
|
|
33
|
+
|
|
34
|
+
type AudioraEventType = "start" | "stop" | "noteplay" | "imageload" | "error";
|
|
35
|
+
interface AudioraStartEvent extends CustomEvent<{
|
|
36
|
+
timestamp: number;
|
|
37
|
+
}> {
|
|
38
|
+
readonly type: "start";
|
|
39
|
+
}
|
|
40
|
+
interface AudioraStopEvent extends CustomEvent<{
|
|
41
|
+
timestamp: number;
|
|
42
|
+
duration: number;
|
|
43
|
+
}> {
|
|
44
|
+
readonly type: "stop";
|
|
45
|
+
}
|
|
46
|
+
interface AudioraNotePlayEvent extends CustomEvent<{
|
|
47
|
+
freq: number;
|
|
48
|
+
vel: number;
|
|
49
|
+
pan: number;
|
|
50
|
+
blockIndex: number;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
}> {
|
|
53
|
+
readonly type: "noteplay";
|
|
54
|
+
}
|
|
55
|
+
interface AudioraImageLoadEvent extends CustomEvent<{
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
blockCount: number;
|
|
59
|
+
}> {
|
|
60
|
+
readonly type: "imageload";
|
|
61
|
+
}
|
|
62
|
+
interface AudioraErrorEvent extends CustomEvent<{
|
|
63
|
+
error: Error;
|
|
64
|
+
context: string;
|
|
65
|
+
}> {
|
|
66
|
+
readonly type: "error";
|
|
67
|
+
}
|
|
68
|
+
interface AudioraEventMap {
|
|
69
|
+
start: AudioraStartEvent;
|
|
70
|
+
stop: AudioraStopEvent;
|
|
71
|
+
noteplay: AudioraNotePlayEvent;
|
|
72
|
+
imageload: AudioraImageLoadEvent;
|
|
73
|
+
error: AudioraErrorEvent;
|
|
74
|
+
}
|
|
75
|
+
type AudioraEvent = AudioraEventMap[AudioraEventType];
|
|
76
|
+
|
|
77
|
+
interface RenderOptions {
|
|
78
|
+
image?: ImageSource;
|
|
79
|
+
params?: Partial<PresetData>;
|
|
80
|
+
duration?: number;
|
|
81
|
+
sampleRate?: number;
|
|
82
|
+
}
|
|
83
|
+
type AudioraMode = "instrument" | "multimodal";
|
|
84
|
+
type VisionProviderName = "gemini" | "openai" | "anthropic" | "ollama";
|
|
85
|
+
type AudioraProviders = {
|
|
86
|
+
vision?: string;
|
|
87
|
+
audio?: "browser";
|
|
88
|
+
embeddings?: "local" | string;
|
|
89
|
+
speech?: "browser" | string;
|
|
90
|
+
browserAccess?: boolean;
|
|
91
|
+
};
|
|
92
|
+
interface LiveOptions {
|
|
93
|
+
waveCanvas?: HTMLCanvasElement;
|
|
94
|
+
mapCanvas?: HTMLCanvasElement;
|
|
95
|
+
onTweenTick?: TweenTickHandler;
|
|
96
|
+
mode?: AudioraMode;
|
|
97
|
+
providers?: AudioraProviders;
|
|
98
|
+
}
|
|
99
|
+
interface LoadedImageSample {
|
|
100
|
+
pixels: Uint8ClampedArray;
|
|
101
|
+
width: number;
|
|
102
|
+
height: number;
|
|
103
|
+
blockCount: number;
|
|
104
|
+
}
|
|
105
|
+
interface Audiora {
|
|
106
|
+
addEventListener<K extends AudioraEventType>(type: K, listener: (this: Audiora, event: AudioraEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
107
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
108
|
+
removeEventListener<K extends AudioraEventType>(type: K, listener: (this: Audiora, event: AudioraEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
109
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
110
|
+
}
|
|
111
|
+
declare class Audiora extends EventTarget {
|
|
112
|
+
private readonly state;
|
|
113
|
+
private readonly engine;
|
|
114
|
+
private readonly imageProcessor;
|
|
115
|
+
private readonly grid;
|
|
116
|
+
private readonly seq;
|
|
117
|
+
private readonly synth;
|
|
118
|
+
private readonly scheduler;
|
|
119
|
+
private readonly tweener;
|
|
120
|
+
private renderer;
|
|
121
|
+
private reverbDebounce;
|
|
122
|
+
private loadedImage;
|
|
123
|
+
private playStartTime;
|
|
124
|
+
private speechSource;
|
|
125
|
+
constructor(options?: LiveOptions);
|
|
126
|
+
get playing(): boolean;
|
|
127
|
+
attachVisuals(waveCanvas: HTMLCanvasElement, mapCanvas: HTMLCanvasElement): void;
|
|
128
|
+
resizeVisuals(): void;
|
|
129
|
+
readLoadedImage(): LoadedImageSample | null;
|
|
130
|
+
loadImage(image: ImageSource): Promise<void>;
|
|
131
|
+
play(soundscape?: Soundscape): Promise<void>;
|
|
132
|
+
stop(): void;
|
|
133
|
+
warmUp(): Promise<void>;
|
|
134
|
+
getParam(key: keyof PresetData): string | number;
|
|
135
|
+
setParam(key: keyof PresetData, value: string | number): void;
|
|
136
|
+
applyParams(patch: Partial<PresetData>, options?: {
|
|
137
|
+
tween?: boolean;
|
|
138
|
+
}): void;
|
|
139
|
+
captureParams(): Partial<PresetData>;
|
|
140
|
+
toAudioBuffer(options?: RenderOptions): Promise<AudioBuffer>;
|
|
141
|
+
toBlob(options?: RenderOptions): Promise<Blob>;
|
|
142
|
+
playDetachedAudio(bytes: ArrayBuffer): Promise<void>;
|
|
143
|
+
private stopSpeech;
|
|
144
|
+
private renderOffline;
|
|
145
|
+
private rebuildGrid;
|
|
146
|
+
private applyParamSideEffects;
|
|
147
|
+
private syncLiveAudioFromState;
|
|
148
|
+
private emit;
|
|
149
|
+
private emitError;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
type AnalysisTask = "description" | "color-analysis" | "sound-mapping" | "text-mapping" | "audio-intelligence" | "soundscape" | "semantic" | "narration";
|
|
153
|
+
type AudioIntelligence = {
|
|
154
|
+
duration: number;
|
|
155
|
+
sampleRate: number;
|
|
156
|
+
channels: number;
|
|
157
|
+
peak: number;
|
|
158
|
+
rms: number;
|
|
159
|
+
zeroCrossingRate: number;
|
|
160
|
+
spectralCentroid: number;
|
|
161
|
+
label: "dark" | "warm" | "bright" | "dense" | "sparse";
|
|
162
|
+
summary: string;
|
|
163
|
+
};
|
|
164
|
+
type ColorAnalysis = {
|
|
165
|
+
width: number;
|
|
166
|
+
height: number;
|
|
167
|
+
blockCount: number;
|
|
168
|
+
average: {
|
|
169
|
+
h: number;
|
|
170
|
+
s: number;
|
|
171
|
+
l: number;
|
|
172
|
+
};
|
|
173
|
+
palette: Array<{
|
|
174
|
+
h: number;
|
|
175
|
+
s: number;
|
|
176
|
+
l: number;
|
|
177
|
+
weight: number;
|
|
178
|
+
}>;
|
|
179
|
+
};
|
|
180
|
+
type Soundscape = {
|
|
181
|
+
source: "image" | "text" | "prompt";
|
|
182
|
+
label: string;
|
|
183
|
+
patch: PresetData;
|
|
184
|
+
};
|
|
185
|
+
type AnalyzeInput = {
|
|
186
|
+
image?: ImageSource;
|
|
187
|
+
text?: string;
|
|
188
|
+
prompt?: string;
|
|
189
|
+
buffer?: AudioBuffer;
|
|
190
|
+
tasks: AnalysisTask[];
|
|
191
|
+
onText?: (chunk: string) => void;
|
|
192
|
+
};
|
|
193
|
+
type ShortcutOptions = {
|
|
194
|
+
prompt?: string;
|
|
195
|
+
onText?: (chunk: string) => void;
|
|
196
|
+
};
|
|
197
|
+
type SemanticAudio = {
|
|
198
|
+
tags: string[];
|
|
199
|
+
mood: string;
|
|
200
|
+
embedding?: number[];
|
|
201
|
+
};
|
|
202
|
+
type ProviderKind = "vision" | "embeddings" | "speech";
|
|
203
|
+
type SpeechOutput = {
|
|
204
|
+
text: string;
|
|
205
|
+
} | {
|
|
206
|
+
audio: ArrayBuffer;
|
|
207
|
+
mimeType: string;
|
|
208
|
+
text?: string;
|
|
209
|
+
};
|
|
210
|
+
interface VisionAdapter {
|
|
211
|
+
kind: "vision";
|
|
212
|
+
name: string;
|
|
213
|
+
describe(input: {
|
|
214
|
+
image: ImageSource;
|
|
215
|
+
prompt?: string;
|
|
216
|
+
onText?: (chunk: string) => void;
|
|
217
|
+
browserAccess?: boolean;
|
|
218
|
+
}): Promise<string>;
|
|
219
|
+
}
|
|
220
|
+
interface EmbeddingsAdapter {
|
|
221
|
+
kind: "embeddings";
|
|
222
|
+
name: string;
|
|
223
|
+
embed(input: {
|
|
224
|
+
text: string;
|
|
225
|
+
browserAccess?: boolean;
|
|
226
|
+
}): Promise<number[]>;
|
|
227
|
+
}
|
|
228
|
+
interface SpeechAdapter {
|
|
229
|
+
kind: "speech";
|
|
230
|
+
name: string;
|
|
231
|
+
narrate(input: {
|
|
232
|
+
image?: ImageSource;
|
|
233
|
+
text?: string;
|
|
234
|
+
onText?: (chunk: string) => void;
|
|
235
|
+
browserAccess?: boolean;
|
|
236
|
+
}): Promise<SpeechOutput>;
|
|
237
|
+
}
|
|
238
|
+
type AnalyzeResult = {
|
|
239
|
+
description?: string;
|
|
240
|
+
color?: ColorAnalysis;
|
|
241
|
+
soundscape?: Soundscape;
|
|
242
|
+
audio?: AudioIntelligence;
|
|
243
|
+
semantic?: SemanticAudio;
|
|
244
|
+
narration?: string | SpeechOutput;
|
|
245
|
+
soundscapes?: Soundscape[];
|
|
246
|
+
};
|
|
247
|
+
interface Multimodal {
|
|
248
|
+
analyze(input: AnalyzeInput): Promise<AnalyzeResult>;
|
|
249
|
+
playSoundscape(soundscape: Soundscape): Promise<void>;
|
|
250
|
+
speak(value?: string | SpeechOutput): void | Promise<void>;
|
|
251
|
+
describe(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
252
|
+
soundify(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
253
|
+
interpret(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
254
|
+
narrate(image: ImageSource, options?: ShortcutOptions): Promise<AnalyzeResult>;
|
|
255
|
+
explore(image: ImageSource): Promise<AnalyzeResult>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export { Audiora as A, type ColorAnalysis as C, type EmbeddingsAdapter as E, type FormatFn as F, type ImageSource as I, type LiveOptions as L, type Multimodal as M, type ProviderKind as P, type RenderOptions as R, type SpeechAdapter as S, type VisionAdapter as V, type AudioraProviders as a, type AnalysisTask as b, type AnalyzeInput as c, type AnalyzeResult as d, type AudioIntelligence as e, type SemanticAudio as f, type ShortcutOptions as g, type Soundscape as h, type SpeechOutput as i, type VisionProviderName as j, type PresetData as k, type AudioraErrorEvent as l, type AudioraEvent as m, type AudioraEventMap as n, type AudioraEventType as o, type AudioraImageLoadEvent as p, type AudioraMode as q, type AudioraNotePlayEvent as r, type AudioraStartEvent as s, type AudioraStopEvent as t };
|
package/package.json
CHANGED
|
@@ -1,30 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "audiora",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Multimodal intelligence for picture synthesis",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"audio",
|
|
7
7
|
"web-audio",
|
|
8
8
|
"synthesis",
|
|
9
9
|
"picture-driven",
|
|
10
10
|
"canvas",
|
|
11
|
-
"typescript",
|
|
12
11
|
"music",
|
|
13
|
-
"instrument"
|
|
12
|
+
"instrument",
|
|
13
|
+
"multimodal",
|
|
14
|
+
"vision",
|
|
15
|
+
"narration"
|
|
14
16
|
],
|
|
15
17
|
"license": "MIT",
|
|
16
18
|
"author": "whosramoss",
|
|
17
19
|
"type": "module",
|
|
18
|
-
"main": "
|
|
19
|
-
"
|
|
20
|
+
"main": "./dist/index.cjs",
|
|
21
|
+
"module": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
20
23
|
"exports": {
|
|
21
|
-
".":
|
|
24
|
+
".": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/index.d.cts",
|
|
31
|
+
"default": "./dist/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./ai": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/ai/index.d.ts",
|
|
37
|
+
"default": "./dist/ai/index.js"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/ai/index.d.cts",
|
|
41
|
+
"default": "./dist/ai/index.cjs"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
22
44
|
},
|
|
23
45
|
"files": [
|
|
24
|
-
"
|
|
25
|
-
"docs",
|
|
46
|
+
"dist",
|
|
26
47
|
"CHANGELOG.md"
|
|
27
48
|
],
|
|
49
|
+
"sideEffects": false,
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"build:watch": "tsup --watch",
|
|
53
|
+
"dev": "tsup --watch",
|
|
54
|
+
"typecheck": "tsc --noEmit",
|
|
55
|
+
"test": "esbuild tests/ai/security.test.ts --bundle --platform=node --format=esm --outfile=dist-tests/security.test.mjs && node --test dist-tests/security.test.mjs",
|
|
56
|
+
"prepare": "tsup",
|
|
57
|
+
"prepublishOnly": "npm run build"
|
|
58
|
+
},
|
|
28
59
|
"repository": {
|
|
29
60
|
"type": "git",
|
|
30
61
|
"url": "git+https://github.com/whosramoss/audiora.git"
|
|
@@ -34,6 +65,11 @@
|
|
|
34
65
|
"url": "https://github.com/whosramoss/audiora/issues"
|
|
35
66
|
},
|
|
36
67
|
"devDependencies": {
|
|
68
|
+
"esbuild": "^0.28.1",
|
|
69
|
+
"tsup": "^8.0.0",
|
|
37
70
|
"typescript": "^5.5.0"
|
|
71
|
+
},
|
|
72
|
+
"overrides": {
|
|
73
|
+
"esbuild": "^0.28.1"
|
|
38
74
|
}
|
|
39
75
|
}
|