Picovoice / porcupine

On-device wake word detection powered by deep learning
https://picovoice.ai/
Apache License 2.0
3.79k stars 503 forks source link

Porcupine Issue: why build Mac version will return error ? #1326

Closed li-yu-tfs closed 3 weeks ago

li-yu-tfs commented 1 month ago

Have you checked the docs and existing issues?

SDK

Rust

Porcupine package version

3.0.3

Framework version

2.0.6

Platform

macOS (x86_64, arm64)

OS/Browser version

14.6.1

Describe the bug

when we use rust and build macos version, will return this error

Couldn't find model file at /Users/xxxxx/work/geneai-desktop-assistant/src-tauri/target/release/build/pv_porcupine-d1fe74abd593b99b/out/lib/common/porcupine_params.pv with status 'ArgumentError'

this is my code. i have use library_path add libpv_porcupine libs. but now return coludn't find porcupine_params.pv lib.

so, how to add porcupine_params.pv lib ?

let library_path = if cfg!(target_os = "windows") { "src/libs/porcupine/windows_amd64/libpv_porcupine.dll" } else if cfg!(target_os = "macos") { if cfg!(target_arch = "x86_64") { "src/libs/porcupine/mac_x86_64/libpv_porcupine.dylib" } else if cfg!(target_arch = "aarch64") { "src/libs/porcupine/mac_arm64/libpv_porcupine.dylib" } else {

        return;
    }
} else {

    return;
};

let real_library_path = match app_handle
    .path()
    .resolve(library_path, BaseDirectory::Resource)
{
    Ok(path) => {

        path
    }
    Err(e) => {

        return;
    }
};

let mut porcupine = None;
for &access_key in &access_keys {
    match PorcupineBuilder::new_with_keyword_paths(access_key, &[PathBuf::from(&real_path)])
        .library_path(&real_library_path)
        .sensitivities(&[0.5])
        .init()
    {
        Ok(p) => {
            porcupine = Some(p);

            break;
        }
        Err(e) => {

            continue;
        }
    }
}

Steps To Reproduce

none

Expected Behavior

don't return any error

matt200-ok commented 1 month ago

Hello @li-yu-tfs,

Please first verify that the built in keywords work by following the Rust sample. If you get the sample working I would recommend verifying that all your paths are correct.

li-yu-tfs commented 1 month ago

hi. @matt200-ok . I'm sure I'm on the right path . because if we not use library_path. when we build application, will return (Failed to load porcupine dynamic library libpv_porcupine.dylib)

so i have add library_path, but when i use library path . also return error (Couldn't find model file at /Users/xxxxx/work/geneai-desktop-assistant/src-tauri/target/release/build/pv_porcupine-d1fe74abd593b99b/out/lib/common/porcupine_params.pv with status 'ArgumentError')

laves commented 1 month ago

@li-yu-tfs if you cannot recreate the issue with our demo, we will be unable to help. As a general policy, we do not provide debugging assistance on non-Picovoice application code

laves commented 3 weeks ago

Closed as we were unable to reproduce the issue