use std::path::Path; use kon_core::error::Result; use kon_core::types::AudioSamples; use crate::decode::decode_audio_file; use crate::resample::resample_to_16khz; /// Decode and resample an audio file on a blocking thread. /// Returns 16kHz mono AudioSamples ready for transcription. pub async fn decode_and_resample(path: &Path) -> Result { let path = path.to_path_buf(); tokio::task::spawn_blocking(move || { let audio = decode_audio_file(&path)?; resample_to_16khz(&audio) }) .await .map_err(|e| kon_core::error::KonError::AudioDecodeFailed(format!("Task join error: {e}")))? }