completed PVerb tests

This commit is contained in:
Weird Constructor 2021-08-15 14:44:57 +02:00
parent 2c458ca117
commit 52d12fa213

View file

@ -92,7 +92,7 @@ fn check_node_pverb_dcy_1() {
trig_env(matrix, node_exec); trig_env(matrix, node_exec);
let spec = run_fft_spectrum_each_47ms(node_exec, 5, 20); let spec = run_fft_spectrum_each_47ms(node_exec, 5, 20);
for (i, s) in spec.iter().enumerate() { println!("{:2} {:?}", i, s); } //d// for (i, s) in spec.iter().enumerate() { println!("{:2} {:?}", i, s); }
// 0 [(388, 19), (431, 74), (474, 61), (517, 10)] // 0 [(388, 19), (431, 74), (474, 61), (517, 10)]
// 1 [(388, 64), (431, 150), (474, 92), (517, 11)] // 1 [(388, 64), (431, 150), (474, 92), (517, 11)]
@ -161,9 +161,11 @@ fn check_node_pverb_dcy_3() {
pset_n_wait(matrix, node_exec, pverb_1, "size", 0.1); pset_n_wait(matrix, node_exec, pverb_1, "size", 0.1);
trig_env(matrix, node_exec); trig_env(matrix, node_exec);
// Run and get RMS for 5 seconds, averaging RMS over 1 seconds:
let rms_spec = run_and_get_rms_mimax(node_exec, 5000.0, 1000.0); let rms_spec = run_and_get_rms_mimax(node_exec, 5000.0, 1000.0);
//d// dump_table!(rms_spec); //d// dump_table!(rms_spec);
assert_vec_feq!(rms_spec.iter().map(|rms| rms.0).collect::<Vec<f32>>(), assert_vec_feq!(
rms_spec.iter().map(|rms| rms.0).collect::<Vec<f32>>(),
// Decay over 5000 ms: // Decay over 5000 ms:
vec![ vec![
0.6254, 0.6254,
@ -199,3 +201,157 @@ fn check_node_pverb_dcy_4() {
0.0456, 0.0456,
]); ]);
} }
#[test]
fn check_node_pverb_dif_on() {
init_test!(matrix, node_exec, 3);
let ad_1 = NodeId::Ad(0);
let pverb_1 = NodeId::PVerb(0);
setup_pverb(matrix);
matrix.sync().unwrap();
// More plucky:
pset_d(matrix, ad_1, "atk", 4.0);
pset_d(matrix, ad_1, "dcy", 40.0);
// Small room, long decay:
pset_n(matrix, pverb_1, "dif", 1.0);
pset_n(matrix, pverb_1, "dmix", 1.0);
pset_n_wait(matrix, node_exec, pverb_1, "dcy", 0.1);
pset_n_wait(matrix, node_exec, pverb_1, "size", 0.5);
trig_env(matrix, node_exec);
let spec = run_fft_spectrum_each_47ms(node_exec, 4, 20);
//d// dump_table!(spec);
// 0 [(388, 8), (431, 35), (474, 35), (517, 7), (560, 5)]
// 1 [(345, 5), (388, 43), (431, 91), (474, 54), (517, 11), (560, 6), (603, 4)]
// 2 [(388, 37), (431, 130), (474, 100), (517, 7), (560, 6)]
// 3 [(345, 5), (388, 36), (431, 80), (474, 53), (517, 8), (560, 4)]
// 4 [(388, 39), (431, 95), (474, 63), (517, 6)]
// 5 [(388, 17), (431, 44), (474, 28)]
// 6 [(388, 8), (431, 5), (474, 5)]
// 7 [(431, 18), (474, 21), (517, 6)]
// 8 [(388, 5), (431, 22), (474, 17)]
// 9 [(388, 6), (431, 14), (474, 9)]
// 10 [(388, 7), (431, 13), (474, 9)]
// 11 [(388, 4), (431, 16), (474, 14)]
// 12 [(431, 6), (474, 6)]
// 13 [(388, 6), (431, 6)]
// 14 [(388, 5), (431, 6), (474, 4)]
// 15 [(388, 8), (431, 13), (474, 6)]
// 16 [(431, 8), (474, 4)]
// 17 []
// We expect a diffuse but defined response:
assert_eq!(spec[0], vec![(388, 8), (431, 35), (474, 35), (517, 7), (560, 5)]);
assert_eq!(spec[7], vec![(431, 18), (474, 21), (517, 6)]);
assert_eq!(spec[13], vec![(388, 6), (431, 6)]);
assert_eq!(spec[17], vec![]);
}
#[test]
fn check_node_pverb_dif_off() {
init_test!(matrix, node_exec, 3);
let ad_1 = NodeId::Ad(0);
let pverb_1 = NodeId::PVerb(0);
setup_pverb(matrix);
matrix.sync().unwrap();
// More plucky:
pset_d(matrix, ad_1, "atk", 4.0);
pset_d(matrix, ad_1, "dcy", 40.0);
// Small room, long decay:
pset_n(matrix, pverb_1, "dif", 0.0);
pset_n(matrix, pverb_1, "dmix", 0.0);
pset_n_wait(matrix, node_exec, pverb_1, "dcy", 0.1);
pset_n_wait(matrix, node_exec, pverb_1, "size", 0.5);
trig_env(matrix, node_exec);
let spec = run_fft_spectrum_each_47ms(node_exec, 4, 20);
//d// dump_table!(spec);
// 0 []
// 1 [(301, 4), (345, 6), (388, 84), (431, 206), (474, 152), (517, 23), (560, 7)]
// 2 []
// 3 [(345, 7), (388, 79), (431, 198), (474, 134), (517, 15), (560, 4)]
// 4 []
// 5 []
// 6 []
// 7 []
// 8 [(388, 6), (431, 17), (474, 11)]
// 9 [(388, 7), (431, 20), (474, 13)]
// 10 []
// 11 []
// 12 [(388, 5), (431, 8), (474, 14), (517, 6)]
// 13 []
// 14 []
// 15 []
// 16 []
// 17 []
// 18 []
// 19 []
// We expect a diffuse but defined response:
assert_eq!(spec[0], vec![]);
assert_eq!(spec[1], vec![(301, 4), (345, 6), (388, 84), (431, 206), (474, 152), (517, 23), (560, 7)]);
assert_eq!(spec[2], vec![]);
assert_eq!(spec[3], vec![(345, 7), (388, 79), (431, 198), (474, 134), (517, 15), (560, 4)]);
assert_eq!(spec[7], vec![]);
assert_eq!(spec[8], vec![(388, 6), (431, 17), (474, 11)]);
assert_eq!(spec[9], vec![(388, 7), (431, 20), (474, 13)]);
assert_eq!(spec[10], vec![]);
assert_eq!(spec[17], vec![]);
assert_eq!(spec[19], vec![]);
}
#[test]
fn check_node_pverb_dif_off_predly() {
init_test!(matrix, node_exec, 3);
let ad_1 = NodeId::Ad(0);
let pverb_1 = NodeId::PVerb(0);
setup_pverb(matrix);
matrix.sync().unwrap();
// More plucky:
pset_d(matrix, ad_1, "atk", 4.0);
pset_d(matrix, ad_1, "dcy", 40.0);
// Enable pre-delay of 150ms:
pset_d(matrix, pverb_1, "predly", 150.0);
// Small room, long decay:
pset_n(matrix, pverb_1, "dif", 0.0);
pset_n(matrix, pverb_1, "dmix", 0.0);
pset_n_wait(matrix, node_exec, pverb_1, "dcy", 0.1);
pset_n_wait(matrix, node_exec, pverb_1, "size", 0.5);
trig_env(matrix, node_exec);
let spec = run_fft_spectrum_each_47ms(node_exec, 4, 20);
dump_table!(spec);
// 0 []
// 1 []
// 2 []
// 3 []
// 4 [(215, 5), (301, 11), (345, 15), (388, 46), (431, 105), (474, 86), (517, 18), (560, 14), (603, 5)]
// 5 [(345, 6), (388, 21), (431, 35), (474, 30), (517, 11), (560, 4)]
// 6 [(258, 5), (301, 7), (345, 18), (388, 52), (431, 140), (474, 76), (517, 13), (560, 10), (603, 5)]
// 7 [(345, 7), (388, 17), (431, 24), (474, 21), (517, 12), (560, 4)]
// 8 []
// 9 []
// We expect a diffuse but defined response:
assert_eq!(spec[0], vec![]); // ~50ms
assert_eq!(spec[1], vec![]); // ~50ms
assert_eq!(spec[2], vec![]); // ~50ms
assert_eq!(spec[3], vec![]); // ~50ms
assert_eq!(spec[4], vec![(215, 5), (301, 11), (345, 15), (388, 46), (431, 105), (474, 86), (517, 18), (560, 14), (603, 5)]);
}