sa2kit 1.4.2 → 1.5.1
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/ConfigService-7MEZXKJ5.js +21 -0
- package/dist/ConfigService-7MEZXKJ5.js.map +1 -0
- package/dist/ConfigService-BV57YYFW.mjs +4 -0
- package/dist/ConfigService-BV57YYFW.mjs.map +1 -0
- package/dist/ConfigService-BxK06xP6.d.mts +262 -0
- package/dist/ConfigService-BxK06xP6.d.ts +262 -0
- package/dist/audioDetection/index.d.mts +449 -0
- package/dist/audioDetection/index.d.ts +449 -0
- package/dist/audioDetection/index.js +1244 -0
- package/dist/audioDetection/index.js.map +1 -0
- package/dist/audioDetection/index.mjs +1227 -0
- package/dist/audioDetection/index.mjs.map +1 -0
- package/dist/chunk-5XUE72Y3.mjs +1001 -0
- package/dist/chunk-5XUE72Y3.mjs.map +1 -0
- package/dist/chunk-DQVPZTVC.js +1009 -0
- package/dist/chunk-DQVPZTVC.js.map +1 -0
- package/dist/chunk-NEPD75MX.mjs +467 -0
- package/dist/chunk-NEPD75MX.mjs.map +1 -0
- package/dist/chunk-OEDY7GI4.js +473 -0
- package/dist/chunk-OEDY7GI4.js.map +1 -0
- package/dist/chunk-TFQF2HDO.mjs +354 -0
- package/dist/chunk-TFQF2HDO.mjs.map +1 -0
- package/dist/chunk-TOC5FSHP.js +358 -0
- package/dist/chunk-TOC5FSHP.js.map +1 -0
- package/dist/imageCrop/index.d.mts +165 -0
- package/dist/imageCrop/index.d.ts +165 -0
- package/dist/imageCrop/index.js +559 -0
- package/dist/imageCrop/index.js.map +1 -0
- package/dist/imageCrop/index.mjs +540 -0
- package/dist/imageCrop/index.mjs.map +1 -0
- package/dist/index.d.mts +139 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.js +670 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +662 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mmd/index.d.mts +113 -2
- package/dist/mmd/index.d.ts +113 -2
- package/dist/mmd/index.js +484 -2
- package/dist/mmd/index.js.map +1 -1
- package/dist/mmd/index.mjs +482 -4
- package/dist/mmd/index.mjs.map +1 -1
- package/dist/testYourself/admin/index.d.mts +58 -0
- package/dist/testYourself/admin/index.d.ts +58 -0
- package/dist/testYourself/admin/index.js +17 -0
- package/dist/testYourself/admin/index.js.map +1 -0
- package/dist/testYourself/admin/index.mjs +4 -0
- package/dist/testYourself/admin/index.mjs.map +1 -0
- package/dist/testYourself/index.d.mts +6 -98
- package/dist/testYourself/index.d.ts +6 -98
- package/dist/testYourself/index.js +90 -334
- package/dist/testYourself/index.js.map +1 -1
- package/dist/testYourself/index.mjs +47 -333
- package/dist/testYourself/index.mjs.map +1 -1
- package/dist/testYourself/server/index.d.mts +1029 -0
- package/dist/testYourself/server/index.d.ts +1029 -0
- package/dist/testYourself/server/index.js +42 -0
- package/dist/testYourself/server/index.js.map +1 -0
- package/dist/testYourself/server/index.mjs +5 -0
- package/dist/testYourself/server/index.mjs.map +1 -0
- package/dist/universalFile/server/index.js +5 -5
- package/dist/universalFile/server/index.mjs +1 -1
- package/package.json +62 -20
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 音频检测模块类型定义
|
|
5
|
+
* Audio Detection Module Type Definitions
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 音符信息
|
|
9
|
+
* Note Information
|
|
10
|
+
*/
|
|
11
|
+
interface NoteInfo {
|
|
12
|
+
/** 音符名称 (例如: "C4", "A#3") */
|
|
13
|
+
name: string;
|
|
14
|
+
/** 频率 (Hz) */
|
|
15
|
+
frequency: number;
|
|
16
|
+
/** 音高类别 (不含八度,例如: "C", "A#") */
|
|
17
|
+
noteName: string;
|
|
18
|
+
/** 八度 */
|
|
19
|
+
octave: number;
|
|
20
|
+
/** 音符的MIDI编号 */
|
|
21
|
+
midi: number;
|
|
22
|
+
/** 音量/强度 (0-1) */
|
|
23
|
+
volume: number;
|
|
24
|
+
/** 音符检测的置信度 (0-1) */
|
|
25
|
+
confidence: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 和弦信息
|
|
29
|
+
* Chord Information
|
|
30
|
+
*/
|
|
31
|
+
interface ChordInfo {
|
|
32
|
+
/** 和弦名称 (例如: "Cmaj", "Am7") */
|
|
33
|
+
name: string;
|
|
34
|
+
/** 根音 */
|
|
35
|
+
root: string;
|
|
36
|
+
/** 和弦类型 (例如: "major", "minor", "diminished") */
|
|
37
|
+
type: string;
|
|
38
|
+
/** 组成音符 */
|
|
39
|
+
notes: NoteInfo[];
|
|
40
|
+
/** 和弦检测的置信度 (0-1) */
|
|
41
|
+
confidence: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 音频检测结果
|
|
45
|
+
* Audio Detection Result
|
|
46
|
+
*/
|
|
47
|
+
interface AudioDetectionResult {
|
|
48
|
+
/** 检测到的所有音符 */
|
|
49
|
+
notes: NoteInfo[];
|
|
50
|
+
/** 检测到的和弦(如果有) */
|
|
51
|
+
chord?: ChordInfo;
|
|
52
|
+
/** 检测时间戳 */
|
|
53
|
+
timestamp: number;
|
|
54
|
+
/** 是否正在检测到声音 */
|
|
55
|
+
isDetecting: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 音频输入配置
|
|
59
|
+
* Audio Input Configuration
|
|
60
|
+
*/
|
|
61
|
+
interface AudioInputConfig {
|
|
62
|
+
/** 采样率 (默认: 44100) */
|
|
63
|
+
sampleRate?: number;
|
|
64
|
+
/** FFT大小 (默认: 4096) */
|
|
65
|
+
fftSize?: number;
|
|
66
|
+
/** 最小音量阈值 (0-1, 默认: 0.01) */
|
|
67
|
+
minVolume?: number;
|
|
68
|
+
/** 最小检测置信度 (0-1, 默认: 0.7) */
|
|
69
|
+
minConfidence?: number;
|
|
70
|
+
/** 平滑系数 (0-1, 默认: 0.8) */
|
|
71
|
+
smoothing?: number;
|
|
72
|
+
/** 检测频率范围 */
|
|
73
|
+
frequencyRange?: {
|
|
74
|
+
min: number;
|
|
75
|
+
max: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 音频输入状态
|
|
80
|
+
* Audio Input State
|
|
81
|
+
*/
|
|
82
|
+
type AudioInputState = 'idle' | 'initializing' | 'active' | 'error' | 'stopped';
|
|
83
|
+
/**
|
|
84
|
+
* 音频检测器事件
|
|
85
|
+
* Audio Detector Events
|
|
86
|
+
*/
|
|
87
|
+
interface AudioDetectorEvents {
|
|
88
|
+
/** 检测到新的音频结果 */
|
|
89
|
+
onDetection?: (result: AudioDetectionResult) => void;
|
|
90
|
+
/** 状态变化 */
|
|
91
|
+
onStateChange?: (state: AudioInputState) => void;
|
|
92
|
+
/** 错误发生 */
|
|
93
|
+
onError?: (error: Error) => void;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 频率到音符的映射
|
|
97
|
+
* Frequency to Note Mapping
|
|
98
|
+
*/
|
|
99
|
+
interface FrequencyToNoteMap {
|
|
100
|
+
[frequency: number]: NoteInfo;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 音频输入服务
|
|
105
|
+
* Audio Input Service
|
|
106
|
+
*
|
|
107
|
+
* 负责管理麦克风输入和音频流处理
|
|
108
|
+
* Manages microphone input and audio stream processing
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
declare class AudioInputService {
|
|
112
|
+
private audioContext;
|
|
113
|
+
private mediaStream;
|
|
114
|
+
private sourceNode;
|
|
115
|
+
private analyserNode;
|
|
116
|
+
private state;
|
|
117
|
+
private config;
|
|
118
|
+
constructor(config?: AudioInputConfig);
|
|
119
|
+
/**
|
|
120
|
+
* 初始化音频输入
|
|
121
|
+
* Initialize audio input
|
|
122
|
+
*/
|
|
123
|
+
initialize(): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* 获取时域数据
|
|
126
|
+
* Get time domain data
|
|
127
|
+
*/
|
|
128
|
+
getTimeDomainData(): Float32Array;
|
|
129
|
+
/**
|
|
130
|
+
* 获取频域数据
|
|
131
|
+
* Get frequency domain data
|
|
132
|
+
*/
|
|
133
|
+
getFrequencyData(): Float32Array;
|
|
134
|
+
/**
|
|
135
|
+
* 获取当前音量
|
|
136
|
+
* Get current volume
|
|
137
|
+
*/
|
|
138
|
+
getCurrentVolume(): number;
|
|
139
|
+
/**
|
|
140
|
+
* 停止音频输入
|
|
141
|
+
* Stop audio input
|
|
142
|
+
*/
|
|
143
|
+
stop(): void;
|
|
144
|
+
/**
|
|
145
|
+
* 获取当前状态
|
|
146
|
+
* Get current state
|
|
147
|
+
*/
|
|
148
|
+
getState(): AudioInputState;
|
|
149
|
+
/**
|
|
150
|
+
* 获取配置
|
|
151
|
+
* Get configuration
|
|
152
|
+
*/
|
|
153
|
+
getConfig(): Required<AudioInputConfig>;
|
|
154
|
+
/**
|
|
155
|
+
* 获取音频上下文
|
|
156
|
+
* Get audio context
|
|
157
|
+
*/
|
|
158
|
+
getAudioContext(): AudioContext | null;
|
|
159
|
+
/**
|
|
160
|
+
* 获取分析器节点
|
|
161
|
+
* Get analyser node
|
|
162
|
+
*/
|
|
163
|
+
getAnalyserNode(): AnalyserNode | null;
|
|
164
|
+
/**
|
|
165
|
+
* 设置状态
|
|
166
|
+
* Set state
|
|
167
|
+
*/
|
|
168
|
+
private setState;
|
|
169
|
+
/**
|
|
170
|
+
* 检查是否正在运行
|
|
171
|
+
* Check if running
|
|
172
|
+
*/
|
|
173
|
+
isRunning(): boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 音高检测器
|
|
178
|
+
* Pitch Detector
|
|
179
|
+
*
|
|
180
|
+
* 使用自相关算法检测音频中的音高
|
|
181
|
+
* Uses autocorrelation algorithm to detect pitch in audio
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
declare class PitchDetector {
|
|
185
|
+
private sampleRate;
|
|
186
|
+
private minFrequency;
|
|
187
|
+
private maxFrequency;
|
|
188
|
+
private static readonly NOTE_NAMES;
|
|
189
|
+
constructor(sampleRate?: number, minFrequency?: number, maxFrequency?: number);
|
|
190
|
+
/**
|
|
191
|
+
* 检测音高
|
|
192
|
+
* Detect pitch using autocorrelation
|
|
193
|
+
*/
|
|
194
|
+
detectPitch(audioBuffer: Float32Array, minVolume?: number): number | null;
|
|
195
|
+
/**
|
|
196
|
+
* 自相关算法
|
|
197
|
+
* Autocorrelation algorithm
|
|
198
|
+
*/
|
|
199
|
+
private autoCorrelate;
|
|
200
|
+
/**
|
|
201
|
+
* 计算RMS音量
|
|
202
|
+
* Calculate RMS volume
|
|
203
|
+
*/
|
|
204
|
+
private calculateRMS;
|
|
205
|
+
/**
|
|
206
|
+
* 将频率转换为音符信息
|
|
207
|
+
* Convert frequency to note information
|
|
208
|
+
*/
|
|
209
|
+
frequencyToNote(frequency: number, volume?: number): NoteInfo | null;
|
|
210
|
+
/**
|
|
211
|
+
* 使用FFT检测主频率
|
|
212
|
+
* Detect dominant frequency using FFT
|
|
213
|
+
*/
|
|
214
|
+
detectDominantFrequency(frequencyData: Float32Array, minVolume?: number): number | null;
|
|
215
|
+
/**
|
|
216
|
+
* 抛物线插值
|
|
217
|
+
* Parabolic interpolation for better frequency estimation
|
|
218
|
+
*/
|
|
219
|
+
private parabolicInterpolation;
|
|
220
|
+
/**
|
|
221
|
+
* 检测多个音高(和弦)
|
|
222
|
+
* Detect multiple pitches (chords)
|
|
223
|
+
*/
|
|
224
|
+
detectMultiplePitches(frequencyData: Float32Array, minVolume?: number): NoteInfo[];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* 和弦识别器
|
|
229
|
+
* Chord Recognizer
|
|
230
|
+
*
|
|
231
|
+
* 根据检测到的音符识别和弦
|
|
232
|
+
* Recognizes chords based on detected notes
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
declare class ChordRecognizer {
|
|
236
|
+
private static readonly CHORD_PATTERNS;
|
|
237
|
+
private static readonly NOTE_NAMES;
|
|
238
|
+
/**
|
|
239
|
+
* 识别和弦
|
|
240
|
+
* Recognize chord from notes
|
|
241
|
+
*/
|
|
242
|
+
recognizeChord(notes: NoteInfo[]): ChordInfo | null;
|
|
243
|
+
/**
|
|
244
|
+
* 获取唯一的音符类别(不考虑八度)
|
|
245
|
+
* Get unique note classes (ignoring octave)
|
|
246
|
+
*/
|
|
247
|
+
private getUniqueNoteClasses;
|
|
248
|
+
/**
|
|
249
|
+
* 计算音程
|
|
250
|
+
* Calculate intervals from root
|
|
251
|
+
*/
|
|
252
|
+
private calculateIntervals;
|
|
253
|
+
/**
|
|
254
|
+
* 匹配和弦模式
|
|
255
|
+
* Match chord pattern
|
|
256
|
+
*/
|
|
257
|
+
private matchPattern;
|
|
258
|
+
/**
|
|
259
|
+
* 获取和弦后缀
|
|
260
|
+
* Get chord suffix for display
|
|
261
|
+
*/
|
|
262
|
+
private getChordSuffix;
|
|
263
|
+
/**
|
|
264
|
+
* 识别八度内的音程(用于简单的音程识别)
|
|
265
|
+
* Recognize interval within an octave
|
|
266
|
+
*/
|
|
267
|
+
recognizeInterval(note1: NoteInfo, note2: NoteInfo): string;
|
|
268
|
+
/**
|
|
269
|
+
* 分析和弦质量
|
|
270
|
+
* Analyze chord quality
|
|
271
|
+
*/
|
|
272
|
+
analyzeChordQuality(chord: ChordInfo): string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* 音频检测器 - 主控制器
|
|
277
|
+
* Audio Detector - Main Controller
|
|
278
|
+
*
|
|
279
|
+
* 整合音频输入、音高检测和和弦识别
|
|
280
|
+
* Integrates audio input, pitch detection, and chord recognition
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
declare class AudioDetector {
|
|
284
|
+
private audioInput;
|
|
285
|
+
private pitchDetector;
|
|
286
|
+
private chordRecognizer;
|
|
287
|
+
private isDetecting;
|
|
288
|
+
private animationFrameId;
|
|
289
|
+
private events;
|
|
290
|
+
private lastResult;
|
|
291
|
+
constructor(config?: AudioInputConfig, events?: AudioDetectorEvents);
|
|
292
|
+
/**
|
|
293
|
+
* 启动音频检测
|
|
294
|
+
* Start audio detection
|
|
295
|
+
*/
|
|
296
|
+
start(): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* 停止音频检测
|
|
299
|
+
* Stop audio detection
|
|
300
|
+
*/
|
|
301
|
+
stop(): void;
|
|
302
|
+
/**
|
|
303
|
+
* 检测循环
|
|
304
|
+
* Detection loop
|
|
305
|
+
*/
|
|
306
|
+
private detectLoop;
|
|
307
|
+
/**
|
|
308
|
+
* 执行一次检测
|
|
309
|
+
* Perform single detection
|
|
310
|
+
*/
|
|
311
|
+
private detect;
|
|
312
|
+
/**
|
|
313
|
+
* 获取当前状态
|
|
314
|
+
* Get current state
|
|
315
|
+
*/
|
|
316
|
+
getState(): AudioInputState;
|
|
317
|
+
/**
|
|
318
|
+
* 获取最后的检测结果
|
|
319
|
+
* Get last detection result
|
|
320
|
+
*/
|
|
321
|
+
getLastResult(): AudioDetectionResult | null;
|
|
322
|
+
/**
|
|
323
|
+
* 检查是否正在运行
|
|
324
|
+
* Check if running
|
|
325
|
+
*/
|
|
326
|
+
isRunning(): boolean;
|
|
327
|
+
/**
|
|
328
|
+
* 获取音频输入服务
|
|
329
|
+
* Get audio input service
|
|
330
|
+
*/
|
|
331
|
+
getAudioInput(): AudioInputService;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* 音频检测调试工具
|
|
336
|
+
* Audio Detection Debug Tool
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
declare class AudioDetectorDebugger {
|
|
340
|
+
private detector;
|
|
341
|
+
private debugInterval;
|
|
342
|
+
constructor(config?: AudioInputConfig);
|
|
343
|
+
start(): Promise<void>;
|
|
344
|
+
stop(): void;
|
|
345
|
+
getDetector(): AudioDetector;
|
|
346
|
+
/**
|
|
347
|
+
* 测试麦克风是否正常工作
|
|
348
|
+
*/
|
|
349
|
+
testMicrophone(): Promise<{
|
|
350
|
+
hasPermission: boolean;
|
|
351
|
+
isReceivingAudio: boolean;
|
|
352
|
+
averageVolume: number;
|
|
353
|
+
peakVolume: number;
|
|
354
|
+
}>;
|
|
355
|
+
}
|
|
356
|
+
declare function debugAudioDetection(config?: AudioInputConfig): Promise<AudioDetectorDebugger>;
|
|
357
|
+
declare function testMicrophone(): Promise<void>;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* 音频检测 React Hook
|
|
361
|
+
* Audio Detection React Hook
|
|
362
|
+
*/
|
|
363
|
+
|
|
364
|
+
interface UseAudioDetectionOptions extends AudioInputConfig {
|
|
365
|
+
/** 是否自动开始检测 */
|
|
366
|
+
autoStart?: boolean;
|
|
367
|
+
/** 检测结果更新间隔(毫秒) */
|
|
368
|
+
updateInterval?: number;
|
|
369
|
+
}
|
|
370
|
+
interface UseAudioDetectionReturn {
|
|
371
|
+
/** 当前检测结果 */
|
|
372
|
+
result: AudioDetectionResult | null;
|
|
373
|
+
/** 音频输入状态 */
|
|
374
|
+
state: AudioInputState;
|
|
375
|
+
/** 是否正在检测 */
|
|
376
|
+
isDetecting: boolean;
|
|
377
|
+
/** 错误信息 */
|
|
378
|
+
error: Error | null;
|
|
379
|
+
/** 启动检测 */
|
|
380
|
+
start: () => Promise<void>;
|
|
381
|
+
/** 停止检测 */
|
|
382
|
+
stop: () => void;
|
|
383
|
+
/** 获取检测器实例 */
|
|
384
|
+
getDetector: () => AudioDetector | null;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* 使用音频检测的 Hook
|
|
388
|
+
* Hook for using audio detection
|
|
389
|
+
*/
|
|
390
|
+
declare function useAudioDetection(options?: UseAudioDetectionOptions): UseAudioDetectionReturn;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* 音频检测组件
|
|
394
|
+
* Audio Detection Component
|
|
395
|
+
*
|
|
396
|
+
* 显示实时音频检测结果的React组件
|
|
397
|
+
* React component for displaying real-time audio detection results
|
|
398
|
+
*/
|
|
399
|
+
|
|
400
|
+
interface AudioDetectionDisplayProps extends UseAudioDetectionOptions {
|
|
401
|
+
/** 自定义类名 */
|
|
402
|
+
className?: string;
|
|
403
|
+
/** 是否显示调试信息 */
|
|
404
|
+
showDebugInfo?: boolean;
|
|
405
|
+
/** 自定义渲染音符 */
|
|
406
|
+
renderNote?: (note: NoteInfo) => React__default.ReactNode;
|
|
407
|
+
/** 自定义渲染和弦 */
|
|
408
|
+
renderChord?: (chord: ChordInfo) => React__default.ReactNode;
|
|
409
|
+
/** 开始按钮文本 */
|
|
410
|
+
startButtonText?: string;
|
|
411
|
+
/** 停止按钮文本 */
|
|
412
|
+
stopButtonText?: string;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* 音频检测显示组件
|
|
416
|
+
*/
|
|
417
|
+
declare const AudioDetectionDisplay: React__default.FC<AudioDetectionDisplayProps>;
|
|
418
|
+
/**
|
|
419
|
+
* 默认样式(可以通过CSS覆盖)
|
|
420
|
+
*/
|
|
421
|
+
declare const audioDetectionStyles = "\n.audio-detection-display {\n padding: 20px;\n border: 1px solid #ddd;\n border-radius: 8px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n}\n\n.audio-detection-controls {\n display: flex;\n gap: 12px;\n align-items: center;\n margin-bottom: 20px;\n}\n\n.audio-detection-button {\n padding: 10px 20px;\n font-size: 16px;\n border: none;\n border-radius: 6px;\n background-color: #007bff;\n color: white;\n cursor: pointer;\n transition: background-color 0.3s;\n}\n\n.audio-detection-button:hover {\n background-color: #0056b3;\n}\n\n.audio-detection-button:disabled {\n background-color: #ccc;\n cursor: not-allowed;\n}\n\n.audio-detection-button.active {\n background-color: #dc3545;\n}\n\n.audio-detection-button.active:hover {\n background-color: #c82333;\n}\n\n.audio-detection-status {\n padding: 8px 16px;\n border-radius: 4px;\n font-size: 14px;\n}\n\n.status-idle { background-color: #e7f3ff; color: #004085; }\n.status-initializing { background-color: #fff3cd; color: #856404; }\n.status-active { background-color: #d4edda; color: #155724; }\n.status-error { background-color: #f8d7da; color: #721c24; }\n.status-stopped { background-color: #e2e3e5; color: #383d41; }\n\n.audio-detection-error {\n padding: 12px;\n background-color: #f8d7da;\n border: 1px solid #f5c6cb;\n border-radius: 4px;\n color: #721c24;\n margin-bottom: 16px;\n}\n\n.audio-detection-result {\n margin-top: 20px;\n}\n\n.audio-detection-notes h3,\n.audio-detection-chord h3 {\n margin-bottom: 12px;\n font-size: 18px;\n}\n\n.notes-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));\n gap: 12px;\n}\n\n.note-item {\n padding: 12px;\n border: 2px solid #007bff;\n border-radius: 6px;\n background-color: #f8f9fa;\n}\n\n.default-note-display {\n text-align: center;\n}\n\n.note-name {\n font-size: 24px;\n font-weight: bold;\n color: #007bff;\n margin-bottom: 4px;\n}\n\n.note-frequency {\n font-size: 14px;\n color: #666;\n margin-bottom: 4px;\n}\n\n.note-confidence {\n font-size: 12px;\n color: #999;\n}\n\n.audio-detection-chord {\n margin-top: 20px;\n padding: 16px;\n border: 2px solid #28a745;\n border-radius: 8px;\n background-color: #f8f9fa;\n}\n\n.default-chord-display {\n text-align: center;\n}\n\n.chord-name {\n font-size: 32px;\n font-weight: bold;\n color: #28a745;\n margin-bottom: 8px;\n}\n\n.chord-type,\n.chord-notes,\n.chord-confidence {\n margin-bottom: 4px;\n color: #666;\n}\n\n.audio-detection-waiting {\n text-align: center;\n padding: 40px;\n color: #666;\n font-size: 18px;\n}\n\n.audio-detection-debug {\n margin-top: 20px;\n padding: 12px;\n background-color: #f4f4f4;\n border-radius: 4px;\n}\n\n.audio-detection-debug pre {\n margin: 8px 0 0 0;\n font-size: 12px;\n overflow-x: auto;\n}\n";
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* 钢琴键盘可视化组件
|
|
425
|
+
* Piano Keyboard Visualization Component
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
interface PianoKeyboardProps {
|
|
429
|
+
/** 当前激活的音符 */
|
|
430
|
+
activeNotes?: NoteInfo[];
|
|
431
|
+
/** 起始八度 (默认: 2) */
|
|
432
|
+
startOctave?: number;
|
|
433
|
+
/** 结束八度 (默认: 6) */
|
|
434
|
+
endOctave?: number;
|
|
435
|
+
/** 自定义类名 */
|
|
436
|
+
className?: string;
|
|
437
|
+
/** 是否显示音符名称 */
|
|
438
|
+
showNoteNames?: boolean;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* 钢琴键盘可视化
|
|
442
|
+
*/
|
|
443
|
+
declare const PianoKeyboard: React__default.FC<PianoKeyboardProps>;
|
|
444
|
+
/**
|
|
445
|
+
* 钢琴键盘样式
|
|
446
|
+
*/
|
|
447
|
+
declare const pianoKeyboardStyles = "\n.piano-keyboard {\n width: 100%;\n padding: 20px;\n background-color: #2c3e50;\n border-radius: 8px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);\n}\n\n.piano-keys-container {\n position: relative;\n width: 100%;\n height: 200px;\n}\n\n.white-keys {\n display: flex;\n height: 100%;\n gap: 2px;\n}\n\n.piano-key {\n position: relative;\n border: 1px solid #000;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.white-key {\n flex: 1;\n background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 100%);\n border-radius: 0 0 4px 4px;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n padding-bottom: 8px;\n}\n\n.white-key:hover {\n background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 100%);\n}\n\n.white-key.active {\n background: linear-gradient(to bottom, #4CAF50 0%, #45a049 100%) !important;\n box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);\n}\n\n.black-keys {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 60%;\n pointer-events: none;\n}\n\n.black-key {\n position: absolute;\n width: calc(100% / 52 * 0.6); /* \u5047\u8BBE\u670952\u4E2A\u767D\u952E\u7684\u5BBD\u5EA6 */\n height: 100%;\n background: linear-gradient(to bottom, #2c3e50 0%, #1a252f 100%);\n border-radius: 0 0 3px 3px;\n pointer-events: all;\n transform: translateX(-50%);\n display: flex;\n align-items: flex-end;\n justify-content: center;\n padding-bottom: 6px;\n z-index: 10;\n}\n\n.black-key:hover {\n background: linear-gradient(to bottom, #34495e 0%, #2c3e50 100%);\n}\n\n.black-key.active {\n background: linear-gradient(to bottom, #4CAF50 0%, #388E3C 100%) !important;\n box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);\n}\n\n.key-label {\n font-size: 11px;\n font-weight: bold;\n user-select: none;\n}\n\n.white-key .key-label {\n color: #666;\n}\n\n.white-key.active .key-label {\n color: white;\n}\n\n.black-key .key-label {\n color: #ddd;\n}\n\n.black-key.active .key-label {\n color: white;\n}\n";
|
|
448
|
+
|
|
449
|
+
export { AudioDetectionDisplay, type AudioDetectionDisplayProps, type AudioDetectionResult, AudioDetector, AudioDetectorDebugger, type AudioDetectorEvents, type AudioInputConfig, AudioInputService, type AudioInputState, type ChordInfo, ChordRecognizer, type FrequencyToNoteMap, type NoteInfo, PianoKeyboard, type PianoKeyboardProps, PitchDetector, type UseAudioDetectionOptions, type UseAudioDetectionReturn, audioDetectionStyles, debugAudioDetection, pianoKeyboardStyles, testMicrophone, useAudioDetection };
|