-
Notifications
You must be signed in to change notification settings - Fork 356
Audio: MFCC: Add Voice Activity Detection based on Mel spectrum #10782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
singalsu
wants to merge
3
commits into
thesofproject:main
Choose a base branch
from
singalsu:mfcc_add_vad
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,36 +97,13 @@ static int mfcc_free(struct processing_module *mod) | |
| struct mfcc_comp_data *cd = module_get_private_data(mod); | ||
|
|
||
| comp_info(mod->dev, "entry"); | ||
| ipc_msg_free(cd->msg); | ||
| mod_data_blob_handler_free(mod, cd->model_handler); | ||
| mfcc_free_buffers(mod); | ||
| mod_free(mod, cd); | ||
| return 0; | ||
| } | ||
|
|
||
| static int mfcc_get_config(struct processing_module *mod, | ||
| uint32_t config_id, uint32_t *data_offset_size, | ||
| uint8_t *fragment, size_t fragment_size) | ||
| { | ||
| struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment; | ||
| struct mfcc_comp_data *cd = module_get_private_data(mod); | ||
|
|
||
| comp_info(mod->dev, "entry"); | ||
|
|
||
| return comp_data_blob_get_cmd(cd->model_handler, cdata, fragment_size); | ||
| } | ||
|
|
||
| static int mfcc_set_config(struct processing_module *mod, uint32_t config_id, | ||
| enum module_cfg_fragment_position pos, uint32_t data_offset_size, | ||
| const uint8_t *fragment, size_t fragment_size, uint8_t *response, | ||
| size_t response_size) | ||
| { | ||
| struct mfcc_comp_data *cd = module_get_private_data(mod); | ||
|
|
||
| comp_info(mod->dev, "entry"); | ||
|
|
||
| return comp_data_blob_set(cd->model_handler, pos, data_offset_size, | ||
| fragment, fragment_size); | ||
| } | ||
|
|
||
| static int mfcc_process(struct processing_module *mod, | ||
| struct input_stream_buffer *input_buffers, int num_input_buffers, | ||
|
|
@@ -187,22 +164,29 @@ static int mfcc_prepare(struct processing_module *mod, | |
| audio_stream_get_channels(&sourceb->stream)); | ||
| if (ret < 0) { | ||
| comp_err(dev, "setup failed."); | ||
| goto err; | ||
| return ret; | ||
| } | ||
| } else { | ||
| comp_err(dev, "configuration is missing."); | ||
| return -EINVAL; | ||
| } | ||
|
|
||
| cd->mfcc_func = mfcc_find_func(source_format, sink_format, mfcc_fm, ARRAY_SIZE(mfcc_fm)); | ||
| if (!cd->mfcc_func) { | ||
| comp_err(dev, "No proc func"); | ||
| ret = -EINVAL; | ||
| goto err; | ||
| return -EINVAL; | ||
| } | ||
|
|
||
| return 0; | ||
| /* Initialize VAD switch control notification if enabled */ | ||
| if (cd->config->enable_vad && cd->config->update_controls && !cd->msg) { | ||
| ret = mfcc_ipc_notification_init(mod); | ||
| if (ret < 0) | ||
| return ret; | ||
|
Comment on lines
+182
to
+184
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, can prepare() really be called again? But ok, adding this. |
||
|
|
||
| cd->vad_prev = false; | ||
| } | ||
|
Comment on lines
+180
to
+187
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
|
||
| err: | ||
| comp_set_state(dev, COMP_TRIGGER_RESET); | ||
| return ret; | ||
| return 0; | ||
| } | ||
|
|
||
| static int mfcc_reset(struct processing_module *mod) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.