From 5e2bc238fafe254d0f436302f5e6ac35782ae0e4 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 4 Oct 2020 10:44:11 -0400 Subject: [PATCH] main.cpp,main.cfg,Makefile.am : Added support for FFT,convolution,transform app cases. --- Makefile.am | 2 +- configure.ac | 1 + src/cwtest/cfg/main.cfg | 57 +++++++++++++++++++++++++++++++++-------- src/cwtest/main.cpp | 14 +++++++++- 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index 41fe48e..b9b5cc4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,7 +56,7 @@ src_cwtest_cwtest_SOURCES = src/cwtest/main.cpp # 1) autoconfig manual recommends setting direct referenes to non-3rd party libraries rather than using -L and -l # 2) -ldl is required for dlopen(),dlclose() ... -src_cwtest_cwtest_LDADD = libcw.la -lpthread -ldl +src_cwtest_cwtest_LDADD = libcw.la -lpthread -ldl -lfftw3 -lfftw3f if cwWEBSOCK AM_CPPFLAGS += -I$(WS_DIR)/include diff --git a/configure.ac b/configure.ac index d3d8a65..c6ae3e3 100644 --- a/configure.ac +++ b/configure.ac @@ -3,6 +3,7 @@ # this configure.ac or any of the Makefile.am files. # +AC_COPYRIGHT([Copyright (C) 2019-2020 Kevin Larke]) AC_INIT([cwtest],[1.0],[cwtest@larke.org]) AC_CONFIG_AUX_DIR([build-aux]) # put aux files in build-aux AM_INIT_AUTOMAKE([1.9 -Wall foreign subdir-objects]) # subdir-objects needed for non-recursive make diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 72763b3..343bc99 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -194,7 +194,7 @@ outDir: "~/temp/kc_record/xform_only/cut", outBits: 24, selectL: [ - { begSec: 1743.3, endSec: 1816.44, dst: "dry_mix.wav", src: "~/temp/kc_record/xform_only/dry/a_dry.aiff" }, + { begSec: 1743.3, endSec: 1816.44, dst: "dry_mix.wav", src: "~/temp/kc_record/xform_only/dry/a_dry.aiff" }, { begSec: 1743.3, endSec: 1816.44, dst: "a_mix.wav", src: "~/temp/kc_record/xform_only/mix/a_mix.aiff" }, { begSec: 1743.3, endSec: 1816.44, dst: "b_mix.wav", src: "~/temp/kc_record/xform_only/mix/b_mix.aiff" }, { begSec: 1743.3, endSec: 1816.44, dst: "c_mix.wav", src: "~/temp/kc_record/xform_only/mix/c_mix.aiff" }, @@ -220,15 +220,15 @@ { dstFn: "~/temp/test_xfade.wav", dstBits: 24, - + srcDir: "~/temp", crossFadeSec: 0.5, argL: [ - { srcBegSec: 1.0, srcEndSec: 2.0, srcFn: "temp_sine_100_hz.wav", dstBegSec:0.0 }, - { srcBegSec: 3.0, srcEndSec: 4.0, srcFn: "temp_sine_1000_hz.wav", dstBegSec:0.5 } + { srcBegSec: 1.0, srcEndSec: 2.0, srcFn: "temp_sine_100_hz.wav", dstBegSec:0.0, gain:1.0 }, + { srcBegSec: 3.0, srcEndSec: 4.0, srcFn: "temp_sine_1000_hz.wav", dstBegSec:0.5, gain:1.0 } ] - } + }, // Given a set of overlapping source files of identical length solo a given source during a specified time interval. parallel_mix: @@ -239,16 +239,53 @@ srcDir: "~/temp/kc_record/xform_only/cut", argL: [ - { srcBegSec: 0.0, srcEndSec: 4.2, srcFn: "dry_mix.wav", fadeOutSec:0.5 }, - { srcBegSec: 4.2, srcEndSec: 8.6, srcFn: "d_mix.wav", fadeOutSec:0.5 } - { srcBegSec: 8.6, srcEndSec: 15.67, srcFn: "ga_mix.wav", fadeOutSec:0.5 } - { srcBegSec: 15.67, srcEndSec: 17.98, srcFn: "dry_mix.wav", fadeOutSec:0.0 } + { srcBegSec: 0.0, srcEndSec: 4.2, srcFn: "dry_mix.wav", fadeOutSec:0.5, gain:1.0 }, + { srcBegSec: 4.2, srcEndSec: 8.6, srcFn: "d_mix.wav", fadeOutSec:0.5, gain:1.0 } + { srcBegSec: 8.6, srcEndSec: 15.67, srcFn: "ga_mix.wav", fadeOutSec:0.5, gain:1.0 } + { srcBegSec: 15.67, srcEndSec: 17.98, srcFn: "dry_mix.wav", fadeOutSec:0.0, gain:1.0 } ] - } + }, + convolve_file: + { + dstFn: "~/temp/test_convolve.wav", + dstBits: 32, + srcFn: "~/temp/select_to_file/preset_f1.wav", + irFn: "~/sdk/freeverb3/samples/IR/IR_theater.wav", + irScale: 1.0, + + }, + + transform_app: + { + srcDir: "~/temp/kc_record/xform_only/wet", // location of 'wet' source files + dryFn: "~/temp/kc_record/xform_only/dry/recd0.aiff", // dry source file + + dstPreFn: "~/temp/test_xform_app.wav", // the output file prior to reverb + dstRevFn: "~/temp/test_xform_app_rev.wav", // the output file with reverb + + dstBits: 32, + + irScale: 0.25, + irFn: "~/media/audio/IR/freeverb3/IR_theater.wav" + + + argL: [ + { srcBegSec: 0.0, srcEndSec: 4.2, srcFn: "recd0.aiff", fadeOutSec:0.5, wetGain:0.3 }, + { srcBegSec: 4.2, srcEndSec: 8.6, srcFn: "recd1.aiff", fadeOutSec:0.5, wetGain:0.3 }, + { srcBegSec: 8.6, srcEndSec: 15.67, srcFn: "recd2.aiff", fadeOutSec:0.5, wetGain:0.3 }, + { srcBegSec: 15.67, srcEndSec: 17.98, srcFn: "recd3.aiff", fadeOutSec:0.0, wetGain:0.3 }, + + ] + }, + + fft: {}, + ifft: {}, + convolve: {} } + } \ No newline at end of file diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 0f4b69b..248c075 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -17,6 +17,8 @@ #include "cwSerialPort.h" #include "cwSerialPortSrv.h" #include "cwSocket.h" +#include "cwUtility.h" +#include "cwDsp.h" #if defined(cwWEBSOCK) #include "cwWebSock.h" @@ -343,6 +345,11 @@ cw::rc_t audioFileMix( const cw::object_t* cfg, const cw::object_t* args cw::rc_t audioFileSelToFile( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::afop::selectToFile(args); } cw::rc_t audioFileCutAndMix( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::afop::cutAndMix(args); } cw::rc_t audioFileParallelMix( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::afop::parallelMix(args); } +cw::rc_t audioFileTransformApp(const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::afop::transformApp(args); } +cw::rc_t audioFileConvolve( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::afop::convolve(args); } +cw::rc_t fftTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dsp::fft::test(); } +cw::rc_t ifftTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dsp::ifft::test(); } +cw::rc_t convolveTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dsp::convolve::test(); } cw::rc_t socketMdnsTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::mdns::test(); } cw::rc_t dnsSdTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::dnssd::test(); } cw::rc_t euConTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::eucon::test(); } @@ -594,7 +601,7 @@ const cw::object_t* _locateArgsRecd( const cw::object_t* cfg, const char*& cfgLa } if((o = cfg->find_child(cfgLabel)) == nullptr ) - cwLogError(cw::kLabelNotFoundRC,"The test selector: '%s' was not found in the configuratoin file.", cwStringNullGuard(cfgLabel)); + cwLogError(cw::kLabelNotFoundRC,"The test selector: '%s' was not found in the configuration file.", cwStringNullGuard(cfgLabel)); else { @@ -663,6 +670,11 @@ int main( int argc, const char* argv[] ) { "select_to_file", audioFileSelToFile }, { "cut_and_mix", audioFileCutAndMix }, { "parallel_mix",audioFileParallelMix }, + { "transform_app", audioFileTransformApp }, + { "convolve_file", audioFileConvolve }, + { "fft", fftTest }, + { "ifft", ifftTest }, + { "convolve", convolveTest }, { "stub", stubTest }, { nullptr, nullptr } };