package processor import ( "fmt" "io" "os" ) // validateAudio confirms the audio source file exists and is readable. func validateAudio(srcPath string) error { f, err := os.Open(srcPath) if err != nil { return fmt.Errorf("open audio %s: %w", srcPath, err) } return f.Close() } // copyFile copies the file at src to dst, creating dst if it does not exist. func copyFile(src, dst string) error { in, err := os.Open(src) if err != nil { return fmt.Errorf("open source %s: %w", src, err) } defer in.Close() out, err := os.Create(dst) if err != nil { return fmt.Errorf("create dest %s: %w", dst, err) } defer out.Close() if _, err := io.Copy(out, in); err != nil { return fmt.Errorf("copy %s → %s: %w", src, dst, err) } return nil }