From 89f42c73a17ff24ce5b8f7381ced1ca335f545ca Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 6 May 2022 16:17:06 -0400 Subject: [PATCH] main.cfg : many changes --- src/cwtest/cfg/main.cfg | 250 +++++++++++++++++++++++++--------------- 1 file changed, 159 insertions(+), 91 deletions(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 3c264c4..4315b19 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -30,12 +30,12 @@ }, serialSrv: {}, - midiDevice: {}, + midiDevice: {}, // print a list of midi devices and send a MIDI note textBuf: {}, audioBuf: {}, audioDev: {}, audioDevAlsa: {}, - audioDevRpt: {}, + audioDevRpt: {}, // print a list of audio device socket: {}, socketTcp: {}, @@ -913,8 +913,8 @@ presets: { - hi: { gain:1 }, - lo: { gain:0.1 }, + mute_off: { gain:1 }, + mute_on: { gain:0 }, } } @@ -974,8 +974,8 @@ pv_analysis: { vars: { in: { type:audio, srcFl:true, doc:"Audio input." }, - hopSmpN: { type:uint, value: 128, doc:"Hop sample count." }, - wndSmpN: { type:uint, value: 512, doc:"Window sample count." }, + hopSmpN: { type:uint, value: 128, doc:"Hop sample count." }, + wndSmpN: { type:uint, value: 512, doc:"Window sample count." }, hzFl: { type:bool, value: false, doc:"Calculate frequency via the method of phase changeof each bin." }, out: { type:spectrum, doc:"Spectrum output." } } @@ -1155,6 +1155,7 @@ } kc: { + bypass: false igain: 3.0 thresh: 80.0 ratio: 2.0 @@ -1210,22 +1211,22 @@ g: { igain: 10.0 - ogain: 1.0 + ogain: 0.25 } g_a: { igain: 10.0 - ogain: 1.0 + ogain: 0.25 } g_1_a: { igain: 10.0 - ogain: 1.0 + ogain: 0.25 } g_1_d: { igain: 10.0 - ogain: 1.0 + ogain: 0.25 } @@ -1290,30 +1291,78 @@ preset_sel: { params: { - score_fn: "/home/kevin/src/currawong/projects/score_proc/data/play_file.cfg", + //score_fn: "/home/kevin/src/currawong/projects/score_proc/data/play_file.csv", + score_fn: "/home/kevin/src/currawong/projects/score_proc/temp.csv", record_dir: "/home/kevin/temp/preset_sel_app", - record_fn: "preset_sel", + record_fn: "preset_sel_20220423", + //record_fn: "preset_sel_20220506", record_fn_ext: "txt", - max_midi_msg_count: 32768, - midi_timer_period_micro_sec: 15000, - midi_out_device: "Fastlane" - midi_out_port: "Fastlane MIDI A", - //midi_out_device: "PipeWire-RT-Event" - //midi_out_port: "input", - crossFadeSrate: 48000.0, // TODO: move to flow cfg. and set via 'system default sample rate' - crossFadeCount: 3, + crossFadeCount: 3, + presets: { preset_labelL: [ "dry", "a", "b", "c", "d", "f1", "f2", "f3", "f4", "g", "ga", "g1a", "g1d" ], default_gain: 1.0, default_wet_dry_gain: 0.5, default_fade_ms: 500.0, - default_preset: "dry" + default_preset: "dry", + + default_master_wet_in_gain: 1.0, + default_master_wet_out_gain: 1.0, + default_master_dry_gain: 1.0, + default_master_sync_delay_ms: 400, + }, + + midi_play_record: { + max_midi_msg_count: 32768, + midi_timer_period_micro_sec: 15000, + log_in_flag: false, + log_out_flag: false, + half_pedal_flag: false, + + midi_device_list: [ + // piano + { + enableFl: true, + midi_out_device: "Scarlett 18i20 USB", + midi_out_port: "Scarlett 18i20 USB MIDI 1", + //midi_out_device: "PipeWire-RT-Event", + //midi_out_port: "input", + + // pedal down velocity input/output mapping + pedal: { + down_id: 127, + down_vel: 75, + half_down_id: 64, + half_down_vel: 43, + half_up_id: 63, + half_up_vel: 43 + + }, + + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 + vel_table: [ 1, 4, 10, 12, 12, 18, 24, 24, 30, 36, 36, 44, 48, 52, 58, 64, 64, 70, 76, 82, 88, 94,100,106,112 ] + }, + { + + enableFl: true, + midi_out_device: "Fastlane", + midi_out_port: "Fastlane MIDI A", + //midi_out_device: "PC-300", + //midi_out_port: "PC-300 MIDI 1", + + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 34 + vel_table: [ 1, 5 10, 16, 21, 26, 32, 37, 42, 48, 53, 58, 64, 69, 74, 80, 85, 90, 96,101,106,112,117,122,127 ] , + }, + + //{ midi_out_device: "PipeWire-RT-Event", midi_out_port: "input" }, + ], + } frag_panel: { @@ -1325,8 +1374,8 @@ col: { numb_disp: { name: fragBegLocId, title:"Beg Loc", value: 0 }, numb_disp: { name: fragEndLocId, title:"End Loc", value: 0 }, - number: { name: fragInGainId, title:"In Gain", min:0.0, max:10.0, step:0.1, decpl:1 }, - number: { name: fragOutGainId, title:"Out Gain", min:0.0, max:10.0, step:0.1, decpl:1 }, + number: { name: fragInGainId, title:"In Gain", min:0.0, max:100.0, step:0.1, decpl:1 }, + number: { name: fragOutGainId, title:"Out Gain", min:0.0, max:100.0, step:0.1, decpl:1 }, }, col: { row: { @@ -1404,9 +1453,9 @@ deviceL: [ { // System device name - //device: "Scarlett 18i20 USB USB Audio", - device: "USB Audio CODEC USB Audio", - //device: "HDA Intel PCH CS4208 Analog", + 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 @@ -1429,33 +1478,6 @@ } - flow0: { - framesPerCycle: 64, // time-domain audio cycles frame per cycle - maxCycleCount: 15000, // 0 disables maxCycleCount - printNetworkFl: false, // print the network instance - printClassDictFl: false, // print the class description dictionary - - - - network: { - sin: { class: sine_tone, args:{ default:{ hz:[220,880]} }}, - splitL: { class: audio_split, in:{ in:sin.out }, args:{ default:{ select:[1,0]} }}, - splitR: { class: audio_split, in:{ in:sin.out }, args:{ default:{ select:[0,1]} }}, - - delay: { class: audio_delay, in:{ in:splitL.out }, args:{ default:{ delayMs:1} }}, - bal: { class: balance, args:{} }, - mix: { class: audio_mix, in:{ in0:delay.out, in1:splitL.out, gain0:bal.out, gain1:bal.inv_out }, args:{ }}, - - merge: { class: audio_merge, in:{ in0:mix.out, in1:splitR.out }, args:{}}, - aout: { class: audio_out, in:{ in:merge.out }, args:{ default:{dev_label:"main"} } }, - } - - presets: { - a: { splitL:hi, splitR:lo }, - b: { splitL:lo, splitR:hi } - } - - } flow: { framesPerCycle: 64, // time-domain audio cycles frame per cycle @@ -1466,6 +1488,66 @@ network: { + aud_in: { class: audio_in, args:{ default:{dev_label:"main"} } }, + + // select the first two channels (this reduces the channel count if there are more than 2 incoming channels) + split_in: { class: audio_split, in:{ in:aud_in.out } args:{ default:{select[1,1]}} } + + // delay the incoming audio signal to sync it with the piano + sync_delay { class: audio_delay, in: { in:split_in.out }, args:{ default:{ delayMs:400 } }} + + mstr_wet_in_gain: { class: audio_gain, in:{ in:sync_delay.out }, args:{}} + + // wet signal processing chain + wet_in_gain: { class: audio_gain, in:{ in:mstr_wet_in_gain.out }, args:{}}, + pva: { class: pv_analysis, in:{ in:wet_in_gain.out }, args:{ default:{ wndSmpN:512, hopSmpN:128, hzFl:false } } }, + sd: { class: spec_dist, in:{ in:pva.out }, preset:kc }, + pvs: { class: pv_synthesis, in:{ in:sd.out }, }, + cmp: { class: compressor, in:{ in:pvs.out }, preset:kc }, + + wet_out_gain: { class: audio_gain, in:{ in:cmp.out }, args:{}}, + + mute_wet: { class: audio_gain, in:{ in:wet_out_gain.out }, args:{}}, + + + // apply the wet/dry gain balance + wd_bal: { class: balance, args{}}, + wet_bal_gain: { class: audio_gain, in:{ in:mute_wet.out, gain:wd_bal.out }, args:{}}, + dry_bal_gain: { class: audio_gain, in:{ in:sync_delay.out, gain:wd_bal.inv_out }, args:{}}, + + mstr_wet_out_gain: { class: audio_gain, in:{ in:wet_bal_gain.out }, args:{}} + mstr_dry_out_gain: { class: audio_gain, in:{ in:dry_bal_gain.out }, args:{}}, + + // merge the wet/dry signals into a single 4 channel signal + merge: { class: audio_merge, in:{ in0:mstr_wet_out_gain.out, in1:mstr_dry_out_gain.out }, args:{} }, + + aout: { class: audio_out, in:{ in:merge.out }, args:{ default:{dev_label:"main"} } }, + } + + presets: { + dry: { + mute_wet: { gain:0 }, + }, + a: { sd:a, cmp:a, mute_wet:{ gain:1 } }, + b: { sd:b, cmp:b, mute_wet:{ gain:1 } }, + c: { sd:c, cmp:c, mute_wet:{ gain:1 } }, + d: { sd:d, cmp:d, mute_wet:{ gain:1 } }, + f1: { sd:f_1, cmp:f_1, mute_wet:{ gain:1 } }, + f2: { sd:f_2, cmp:f_2, mute_wet:{ gain:1 } }, + f3: { sd:f_3, cmp:f_3, mute_wet:{ gain:1 } }, + f4: { sd:f_4, cmp:f_4, mute_wet:{ gain:1 } }, + g: { sd:g, cmp:g, mute_wet:{ gain:1 } }, + ga: { sd:g_a, cmp:g_a, mute_wet:{ gain:1 } }, + g1a: { sd:g_1_a, cmp:g_1_a, mute_wet:{ gain:1 } }, + g1d: { sd:g_1_d, cmp:g_1_d, mute_wet:{ gain:1 } } + + } + } + + + } + + stereo_network: { ain: { class: audio_in, args:{ default:{dev_label:"main"} } }, // split the input channels to create a wet and dry signal path @@ -1497,46 +1579,32 @@ aout: { class: audio_out, in:{ in:merge.out }, args:{ default:{dev_label:"main"} } }, } - presets: { - dry: { - //wd_bal: { in:0 } - }, - a: { sd:a, cmp:a }, - b: { sd:b, cmp:b }, - c: { sd:c, cmp:c }, - d: { sd:d, cmp:d }, - f1: { sd:f_1, cmp:f_1 }, - f2: { sd:f_2, cmp:f_2 }, - f3: { sd:f_3, cmp:f_3 }, - f4: { sd:f_4, cmp:f_4 }, - g: { sd:g, cmp:g }, - ga: { sd:g_a, cmp:g_a }, - g1a: { sd:g_1_a, cmp:g_1_a }, - g1d: { sd:g_1_d, cmp:g_1_d } + sine_network: { + framesPerCycle: 64, // time-domain audio cycles frame per cycle + maxCycleCount: 15000, // 0 disables maxCycleCount + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + + + network: { + sin: { class: sine_tone, args:{ default:{ hz:[220,880]} }}, + splitL: { class: audio_split, in:{ in:sin.out }, args:{ default:{ select:[1,0]} }}, + splitR: { class: audio_split, in:{ in:sin.out }, args:{ default:{ select:[0,1]} }}, + + delay: { class: audio_delay, in:{ in:splitL.out }, args:{ default:{ delayMs:1} }}, + bal: { class: balance, args:{} }, + mix: { class: audio_mix, in:{ in0:delay.out, in1:splitL.out, gain0:bal.out, gain1:bal.inv_out }, args:{ }}, - } - } - - - } - - full_network: - { - - network: { - ain: { class: audio_in, args:{ default:{dev_label:"main"} } }, - - pva: { class: pv_analysis, in:{ in:ain.out }, args:{ default:{ wndSmpN:512, hopSmpN:128, hzFl:false } } }, - sd: { class: spec_dist, in:{ in:pva.out }, preset:kc }, - pvs: { class: pv_synthesis, in:{ in:sd.out }, }, - cmp: { class: compressor, in:{ in:pvs.out }, preset:kc }, - - mix: { class: mixer, in{ in0:ain.out, in1:cmp.out }, - - //sin: { class: sine_tone, args:{}}, - aout: { class: audio_out, in:{ in:cmp.out }, args:{ default:{dev_label:"main"} } }, + merge: { class: audio_merge, in:{ in0:mix.out, in1:splitR.out }, args:{}}, + aout: { class: audio_out, in:{ in:merge.out }, args:{ default:{dev_label:"main"} } }, } - } + presets: { + a: { splitL:hi, splitR:lo }, + b: { splitL:lo, splitR:hi } + } + + } }