# Architecture of the Import and Enhance Feature for Existing Audio Files in Meetily

> Explore Meetily's import and enhance audio feature architecture. Discover how our Rust pipeline validates, decodes, and refines audio using VAD for supreme transcription accuracy.

- Repository: [Zackriya Solutions/meetily](https://github.com/Zackriya-Solutions/meetily)
- Tags: architecture
- Published: 2026-07-25

---

**Meetily's import and enhance feature processes existing audio files through a Rust-based pipeline that validates, decodes, and resamples the input before running Voice Activity Detection and optional segment splitting to maximize transcription accuracy.**

The import and enhance architecture in Meetily allows users to bring external recordings—such as `.mp4`, `.wav`, or `.mp3` files—into the application as fully searchable meetings. According to the Meetily source code, this workflow is implemented as a sequential batch pipeline in [`frontend/src-tauri/src/audio/import.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/audio/import.rs), reusing core audio processing modules from the live recording system while providing granular progress events for UI feedback.

## Stage 1: File Validation and Meeting Initialization

The workflow begins when the frontend invokes `select_and_validate_audio_command`, which opens a file-picker dialog and performs strict validation checks.

In [`frontend/src-tauri/src/audio/import.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/audio/import.rs) (lines 16-48), the `validate_audio_file` function verifies:
- File existence and readable permissions
- Supported extensions defined in [`frontend/src-tauri/src/audio/constants.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/audio/constants.rs) (`AUDIO_EXTENSIONS`)
- File size under the 20 GB limit
- Duration extraction from metadata when available

Once validated, the system creates a dedicated meeting folder under the user’s recordings directory and copies the source file as `audio.{ext}` (lines 41-57). This ensures the imported asset lives within Meetily’s managed storage before processing begins.

## Stage 2: Audio Decoding and Format Standardization

After copying, the pipeline decodes the audio to raw PCM using `decode_audio_file_with_progress`, emitting progress updates from 5% to 20% as the operation completes.

The resampling stage converts the PCM stream to Whisper-friendly 16 kHz mono format via `to_whisper_format_with_progress` (lines 104-114). This standardization is critical because downstream transcription engines expect consistent sample rates and channel configurations. Progress reporting advances from 20% to 25% during this conversion.

## Stage 3: Speech Detection and Segment Enhancement

The resampled audio feeds into `get_speech_chunks_with_progress` (lines 130-144), which applies Voice Activity Detection (VAD) using a 2000 ms redemption time tailored for batch imports. This isolates speech segments with precise timestamps while filtering non-speech content, advancing progress to 30%.

The "enhance" aspect of the architecture occurs in `split_segment_at_silence` (lines 122-138). Segments exceeding 25 seconds are automatically split at low-energy points rather than arbitrary boundaries. This prevents word truncation and improves transcription accuracy by ensuring each chunk aligns with natural speech pauses.

## Stage 4: Transcription and Database Persistence

Each processed segment is transcribed using either `WhisperEngine` or `ParakeetEngine`, depending on the user-selected provider passed in `start_import_audio_command`. The transcription loop (lines 150-170) accumulates confidence scores for quality reporting.

Finally, the pipeline persists results through `create_meeting_with_transcripts` (lines 184-200), which inserts `TranscriptSegment` records into the SQLite database via [`frontend/src-tauri/src/database/manager.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/database/manager.rs). The system also writes [`transcripts.json`](https://github.com/Zackriya-Solutions/meetily/blob/main/transcripts.json) and [`metadata.json`](https://github.com/Zackriya-Solutions/meetily/blob/main/metadata.json) to the meeting folder via `write_import_metadata` (lines 210-218) for portable access.

## Real-Time Progress Reporting

Throughout the pipeline, `emit_progress` (lines 240-247) dispatches `import-progress` events containing the current stage, percentage completion, and human-readable messages. The frontend consumes these events to render the enhancement-style progress UI.

### Frontend Integration Example

To initiate an import from the TypeScript frontend:

```typescript
const fileInfo = await invoke<AudioFileInfo | null>('select_and_validate_audio_command');
if (fileInfo) {
  const result = await invoke<ImportStarted>('start_import_audio_command', {
    source_path: fileInfo.path,
    title: fileInfo.filename,
    language: 'en',
    provider: 'whisper', // or 'parakeet'
  });
}

```

Listen for progress updates:

```typescript
listen<ImportProgress>('import-progress', (e) => {
  console.log(`[${e.payload.stage}] ${e.payload.progress_percentage}% – ${e.payload.message}`);
});

```

### Backend API Access

For testing or automation, invoke the pipeline directly in Rust:

```rust
let import_result = meetily::audio::import::start_import(
    app_handle,
    "/path/to/recording.mp4".to_string(),
    "Team Sync".to_string(),
    Some("en".to_string()),
    None, // uses default model
    Some("whisper".to_string()),
).await?;

```

## Summary

- **Validation gate**: The `select_and_validate_audio_command` enforces 20 GB size limits and supported formats before processing begins.
- **Format standardization**: Audio is decoded and resampled to 16 kHz mono to ensure compatibility with transcription engines.
- **Intelligent splitting**: The enhancement step splits segments longer than 25 seconds at silence points to preserve transcription accuracy.
- **Engine flexibility**: The pipeline supports both Whisper and Parakeet backends through a unified interface.
- **Progressive feedback**: Real-time `import-progress` events enable detailed UI feedback throughout the batch process.

## Frequently Asked Questions

### What audio formats does Meetily support for importing?

Meetily accepts standard audio and video formats including `.mp4`, `.wav`, and `.mp3`, as defined in [`frontend/src-tauri/src/audio/constants.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/audio/constants.rs). The validation stage checks file extensions against this allowlist before processing begins.

### How does the segment enhancement improve transcription quality?

Segments exceeding 25 seconds are split at detected silence points using `split_segment_at_silence`, rather than at fixed timestamps. This prevents words from being cut mid-utterance and ensures each chunk submitted to Whisper or Parakeet contains complete linguistic context.

### What is the maximum file size for imported audio files?

The architecture enforces a 20 GB limit during the validation stage. Files exceeding this threshold are rejected before copying to the meeting folder, preventing storage and memory issues during decoding.

### Can I use Parakeet instead of Whisper for imported recordings?

Yes. The `start_import_audio_command` accepts a `provider` parameter that can be set to either `'whisper'` or `'parakeet'`. The pipeline instantiates the corresponding engine (`WhisperEngine` or `ParakeetEngine`) and applies the same VAD and splitting logic regardless of the backend selected.