|
10 | 10 |
|
11 | 11 | const logger = createLogger('Voice'); |
12 | 12 |
|
| 13 | + // Onset-trigger config (simple wiring; replace with UI controls later if desired) |
| 14 | + const USE_ONSET_TRIGGER = true; |
| 15 | + const ONSET_TRIGGER_OPTIONS = { |
| 16 | + threshold: 0.5, // 0..1 linear |
| 17 | + preRollMs: 120, // include a short lead-in |
| 18 | + holdMs: 12, // minimum ms above threshold |
| 19 | + timeoutMs: 10000, // abort if no trigger within 10s |
| 20 | + highpassHz: 80 // reduce low-frequency rumble |
| 21 | + }; |
| 22 | +
|
13 | 23 | // This component represents the "Voice" settings for a sample slot. |
14 | 24 | // It displays an icon indicating its purpose and acts as a drop target for audio files. |
15 | 25 |
|
|
61 | 71 | let backgroundStyle = $derived( |
62 | 72 | isDragOver |
63 | 73 | ? '' // When dragging over, let Tailwind class 'bg-blue-100' handle background |
64 | | - : recordingStatus === 'recording' || recordingStatus === 'processing' |
65 | | - ? 'background-color: #fef3c7;' // Yellow tint while recording |
| 74 | + : (recordingStatus === 'waiting' || recordingStatus === 'recording' || recordingStatus === 'processing') |
| 75 | + ? 'background-color: #fef3c7;' // Yellow tint while arming/recording/processing |
66 | 76 | : recordingStatus === 'error' |
67 | 77 | ? 'background-color: #fee2e2;' // Red tint for error |
68 | 78 | : uploadStatus === 'success' |
|
259 | 269 |
|
260 | 270 | const processedAudio = await recordAudio( |
261 | 271 | { |
262 | | - deviceId: audioInputState.selectedDeviceId || undefined |
| 272 | + deviceId: audioInputState.selectedDeviceId || undefined, |
| 273 | + ...(USE_ONSET_TRIGGER ? ONSET_TRIGGER_OPTIONS : {}) |
263 | 274 | }, |
264 | 275 | (progress: RecordingProgress) => { |
265 | 276 | // Update recording status based on progress |
|
0 commit comments