caw/examples/examples.cfg

534 lines
17 KiB
INI
Raw Normal View History

{
base_dir: "~/src/caw/examples", // Base project directory. See 'sine_file_01' below.
io_dict: "~/src/caw/src/caw/cfg/io.cfg" // Runtime configuration file.
proc_dict: "~/src/caw/src/libcw/flow/proc_dict.cfg", // Processor class definition file.
subnet_dict: "~/src/caw/src/libcw/flow/subnet_dict.cfg", // User written subnet files
programs: {
rt_sine_00: {
dur_limit_secs:5.0,
network: {
procs: {
osc: { class:sine_tone, args:{ hz:100.0 }},
aout:{ class:audio_out, in:{ in:osc.out }, args:{ dev_label:"main"} }
}
}
}
// Demonstrate a simple two processor network.
sine_file_01: {
non_real_time_fl:true,
dur_limit_secs:5.0,
network: {
procs: {
osc: { class: sine_tone },
af: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/out.wav"} }
}
}
}
// Demonstrate a simple signal processing network
mod_sine_02: {
non_real_time_fl:true,
dur_limit_secs:5.0,
network: {
procs: {
lfo: { class: sine_tone, args:{ hz:3, dc:440, gain:110 }}
sh: { class: sample_hold, in:{ in:lfo.out } }
osc: { class: sine_tone, preset:mono, in:{ hz:sh.out } },
af: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/out.wav"} }
}
}
}
// Demonstrate applying a preset at initialization time.
presets_03: {
non_real_time_fl:true,
dur_limit_secs:5.0,
preset: "a",
network: {
procs: {
lfo: { class: sine_tone, args:{ hz:3, dc:440, gain:110 }}
sh: { class: sample_hold, in:{ in:lfo.out } }
osc: { class: sine_tone, in:{ hz:sh.out } },
af: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/out.wav"} }
}
presets:
{
a: { lfo: { hz:1.0, dc:880 }, osc: { gain:0.95 } },
b: { lfo: { hz:2.0, dc:220 }, osc: { gain:0.75 } },
c: { lfo: a880 },
d: [ a,b,0.5 ]
}
}
}
// Demonstrate the `print` processor and event programming.
program_04: {
non_real_time_fl:true,
dur_limit_secs: 10.0,
network {
procs: {
tmr: { class: timer, args:{ period_ms:1000.0 }},
cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:modulo } },
print: { class: print, in: { in:cnt.out, eol_fl:cnt.out }, args:{ text:["my","count"] }}
}
}
}
// Demonstrate 'mult' inputs.
mult_inputs_05: {
non_real_time_fl:true,
dur_limit_secs: 10.0,
network: {
procs: {
tmr: { class: timer, args:{ period_ms:1000.0 }},
cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:modulo } },
numb: { class: number, args:{ in:3 }},
sum: { class: add, in: { in0:cnt.out, in1:numb.out } },
print: { class: print, in: { in0:cnt.out, in1:sum.out, eol_fl:sum.out }, args:{ text:["cnt","add","count"] }}
}
}
}
// Demonstrate different forms of the in-stmt
mult_conn_06: {
non_real_time_fl:true,
dur_limit_secs: 5.0,
network: {
procs: {
// Create an oscillator with a single audio output containing 6 channels.
// Each of the channels is a different frequency.
osc: { class: sine_tone, args: { ch_cnt:6, hz:[110,220,440,880,1760, 3520] }},
// Split the single audio signal into three signals
split: { class: audio_split, in:{ in:osc.out }, args: { select:[ 0,0, 1,1, 2,2 ] } },
// Create merge.in0,in1,in2 by iterating across all outputs of 'split'.
merge_a: { class: audio_merge, in:{ in_:split.out_ } },
af_a: { class: audio_file_out, in:{ in:merge_a.out }, args:{ fname:"$/out_a.wav" }}
// Create merge.in0,in1 and connect them to split.out0 and split.out1
merge_b: { class: audio_merge, in:{ in_:split.out0_2 } },
af_b: { class: audio_file_out, in:{ in:merge_b.out }, args:{ fname:"$/out_b.wav" }}
// Create merge.in0,in1 and connect them both to split.out1
merge_c: { class: audio_merge, in:{ in0_2:split.out1 } },
af_c: { class: audio_file_out, in:{ in:merge_c.out }, args:{ fname:"$/out_c.wav" }}
}
}
}
// Demonstrate creating processors with explicit sfx-ids and connecting to them with a single in-stmt.
proc_suffix_07: {
non_real_time_fl:true,
dur_limit_secs: 5.0,
network: {
procs: {
osc: { class: sine_tone, args: { ch_cnt:6, hz:[110,220,440,880,1760, 3520] }},
split: { class: audio_split, in:{ in:osc.out }, args: { select:[ 0,0, 1,1, 2,2 ] } },
// Create 3 audio gain controls with explicit sfx-ids
g0: { class:audio_gain, in:{ in:split0.out0 }, args:{ gain:0.9} },
g1: { class:audio_gain, in:{ in:split0.out1 }, args:{ gain:0.5} },
g2: { class:audio_gain, in:{ in:split0.out2 }, args:{ gain:0.1} },
// Create audio-merge inputs and connect them to 3 consecutive gain controls
// by iterating the in-stmt over the source proc sfx-id.
merge: { class: audio_merge, in:{ in_:g_.out } },
af: { class: audio_file_out, in:{ in:merge.out }, args:{ fname:"$/out_a.wav" }}
}
}
}
// Demonstrate instantiating 'mult' variables from the an 'args' statement.
mix_08: {
non_real_time_fl:true,
dur_limit_secs:5.0,
network: {
procs: {
osc0: { class: sine_tone, args: { hz:110 } },
osc1: { class: sine_tone, args: { hz:220 } },
gain: { class: number, args: { in:0.5f } },
// Instantiate gain:0 and gain:1 to control the input gain of in:0 and in:1.
mix: { class: audio_mix, in: { in_:osc_.out }, args:{ igain0:[0.8, 0], igain1:[0, 0.2] } },
af: { class: audio_file_out, in: { in:mix.out } args:{ fname:"$/out.wav"} }
}
}
}
// Demonstrate a network with a polyphonic subnet.
simple_poly_09: {
non_real_time_fl:true,
dur_limit_secs: 5.0,
network: {
procs: {
g_list: { class: list, args: { in:0, list:[ 110f,220f,440f ]}},
dc_list: { class: list, args: { in:0, list:[ 220f,440f,880f ]}},
osc_poly: {
class: poly,
args: { count:3 }, // Create 3 instances of 'network'.
network: {
procs: {
lfo: { class: sine_tone, in:{ _.dc:_.dc_list.value_, _.gain:_.g_list.value_ } args: { ch_cnt:1, hz:3 }},
sh: { class: sample_hold, in:{ in:lfo.out }},
osc: { class: sine_tone, in:{ hz: sh.out }},
}
}
}
// Iterate over the instances of `osc_poly.osc_.out` to create one `audio_merge`
// input for every output from the polyphonic network.
merge: { class: audio_merge, in:{ in_:osc_poly.osc_.out}, args:{ gain:1, out_gain:0.5 }},
af: { class: audio_file_out, in:{ in:merge.out } args:{ fname:"$/out.wav"} }
}
}
}
feedback_10: {
non_real_time_fl:true,
max_cycle_count: 10,
network: {
procs: {
a: { class: number, log:{out:0}, args:{ in:1 }},
b: { class: number, log:{out:0 }, args:{ in:2 }},
add: { class: add, in: { in0:a.out, in1:b.out }, out: { out:b.in },
log:{out:0} }
}
}
},
2024-09-13 13:49:48 +00:00
feedback_11: {
non_real_time_fl:true,
max_cycle_count: 10,
print_network_fl: true,
network: {
procs: {
a: { class: number, log:{out:0}, args:{ in:1 }},
b: { class: reg, in:{ in:a.in }, log:{out:0} },
add: { class: add, in: { in0:a.out, in1:b.out }, out: { out:b.in },
log:{out:0}, args:{ otype:int }}
}
}
},
2024-09-13 13:49:48 +00:00
subnet_12 : {
non_real_time_fl: true,
dur_limit_secs: 5,
network: {
procs: {
sub_osc: { class: mod_osc args:{ hz:220, hz_mod_hz:3, hz_mod_depth:55, amp_mod_hz:2, amp_mod_depth:0.5 }},
af: { class: audio_file_out, in:{ in:sub_osc.mo_out }
args:{ fname:"$/out.wav"}}
}
}
}
sample_gen_13: {
non_real_time_fl:false,
dur_limit_secs: 30.0,
network: {
procs: {
tempo: { class:number, args:{ in:2000.0 } },
note_dur: { class:number, args:{ in:1000.0 } },
tmrA: { class: timer, in:{ period_ms:tempo.out } },
cntA: { class: counter, in:{ trigger:tmrA.out }, args:{init:1, min:1, max:128, inc:7, repeat_fl:false, out_type:uint }},
tmrB: { class: timer, in:{ delay_ms:note_dur.out, period_ms:tempo.out } },
zero: { class: number, in:{ trigger:tmrB.out }, args:{ in:0 }},
stop_cnt: { class: counter, in:{ trigger:zero.out }, args:{min:0, max:19, inc:1, repeat_fl:false } },
stop: { class: halt, in:{ in:stop_cnt.upr_lim }},
vel: { class: number, in:{ in0:cntA.out, in1:zero.out }, args:{ out_type:uint }},
log: { class:print, in:{ in0:stop_cnt.out, in1:vel.out, eol_fl:vel.out },args:{ text:[ "i", "d1", ""] }},
note_msg: { class:midi_msg, in:{d1:vel.out, trigger:vel.out }, args:{ch:0, status:144, d0:60}},
damp_msg: { class:midi_msg, args:{ch:0, status:176, d0:64}},
mmerge: { class:midi_merge, in:{ in0:note_msg.out, in1:damp_msg.out }},
mout: { class:midi_out in:{ in:mmerge.out} , args:{ dev_label:"MIDIFACE 2x2", port_label:"MIDIFACE 2x2 Midi Out 1" }}
ain: { class: audio_in, args:{ dev_label:"main" }},
split: { class: audio_split, in:{ in:ain.out } args:{ select: [0,0, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1] }},
mark: { class: audio_marker, in:{ in:split.out0, trigger:vel.out }},
af: { class: audio_file_out, in:{ in:mark.out }, args:{ fname:"~/temp/samples1.wav"}},
aout: { class: audio_out, in:{ in:ain.out }, args:{ dev_label:"main"}},
}
}
},
sample_gen_14: {
non_real_time_fl:false,
network: {
procs: {
tempo: { class: number, args:{ in:1500.0 } },
tmrA: { class: timer, in:{ period_ms:tempo.out } },
cntA: { class: counter, in:{ trigger:tmrA.out }, args:{ init:1, min:1, max:128, inc:7, repeat_fl:false, out_type:uint }},
log: { class: print, in:{ in0:cntA.out, eol_fl:cntA.out }, args:{ text:["x",""] } },
stop: { class: halt, in:{ in:cntA.upr_lim } }
}
}
},
sample_gen_15: {
non_real_time_fl:false,
network: {
procs: {
mf: { class: midi_file, args:{ csv_fname:"~/temp/wt3/21_sample.csv" }},
mout: { class: midi_out in:{ in:mf.out }, args:{ dev_label:"MIDIFACE 2x2", port_label:"MIDIFACE 2x2 Midi Out 1" }},
stop: { class: halt, in:{ in:mf.done_fl }}
ain: { class: audio_in, args:{ dev_label:"main" }},
split: { class: audio_split, in:{ in:ain.out } args:{ select: [0,0, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1] }},
af: { class: audio_file_out, in:{ in:split.out0 }, args:{ fname:"~/temp/wt3/wav/21_samples.wav"}},
aout: { class: audio_out, in:{ in:ain.out }, args:{ dev_label:"main"}},
}
}
},
midi_voice_16: {
non_real_time_fl:false,
network: {
procs: {
mf: { class: midi_file, args:{ csv_fname:"~/temp/temp_midi.csv" }},
voc: { class: midi_voice, in: { in:mf.out } },
stop: { class: halt, in: { in:mf.done_fl }}
af: { class: audio_file_out, in:{ in:voc.out }, args:{ fname:"~/temp/wt/wav/samples.wav"}},
}
}
},
audio_mix_17: {
network: {
procs: {
oscA: { class:sine_tone, args:{ hz:100.0 }},
oscB: { class:sine_tone, args:{ hz:101.0 }},
amix: { class:audio_mix, in{ in0:oscA.out, in1:oscB.out }}
aout:{ class:audio_out, in:{ in:amix.out }, args:{ dev_label:"main"} }
}
}
}
poly_voice_18: {
non_real_time_fl:false,
dur_limit_secs:10,
network: {
procs: {
midi_in: { class:midi_in },
vctl: { class: poly_voice_ctl, in:{ in:midi_in.out }, args:{ voice_cnt:3 } },
voice_poly: {
class: poly,
args: { count:3 }
network: {
procs: {
voc: { class:midi_voice, in:{ _.in:_.vctl.out_ } out:{ _.done_fl:_.vctl.done_fl_ } },
}
}
}
asil: { class: audio_silence, args:{ ch_cnt:6 }},
amix: { class: audio_mix, in:{ in_:voice_poly.voc_.out } },
amrg: { class: audio_merge, in:{ in0:asil.out, in1:amix.out } },
aout: { class: audio_out, in:{ in:amrg.out }, args:{ dev_label:"main"}}
}
}
}
midi_split_19: {
non_real_time_fl:false,
dur_limit_secs:10,
network: {
procs: {
midi_in: { class:midi_in },
ms: { class:midi_split, in: { in:midi_in.out } },
map: { class: list, in:{in:ms.d0}, args: { cfg_fname:"/home/kevin/temp/map.cfg"}},
//mm: { class:midi_msg, in: {ch:ms.ch, status:ms.status, d1:map.out, trigger:map.out } args:{ d0:60 } },
log: { class: print, in: { in0:ms.ch, in1:ms.status, in2:ms.d0, in3:map.out, eol_fl:map.out }, args:{ text:["ch","st","d0","d1",""] } },
}
}
}
piano_voice_20: {
non_real_time_fl:false,
dur_limit_secs:30,
network: {
procs: {
midi_in: { class:midi_in },
vctl: { class: poly_voice_ctl, in:{ in:midi_in.out }, args:{ voice_cnt:3 } },
voice_poly: {
class: poly,
args: { count:3 }
network: {
procs: {
voc: { class:piano_voice, in:{ _.in:_.vctl.out_ },
out:{ _.done_fl:_.vctl.done_fl_ },
args:{ wtb_dir:"~/temp/temp_5.json", wtb_instr:"piano", test_pitch:60 } },
}
}
}
asil: { class: audio_silence, args:{ ch_cnt:6 }},
amix: { class: audio_mix, in:{ in_:voice_poly.voc_.out } args:{ igain_:1.0} },
asel: { class: audio_split, in:{ in:amix.out }, args:{ select:[0,1] }},
amrg: { class: audio_merge, in:{ in0:asil.out, in1:asel.out0, in2:asel.out1 }, args:{ out_gain:2.0 } },
aout: { class: audio_out, in:{ in:amrg.out }, args:{ dev_label:"main"}}
}
}
}
// Play stereo audio out channels 7&8 of the Scarlett.
audio_test_21: {
non_real_time_fl:false,
dur_limit_secs:10,
network: {
procs: {
asil: { class:audio_silence, args:{ ch_cnt:6 }}
osc: { class:sine_tone, args:{ hz:440.0, ch_cnt:2 }},
amrg: { class:audio_merge, in:{ in0:asil.out, in1:osc.out }, args:{ out_gain:1 } },
amtr: { class:audio_meter, in:{ in:amrg.out }, args:{ rpt_ms:500 }},
aout:{ class:audio_out, in:{ in:amrg.out }, args:{ dev_label:"main"} }
}
}
}
piano_voice_22: {
non_real_time_fl:false,
//dur_limit_secs:300,
network: {
procs: {
mf: { class: midi_file, args:{ csv_fname:"~/temp/all_midi.csv" }},
stop: { class: halt, in:{ in:mf.done_fl }}
vctl: { class: poly_voice_ctl, in:{ in:mf.out }, args:{ voice_cnt:3 } },
voice_poly: {
class: poly,
args: { count:3 }
network: {
procs: {
voc: { class:piano_voice, in:{ _.in:_.vctl.out_ },
out:{ _.done_fl:_.vctl.done_fl_ },
args:{ wtb_fname:"~/temp/temp_5.json", wtb_instr:"piano" } },
}
}
}
asil: { class: audio_silence, args:{ ch_cnt:6 }},
amix: { class: audio_mix, in:{ in_:voice_poly.voc_.out } args:{ igain_:1.0 }},
//amrg: { class: audio_merge, in:{ in0:asil.out, in1:amix.out }, args:{ out_gain:1.0 } },
aout: { class: audio_out, in:{ in:amix.out }, args:{ dev_label:"main"}}
}
}
}
sample_gen_23: {
non_real_time_fl:false,
network: {
procs: {
mf: { class: midi_file, args:{ csv_fname:"~/temp/wt1/21_sample.csv" }},
mout: { class: midi_out in:{ in:mf.out }, args:{ dev_label:"MIDIFACE 2x2", port_label:"MIDIFACE 2x2 Midi Out 1" }},
stop: { class: halt, in:{ in:mf.done_fl }}
ain: { class: audio_in, args:{ dev_label:"main" }},
split: { class: audio_split, in:{ in:ain.out } args:{ select: [0,0, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1] }},
//af: { class: audio_file_out, in:{ in:split.out0 }, args:{ bits:0, fname:"~/temp/test.wav"}},
asil: { class: audio_silence, args:{ ch_cnt:6 }},
amrg: { class: audio_merge, in:{ in0:asil.out, in1:split.out0 }, args:{ out_gain:1.0 } },
aout: { class: audio_out, in:{ in:amrg.out }, args:{ dev_label:"main"}}
}
}
},
}
}