Additional audio pre-process methods.
## How to build
- * local : meson build --reconfigure [-Dtestsuite=enabled] && ninja -C build clean && ninja -C build/
- e.g) meson build --reconfigure -Db_sanitize=address -Db_coverage=true -Dtestsuite=enabled -Damplify=enabled -Dspeex-agc=enabled -Dns-rnnoise=enabled -Dns-srid=enabled -Drefcopy=enabled -Daec-speex=enabled -Daec-webrtc=enabled && ninja -C build clean && ninja -C build/
+ * local : meson build [-Dtestsuite=enabled] && ninja -C build clean && ninja -C build/
+ e.g) meson build -Dtestsuite=enabled -Damplify=enabled -Dagc-speex=enabled -Dns-rnnoise=enabled -Dns-srid=enabled -Drefcopy=enabled -Daec-speex=enabled -Daec-webrtc=enabled && ninja -C build clean && ninja -C build/
+ e.g) meson build -Db_sanitize=address -Db_coverage=true -Dtestsuite=enabled -Damplify=enabled && ninja -C build clean && ninja -C build/
* GBS : gbs build -A aarch64 --include-all
## How to test
typedef struct audio_effect_interface audio_effect_interface_s;
typedef enum {
- AUDIO_EFFECT_METHOD_REFCOPY, /* synthesis reference source into recording source */
-
- /* Acoustic Echo Cancellation */
- AUDIO_EFFECT_METHOD_AEC_SPEEX, /* aec from speexdsp */
- AUDIO_EFFECT_METHOD_AEC_WEBRTC, /* aec from webrtc-audio-processing */
-
- /* Noise Suppression */
- AUDIO_EFFECT_METHOD_NS_PSE, /* SAIC NS solution */
- AUDIO_EFFECT_METHOD_NS_RNNOISE, /* RNNoise */
- AUDIO_EFFECT_METHOD_NS_SRID, /* SRID solution */
+ AUDIO_EFFECT_METHOD_REFCOPY, /* Synthesis the reference source into the recording source */
+ AUDIO_EFFECT_METHOD_AEC_SPEEX, /* Acoustic Echo Cancellation with speex */
+ AUDIO_EFFECT_METHOD_AEC_WEBRTC, /* Acoustic Echo Cancellation with webrtc */
+ AUDIO_EFFECT_METHOD_NS_PSE, /* Noise Suppression with PSE(SAIC) */
+ AUDIO_EFFECT_METHOD_NS_RNNOISE, /* Noise suppression with RNNoise */
+ AUDIO_EFFECT_METHOD_NS_SRID, /* Noise suppression from SRID */
+ AUDIO_EFFECT_METHOD_AGC_SPEEX, /* Automatic Gain Control with speex */
/* Template */
AUDIO_EFFECT_METHOD_AMPLIFY,
-
- /* Experiment */
- AUDIO_EFFECT_METHOD_AGC_SPEEX,
AUDIO_EFFECT_METHOD_MAX,
} audio_effect_method_e;
Name: libaudio-effect
Summary: audio effect library
-Version: 0.0.7
+Version: 0.0.8
Release: 0
Group: System/Libraries
License: Apache-2.0
-Dns-rnnoise=enabled \
-Daec-webrtc=enabled \
%endif
+ -Dagc-speex=enabled \
-Drefcopy=enabled \
-Daec-speex=enabled \
-Dns-srid=enabled
[AUDIO_EFFECT_METHOD_NS_PSE] = DL_PLUGIN_PATH "libaudio-effect-ns-pse.so",
[AUDIO_EFFECT_METHOD_NS_RNNOISE] = DL_PLUGIN_PATH "libaudio-effect-ns-rnnoise.so",
[AUDIO_EFFECT_METHOD_NS_SRID] = DL_PLUGIN_PATH "libaudio-effect-ns-srid.so",
- [AUDIO_EFFECT_METHOD_AMPLIFY] = DL_PLUGIN_PATH "libaudio-effect-amplify.so",
[AUDIO_EFFECT_METHOD_AGC_SPEEX] = DL_PLUGIN_PATH "libaudio-effect-agc-speex.so",
+ [AUDIO_EFFECT_METHOD_AMPLIFY] = DL_PLUGIN_PATH "libaudio-effect-amplify.so",
};
+static_assert(sizeof(effect_path_list) / sizeof(char *) == AUDIO_EFFECT_METHOD_MAX);
+
static struct plugin_list {
void *handle;
int refcnt;
int denoise_enabled = 1;
int agc_enabled = 1;
- float target_level = 0; // The target audio level in dBFS
- //float target_level = -20; // The target audio level in dBFS
- float max_gain = 0; // The maximum audio gain in dB
- //float max_gain = 30; // The maximum audio gain in dB
- int agc_level = 8000;
SpeexPreprocessState *st;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &denoise_enabled);
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &agc_enabled);
- speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_TARGET, &target_level);
- speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &max_gain);
- speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &agc_level);
u->frames = frames;
u->st = st;
}
static audio_effect_plugin_info_s speex_agc = {
- .name = "speex-agc",
+ .name = "agc-speex",
.interface = {
.method = AUDIO_EFFECT_METHOD_AGC_SPEEX,
.create = speex_agc_create,
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "audio_effect.h"
+
+#define FRAME_SIZE (160)
+
+int main(void)
+{
+ audio_effect_s *ae;
+ FILE *fin;
+ FILE *fout;
+ short in[FRAME_SIZE];
+ short out[FRAME_SIZE];
+ size_t framesize = FRAME_SIZE;
+
+ int i=0;
+
+ printf("--- agc speex start ---\n");
+
+ fin = fopen("obama.raw", "r");
+ if (!fin) {
+ printf("failed to find airport_48k.raw\n");
+ exit(-1);
+ }
+
+ fout = fopen("agc_speex_out.raw", "wb");
+ if (!fout) {
+ printf("failed to open raw\n");
+ exit(-1);
+ }
+
+ ae = audio_effect_create(AUDIO_EFFECT_METHOD_AGC_SPEEX, 16000, 1, AUDIO_EFFECT_FORMAT_S16, framesize);
+ assert(ae);
+
+ framesize = audio_effect_get_process_framesize(ae);
+ printf("frame size %zu\n", framesize);
+
+ while (!feof(fin)) {
+ if (fread(in, sizeof(short), FRAME_SIZE, fin) < 0)
+ break;
+
+ printf("#%d frame. ", i++);
+
+ if (audio_effect_process(ae, in, out) < 0) {
+ printf("(failed!)\n");
+ } else {
+ printf("(success!)\n");
+ fwrite(out, sizeof(short), FRAME_SIZE, fout);
+ }
+ }
+
+ audio_effect_destroy(ae);
+
+ fclose(fin);
+ fclose(fout);
+
+ printf("--- agc speex end ---\n");
+
+ return 0;
+}
test_list += [[ 'aec_webrtc_test', 'aec_webrtc_test.c' ]]
endif
+if get_option('agc-speex').enabled()
+ test_list += [[ 'agc_speex_test', 'agc_speex_test.c' ]]
+endif
+
testsuite_env = environment()
testsuite_env.set('LD_LIBRARY_PATH', './')
fin = fopen(source_file[i], "r");
if (!fin) {
- printf("failed to find airport_48k.raw\n");
+ printf("failed to find the source file. file(%s)\n", source_file[i]);
exit(-1);
}
fout = fopen(output_file[i], "wb");
if (!fout) {
- printf("failed to open raw\n");
+ printf("failed to open output file. file(%s)\n", output_file[i]);
exit(-1);
}