mirror of
https://github.com/espressif/esp-sr.git
synced 2025-09-15 15:28:44 +08:00
enlarge MASE filter_strength range & lower processed freq range
This commit is contained in:
parent
87bb8b5cf3
commit
4d0a595652
@ -48,13 +48,13 @@ typedef void* mase_handle_t;
|
|||||||
*
|
*
|
||||||
* @param operating_mode '0' for normal mode and '1' for wake-up enhanced mode.
|
* @param operating_mode '0' for normal mode and '1' for wake-up enhanced mode.
|
||||||
*
|
*
|
||||||
* @param filter_strength Strengh of the mic-array speech enhancement, must be 0, 1, 2 or 3.
|
* @param filter_strength Strengh of the mic-array speech enhancement, must be 0 to 6.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - NULL: Create failed
|
* - NULL: Create failed
|
||||||
* - Others: An instance of MASE
|
* - Others: An instance of MASE
|
||||||
*/
|
*/
|
||||||
mase_handle_t mase_create(int sample_rate, int frame_size, int array_type, float mic_distance, int operating_mode, int filter_strength);
|
mase_handle_t mase_create(int fs, int frame_size, int array_type, float mic_distance, int operating_mode, int filter_strength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs mic array processing for one frame.
|
* @brief Performs mic array processing for one frame.
|
||||||
@ -67,9 +67,6 @@ mase_handle_t mase_create(int sample_rate, int frame_size, int array_type, float
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
* @note Input is a multi-channel signal while the output is single-channel.
|
|
||||||
* For a 16-ms multi-channel input frame, the i-th point in the c-th channel should be indexed (i + c * 256).
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void mase_process(mase_handle_t st, int16_t *in, int16_t *dsp_out);
|
void mase_process(mase_handle_t st, int16_t *in, int16_t *dsp_out);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -9,6 +9,7 @@
|
|||||||
#include "esp_aec.h"
|
#include "esp_aec.h"
|
||||||
#include "esp_agc.h"
|
#include "esp_agc.h"
|
||||||
#include "esp_vad.h"
|
#include "esp_vad.h"
|
||||||
|
#include "esp_mase.h"
|
||||||
#include "audio_test_file.h"
|
#include "audio_test_file.h"
|
||||||
|
|
||||||
void NSTask(void *arg)
|
void NSTask(void *arg)
|
||||||
@ -105,6 +106,31 @@ void VADTask(void *arg)
|
|||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MASETask(void *arg)
|
||||||
|
{
|
||||||
|
mase_handle_t mase_st = mase_create(MASE_SAMPLE_RATE, MASE_FRAME_SIZE, THREE_MIC_CIRCLE, MASE_MIC_DISTANCE, WAKE_UP_ENHANCEMENT_MODE, 6);
|
||||||
|
int chunks = 0;
|
||||||
|
int nch = 3;
|
||||||
|
int audio_chunksize = MASE_FRAME_SIZE * MASE_SAMPLE_RATE * nch / 1000;
|
||||||
|
int16_t *mase_in = malloc(audio_chunksize * sizeof(int16_t));
|
||||||
|
int16_t *mase_out = malloc(audio_chunksize / nch * sizeof(int16_t));
|
||||||
|
while (1) {
|
||||||
|
if ((chunks + 1) * audio_chunksize * sizeof(int16_t) <= sizeof(audio_test_file)) {
|
||||||
|
memcpy(mase_in, audio_test_file + chunks * audio_chunksize * sizeof(int16_t), audio_chunksize * sizeof(int16_t));
|
||||||
|
memset(mase_out, 0, audio_chunksize / nch * sizeof(int16_t));
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mase_process(mase_st, mase_in, mase_out);
|
||||||
|
chunks++;
|
||||||
|
}
|
||||||
|
mase_destory(mase_st);
|
||||||
|
free(mase_in);
|
||||||
|
free(mase_out);
|
||||||
|
printf("MASE test successfully\n\n");
|
||||||
|
printf("TEST3 FINISHED\n\n");
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void audio_process_test()
|
void audio_process_test()
|
||||||
{
|
{
|
||||||
@ -115,4 +141,6 @@ void audio_process_test()
|
|||||||
xTaskCreatePinnedToCore(&AECTask, "acoustic_echo_cancellation", 3 * 1024, NULL, 5, NULL, 0);
|
xTaskCreatePinnedToCore(&AECTask, "acoustic_echo_cancellation", 3 * 1024, NULL, 5, NULL, 0);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
xTaskCreatePinnedToCore(&VADTask, "voice_activity_detection", 3 * 1024, NULL, 5, NULL, 0);
|
xTaskCreatePinnedToCore(&VADTask, "voice_activity_detection", 3 * 1024, NULL, 5, NULL, 0);
|
||||||
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
|
xTaskCreatePinnedToCore(&MASETask, "mic_array_speech_enhancement", 3 * 1024, NULL, 5, NULL, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user