diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index cd868c0..f127288 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -110,9 +110,9 @@ deviceL: [ { // System device name - device: "Scarlett 18i20 USB USB Audio", + //device: "Scarlett 18i20 USB USB Audio", //device: "USB Audio CODEC USB Audio", - // device: "HDA Intel PCH CS4208 Analog", + device: "HDA Intel PCH CS4208 Analog", enableFl: true, // (req) label: "main", // (req) User label @@ -171,6 +171,90 @@ }, + audio_midi: { + + audio_midi: { + record_dir: "/home/kevin/temp/audio_midi", + record_fn: "record", + record_fn_ext: "am", + max_midi_msg_count: 32768, + midi_timer_period_micro_sec: 15000, + midi_out_device: "Fastlane", + midi_out_port: "Fastlane MIDI A" + }, + + ui: { + physRootDir: "/home/kevin/src/cwtest/src/libcw/html/audio_midi", + dfltPageFn: "index.html", + port: 5687, + rcvBufByteN: 2048, + xmtBufByteN: 2048, + fmtBufByteN: 4096, + websockTimeOutMs: 50, // max time out while blocking for a websock event + uiCfgFn: "ui.cfg" // default UI resource description + }, + + + serial: [ + { + label: "port1", // User label + device: "/dev/ttyACM0", // Serial device name + baud: 38400, + bits: 8, + stop: 1, + parity: no, + pollPeriodMs: 50 + } + ], + + + midi: { + parserBufByteN: 1024, + }, + + audio: { + meterMs: 50, // audio meter filter length and meter callback period + threadTimeOutMs: 50, // audio thread cond var time out + + groupL: [ + { + enableFl: true, // (req) + label: "main", // (req) User label + id: 0, // (req) User id (can also be set at runtime) + srate: 48000, // (req) Sample rate used by all devices in this group + dspFrameCnt: 64 // (req) Size of DSP processing buffers + } + ], + + deviceL: [ + { + // System device name + //device: "Scarlett 18i20 USB USB Audio", + //device: "USB Audio CODEC USB Audio", + device: "HDA Intel PCH CS4208 Analog", + + enableFl: true, // (req) + label: "main", // (req) User label + userId: 0, // (opt) User id (can also be set at runtime) + framesPerCycle: 512, // (req) Samples per audio device cycle + cycleCnt: 3, // (req) Count of device cycle buffers. + inGroup: "main", // (opt) All devices in a group must be 'ready' to source + outGroup: "main", // (opt) or sink data before an audio callback is made for that group + } + ] + }, + + socket: { + + maxSocketCnt: 10, + recvBufByteCnt: 4096, + threadTimeOutMs: 50, + socketL: [], + + } + }, + + audioDevRpt: {}, audioDevTest: { @@ -422,7 +506,7 @@ }, - select_to_file: + select_to_file_1: { outDir: "~/src/currawong/site/web_part_selection/html/static/audio/sel_score", @@ -434,21 +518,23 @@ fadeOutPostFl: true, // end selection at 'endSec+fadeOutSec' else end end at 'endSec' srcFn: "~/src/currawong/site/web_part_selection/html/static/audio/GUTIM_Part_1_20200711_48k_24bit.wav", + // Optional selectL[] args: "src" selectL: [ + { dst:"1_00_0.wav", begSec:0.0, endSec:23.23 }, { dst:"1_01_0.wav", begSec:23.23, endSec:46.4 }, { dst:"1_02_0.wav", begSec:46.4, endSec:65.79 }, { dst:"1_03_0.wav", begSec:65.79, endSec:84.05 }, { dst:"1_04_0.wav", begSec:84.05, endSec:111.15 }, - { dst:"1_05_0.wav", begSec:111.15, endSec:125.09 }, - { dst:"1_06_0.wav", begSec:125.09, endSec:164.01 }, - { dst:"1_07_0.wav", begSec:164.01, endSec:185.87 }, + { dst:"1_05_0.wav", begSec:111.15, endSec:125.9 }, + { dst:"1_06_0.wav", begSec:125.9, endSec:164.1 }, + { dst:"1_07_0.wav", begSec:164.1, endSec:185.87 }, { dst:"1_08_0.wav", begSec:185.87, endSec:220.15 }, - { dst:"1_09_0.wav", begSec:220.15, endSec:237.03 }, - { dst:"1_10_0.wav", begSec:237.03, endSec:275.75 }, - { dst:"1_00_1.wav", begSec:275.75, endSec:314.04 }, - { dst:"1_11_0.wav", begSec:314.04, endSec:348.73 }, + { dst:"1_09_0.wav", begSec:220.15, endSec:237.3 }, + { dst:"1_10_0.wav", begSec:237.3, endSec:275.75 }, + { dst:"1_00_1.wav", begSec:275.75, endSec:314.4 }, + { dst:"1_11_0.wav", begSec:314.4, endSec:348.73 }, { dst:"1_12_0.wav", begSec:348.73, endSec:369.05 }, { dst:"1_06_1.wav", begSec:369.05, endSec:385.16 }, { dst:"1_13_0.wav", begSec:385.16, endSec:406.06 }, @@ -456,8 +542,8 @@ { dst:"1_13_1.wav", begSec:421.71, endSec:433.85 }, { dst:"1_08_1.wav", begSec:433.85, endSec:452.0 }, { dst:"1_03_1.wav", begSec:452.0, endSec:476.08 }, - { dst:"1_02_1.wav", begSec:476.08, endSec:489.02 }, - { dst:"1_10_1.wav", begSec:489.02, endSec:504.98 }, + { dst:"1_02_1.wav", begSec:476.08, endSec:489.2 }, + { dst:"1_10_1.wav", begSec:489.2, endSec:504.98 }, { dst:"1_12_1.wav", begSec:504.98, endSec:535.55 }, { dst:"1_11_1.wav", begSec:535.55, endSec:549.78 }, { dst:"1_14_1.wav", begSec:549.78, endSec:569.68 }, @@ -471,6 +557,85 @@ }, + select_to_file: + { + + outDir: "~/src/currawong/site/web_part_selection/html/static/audio/sel_score", + markerFn: "~/temp/audacity_scratch/labels.txt", // write a marker file + outBits: 16, + fadeInSec: 0.1, + fadeInPreFl: true, // start selection at 'begSec-fadeInSec' else start at 'begSec' + fadeOutSec: 0.1, + fadeOutPostFl: true, // end selection at 'endSec+fadeOutSec' else end end at 'endSec' + srcFn: "~/src/currawong/site/web_part_selection/html/static/audio/GUTIM_All_20200711_48k_24bit.wav", + + + // Optional selectL[] args: "src" + selectL: [ + { dst:"2_01_0.wav", begSec:737.13, endSec:764.36 }, + { dst:"2_14_0.wav", begSec:764.36, endSec:782.60 }, + { dst:"2_12_0.wav", begSec:782.60, endSec:792.90 }, + { dst:"2_05_0.wav", begSec:792.90, endSec:818.15 }, + { dst:"2_00_0.wav", begSec:818.15, endSec:831.27 }, + { dst:"2_13_0.wav", begSec:831.27, endSec:851.90 }, + { dst:"2_09_0.wav", begSec:851.90, endSec:868.08 }, + { dst:"2_04_0.wav", begSec:868.08, endSec:899.88 }, + { dst:"2_02_0.wav", begSec:899.88, endSec:934.34 }, + { dst:"2_11_0.wav", begSec:934.34, endSec:952.62 }, + { dst:"2_12_1.wav", begSec:952.62, endSec:970.05 }, + { dst:"2_03_0.wav", begSec:970.05, endSec:1007.70 }, + { dst:"2_01_1.wav", begSec:1007.70, endSec:1035.94 }, + { dst:"2_13_1.wav", begSec:1035.94, endSec:1059.35 }, + { dst:"2_05_1.wav", begSec:1059.35, endSec:1087.29 }, + { dst:"2_07_0.wav", begSec:1087.29, endSec:1106.16 }, + { dst:"2_08_0.wav", begSec:1106.16, endSec:1144.80 }, + { dst:"2_11_1.wav", begSec:1144.80, endSec:1161.65 }, + { dst:"2_14_1.wav", begSec:1161.65, endSec:1187.05 }, + { dst:"2_04_1.wav", begSec:1187.05, endSec:1231.25 }, + { dst:"2_06_0.wav", begSec:1231.25, endSec:1249.20 }, + { dst:"2_02_1.wav", begSec:1249.20, endSec:1299.71 }, + { dst:"2_10_0.wav", begSec:1299.71, endSec:1318.82 }, + { dst:"2_09_1.wav", begSec:1318.82, endSec:1333.50 }, + { dst:"2_06_1.wav", begSec:1333.50, endSec:1359.28 }, + { dst:"2_12_2.wav", begSec:1359.28, endSec:1381.63 }, + { dst:"2_05_2.wav", begSec:1381.63, endSec:1419.31 }, + { dst:"2_07_1.wav", begSec:1419.31, endSec:1430.36 }, + { dst:"2_13_2.wav", begSec:1430.36, endSec:1444.80 }, + { dst:"2_01_2.wav", begSec:1444.80, endSec:1476.36 }, + { dst:"2_10_1.wav", begSec:1476.36, endSec:1505.92 }, + { dst:"2_03_1.wav", begSec:1505.92, endSec:1551.75 }, + { dst:"2_14_2.wav", begSec:1551.75, endSec:1579.75 }, + { dst:"2_08_1.wav", begSec:1579.75, endSec:1599.79 }, + { dst:"2_11_2.wav", begSec:1599.79, endSec:1627.85 }, + { dst:"2_04_2.wav", begSec:1627.85, endSec:1651.23 }, + { dst:"2_00_1.wav", begSec:1651.23, endSec:1680.52 }, + { dst:"2_07_2.wav", begSec:1680.52, endSec:1709.35 }, + { dst:"2_08_2.wav", begSec:1709.35, endSec:1729.75 }, + { dst:"2_03_2.wav", begSec:1729.75, endSec:1744.20 }, + { dst:"2_00_2.wav", begSec:1744.20, endSec:1759.82 }, + { dst:"2_02_2.wav", begSec:1759.82, endSec:1769.92 }, + { dst:"2_09_2.wav", begSec:1769.92, endSec:1779.57 }, + { dst:"2_14_3.wav", begSec:1779.57, endSec:1793.72 }, + { dst:"2_07_3.wav", begSec:1793.72, endSec:1802.88 }, + { dst:"2_03_3.wav", begSec:1802.88, endSec:1819.58 }, + { dst:"2_10_2.wav", begSec:1819.58, endSec:1832.89 }, + { dst:"2_06_2.wav", begSec:1832.89, endSec:1850.93 }, + { dst:"2_04_3.wav", begSec:1850.93, endSec:1867.80 }, + { dst:"2_01_3.wav", begSec:1867.80, endSec:1888.17 }, + { dst:"2_11_3.wav", begSec:1888.17, endSec:1914.85 }, + { dst:"2_13_3.wav", begSec:1914.85, endSec:1934.81 }, + { dst:"2_08_3.wav", begSec:1934.81, endSec:1955.66 }, + { dst:"2_12_3.wav", begSec:1955.66, endSec:1970.00 }, + { dst:"2_00_3.wav", begSec:1970.00, endSec:1982.46 }, + { dst:"2_06_3.wav", begSec:1982.46, endSec:2014.06 }, + { dst:"2_05_3.wav", begSec:2014.06, endSec:2042.40 }, + { dst:"2_09_3.wav", begSec:2042.40, endSec:2078.88 }, + { dst:"2_10_3.wav", begSec:2078.88, endSec:2111.29 }, + { dst:"2_02_3.wav", begSec:2111.29, endSec:2205.00 }, + ] + + }, + // Extract a section of source audio, apply fade in/out ramps, and mix it into a destination file. cut_and_mix: { diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index d34cffa..57f645a 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -52,6 +52,7 @@ #if defined(cwWEBSOCK) #include "cwIo.h" #include "cwIoTest.h" +#include "cwIoAudioMidi.h" #endif #if !defined(cwWEB) @@ -367,16 +368,18 @@ cw::rc_t websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, i cw::rc_t uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::ui::test(args); } #if defined(cwALSA) cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::io::test(args); } +cw::rc_t ioAudioMidiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::io::audio_midi::main(args); } #else cw::rc_t _no_alsa_websock() { return cwLogError(cw::kResourceNotAvailableRC,"Websock or ALSA functionality not included in this build."); } cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa_websock(); } - +cw::rc_t ioAudioMidiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa_websock(); } #endif #else cw::rc_t _no_websock() { return cwLogError(cw::kResourceNotAvailableRC,"Websocket functionality not included in this build."); } cw::rc_t websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } cw::rc_t uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } +cw::rc_t ioAudioMidiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } #endif @@ -689,6 +692,7 @@ int main( int argc, const char* argv[] ) { "eucon", euConTest }, { "dirEntry", dirEntryTest }, { "io", ioTest }, + { "audio_midi", ioAudioMidiTest }, { "mnist", mnistTest }, { "dataset", datasetTest }, { "dataset_wtr", datasetWtrTest },