Hexagon DSP 处理器允许在待机时激活您的设备https://qualcomm.com/videos/snapdragon-voice-activation。一些 Android 设备支持此功能,例如 Google Pixel 会对关键字“Ok Google”做出反应。在android的源代码中,我找到了负责将keyphrase加载到DSP处理器中的代码(Hexagon DSP处理器内置在高通处理器中):
https://android.googlesource.com/platform/hardware/libhardware/+/master/modules/soundtrigger/sound_trigger_hw.c https://android.googlesource.com/platform/system/media/+/master/audio/include /system/sound_trigger.h
声音模型描述结构sound_trigger_sound_model传入方法stdev_load_sound_model。声音模型结构:
/*
* Base sound model descriptor. This struct is the header of a larger block passed to
* load_sound_model() and containing the binary data of the sound model.
* Proprietary representation of users in binary data must match information indicated
* by users field
*/
struct sound_trigger_sound_model {
sound_trigger_sound_model_type_t type; /* model type. e.g. SOUND_MODEL_TYPE_KEYPHRASE */
sound_trigger_uuid_t uuid; /* unique sound model ID. */
sound_trigger_uuid_t vendor_uuid; /* unique vendor ID. Identifies the engine the
sound model was build for */
unsigned int data_size; /* size of opaque model data */
unsigned int data_offset; /* offset of opaque data start from head of struct
(e.g sizeof struct sound_trigger_sound_model) */
};
有谁知道如何生成声音模型的二进制数据或在哪里可以找到有关它的信息?
您可以通过链接下载关键词“Ok Google”的声音模型: https ://drive.google.com/open?id=0B9jcQJRmjR0yaDJhOXN2M2ZLYm8 。我将它加载到 DSP 处理器中,它可以工作。
有用的 Android 类: https ://android.googlesource.com/platform/frameworks/base/+/master/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java https://android.googlesource.com /platform/frameworks/base/+/master/core/java/android/hardware/soundtrigger/SoundTriggerModule.java https://android.googlesource.com/platform/frameworks/base/+/master/core/jni/android_hardware_SoundTrigger。 cpp https://android.googlesource.com/platform/frameworks/av/+/master/soundtrigger/SoundTrigger.cpp https://android.googlesource.com/platform/frameworks/av/+/master/soundtrigger/ISoundTrigger。 cpp