Skip to content

Commit 56e4917

Browse files
feat: wire onset trigger options into recordAudio and update visuals
Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
1 parent 801de42 commit 56e4917

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/lib/components/Voice.svelte

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
1111
const logger = createLogger('Voice');
1212
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+
1323
// This component represents the "Voice" settings for a sample slot.
1424
// It displays an icon indicating its purpose and acts as a drop target for audio files.
1525
@@ -61,8 +71,8 @@
6171
let backgroundStyle = $derived(
6272
isDragOver
6373
? '' // 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
6676
: recordingStatus === 'error'
6777
? 'background-color: #fee2e2;' // Red tint for error
6878
: uploadStatus === 'success'
@@ -259,7 +269,8 @@
259269
260270
const processedAudio = await recordAudio(
261271
{
262-
deviceId: audioInputState.selectedDeviceId || undefined
272+
deviceId: audioInputState.selectedDeviceId || undefined,
273+
...(USE_ONSET_TRIGGER ? ONSET_TRIGGER_OPTIONS : {})
263274
},
264275
(progress: RecordingProgress) => {
265276
// Update recording status based on progress

0 commit comments

Comments
 (0)