kpb: add multi-KPB WOV arbiter for 3-keyword DMIC capture with VAD - #11022
kpb: add multi-KPB WOV arbiter for 3-keyword DMIC capture with VAD#11022lgirdwood wants to merge 8 commits into
Conversation
49f3dc6 to
c3c7161
Compare
20edbb3 to
0f6f889
Compare
Update KPB component to retrieve downstream WOV detector widgets via comp_buffer_get_sink_component(sink) on sel_sink and trigger downstream detector pipelines directly during copy. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…g copy Ensure all connected mixout components are automatically activated during mixin_copy() so capture stream audio is mixed concurrently to all active WOV detector pipelines. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add VAD gate audio component to pre-filter background silence and gate downstream WOV keyphrase detector pipelines when no voice energy is present. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add AMS message UUIDs, payload structures (wov_detect_payload, wov_ctrl_payload), and command codes for inter-component communication between WOV detectors and the multi-slot WOV arbiter. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add multi-slot WOV arbiter audio component to manage keyword detection events across multiple detector pipelines, dispatch AMS slot activation and control messages, and broadcast pause/resume commands to un-triggered slots. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…ication - Add multi-slot zero-crossing frequency estimation for Slot 0 (Male 120Hz), Slot 1 (Female 220Hz), and Slot 2 (Child 350Hz). - Require 30ms sustained frequency match (consec_match_count >= 3) and energy > 500 to eliminate transient background room noise triggers. - Map IPC4 pipeline IDs 101/102/103 to slot IDs 0/1/2. - Populate IPC4 phrase detection notifications with WOV detector module ID, instance ID, and slot ID. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add topology manifests and configuration files supporting 3-slot WOV capture (Male, Female, Child) with multi-KPB buffer routes, mixin/mixout splitters, wov-arbiter widget bindings, and HDA Jack Mic / DMIC input bindings. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…tion, and testing Add detailed documentation for multi-slot Wake-On-Voice (WOV) architecture, including Mermaid diagrams for audio dataflow and control messaging, Kconfig requirements, topology syntax, and test procedures on Tiger Lake (Spider/Moth). Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
0f6f889 to
3af37c0
Compare
lgirdwood
left a comment
There was a problem hiding this comment.
Needs more inline comments around code blocks and important statements can also do with more context in each commit message. I would put the README.md patch first to give reviewer context first before further review.
| return -ENOMEM; | ||
| } | ||
|
|
||
| struct comp_buffer *sink; |
There was a problem hiding this comment.
lets comment why this is needed, and what we are doing in these 2 new blocks. This does look like it would benefit a utility API.
| } | ||
| #endif /* CONFIG_IPC_MAJOR_4 */ | ||
|
|
||
| if (!kpb->sel_sink || !kpb->host_sink) { |
There was a problem hiding this comment.
lets comment what this block is doing and why.
| comp_err(dev, "could not find sink: sel_sink %p", | ||
| kpb->sel_sink); | ||
| ret = -EIO; | ||
| } else { |
| #UUID: D8218443-5FF3-4A4C-B388-6CFE07B9562E | ||
| uuid "43:84:21:d8:f3:5f:4c:4a:b3:88:6c:fe:07:b9:56:2e" | ||
| #UUID: a8a0cb32-4a77-4db1-85c753d7ee07bce6 (kpb4 static module) | ||
| uuid "32:cb:a0:a8:77:4a:b1:4d:85:c7:53:d7:ee:07:bc:e6" |
There was a problem hiding this comment.
why do we need a new UUID
| if (frames_to_copy + start_frame > mixout_data->mixed_frames) | ||
| mixout_data->mixed_frames = frames_to_copy + start_frame; | ||
|
|
||
| if (mixout_mod && mixout_mod->dev) |
There was a problem hiding this comment.
need comment for what we are checking and why.
| @@ -0,0 +1,455 @@ | |||
| // SPDX-License-Identifier: BSD-3-Clause | |||
| // | |||
| // Copyright(c) 2024 Intel Corporation. All rights reserved. | |||
| */ | ||
| uint8_t active_slot; | ||
|
|
||
| #if CONFIG_AMS |
There was a problem hiding this comment.
we should actually depend on AMS in teh Kconfig and then we can remove all these ifdefs
| if(CONFIG_COMP_VAD_GATE) | ||
| add_subdirectory(vad_gate) | ||
| endif() |
There was a problem hiding this comment.
this should be in the vad gate patch.
| e93326d8-0d14-4bf0-bcb9e063d3d80136 twb_sched | ||
| 42f8060c-832f-4dbf-b24751e961997b34 up_down_mixer | ||
| 6f6b6f4b-6f73-7466-20e1e62b9779f003 userspace_proxy | ||
| 8c7d6e5f-4a3b-2c1d-0e9f8a7b6c5d4e3f vad_gate |
There was a problem hiding this comment.
this should be in vad gate patch
| dai_type "DMIC" | ||
| copier_type "DMIC" | ||
| stream_name $DMIC1_NAME |
There was a problem hiding this comment.
isnt this passed in via build for the target ?
|
|
||
| if (sink_buf_id == buf_id) { | ||
| struct comp_dev *sc = comp_buffer_get_sink_component(sink); | ||
| comp_err(dev, "kpb_bind: buf_id=%d sink_comp=0x%x -> %s", |
There was a problem hiding this comment.
is this an error condition?
| comp_dev_for_each_consumer(dev, sink) { | ||
| struct comp_dev *sc = comp_buffer_get_sink_component(sink); | ||
| if (sc) { | ||
| comp_err(dev, "kpb consumer in bsink_list: comp_id=0x%x type=%d sink_buf=%p", |
There was a problem hiding this comment.
replace comp_err() everywhere in this commit / PR
| if (sc) { | ||
| comp_err(dev, "kpb consumer in bsink_list: comp_id=0x%x type=%d sink_buf=%p", | ||
| dev_comp_id(sc), sc->drv ? sc->drv->type : -1, sink); | ||
| if (dev_comp_id(sc) != 0x10) |
| kpb->sel_sink = sink; | ||
| else | ||
| kpb->host_sink = sink; | ||
| } |
There was a problem hiding this comment.
I suppose the loop should run exactly twice to only set each of these pointers once? Should we check or at least add a comment?
| if (!kpb->sel_sink) | ||
| kpb->sel_sink = sink; | ||
| else if (!kpb->host_sink) | ||
| kpb->host_sink = sink; |
There was a problem hiding this comment.
same here - shouldn't be overwriting, right?
| } | ||
|
|
||
| LOG_MODULE_REGISTER(kd_test, CONFIG_SOF_LOG_LEVEL); | ||
| LOG_MODULE_REGISTER(kd_test, LOG_LEVEL_INF); |
| struct comp_data *cd = comp_get_drvdata(dev); | ||
|
|
||
| comp_info(dev, "entry"); | ||
| comp_err(dev, "notify_host: WOV module_id=0x%x instance_id=0x%x slot_id=%u detected", |
| uint8_t slot_id = cd->wov_slot_id; | ||
| if (slot_id == WOV_SLOT_INVALID) { | ||
| if (dev->pipeline && dev->pipeline->pipeline_id >= 101 && dev->pipeline->pipeline_id <= 103) | ||
| slot_id = dev->pipeline->pipeline_id - 101; |
There was a problem hiding this comment.
what are these magic numbers?
| freq_match = (freq_hz >= 80 && freq_hz <= 170); | ||
| voice_type = "MALE"; | ||
| break; | ||
| case 1: /* Female Voice Range: 175 - 270 Hz */ |
There was a problem hiding this comment.
so 172Hz will be "nobody?" Or are frequencies detected with 5Hz granularity?
| else if (ppl_id == 102 || ppl_id == 3) | ||
| cd->wov_slot_id = 1; | ||
| else if (ppl_id == 103 || ppl_id == 4) | ||
| cd->wov_slot_id = 2; |
There was a problem hiding this comment.
these numbers look familiar
EDIT now added test detection in each WoV module to wake on voice frequencies for male, female and children voice frequencies. i.e. each WoV will trigger on a different speaker type.
Adds a new WOV arbiter component and multi-KPB topology to support three simultaneous wake-word detectors sharing a single DMIC, with exclusive host PCM drain arbitration when any keyword fires.
New component: src/audio/wov_arbiter/
AMS additions (ams_msg.h):
detect_test extensions:
Topology: tools/topology/topology2/platform/intel/dmic-wov-multi.conf
Requires: CONFIG_COMP_WOV_ARBITER, CONFIG_COMP_KPB, CONFIG_COMP_MIXIN_MIXOUT,
CONFIG_AMS, CONFIG_COMP_KWD_DETECT