more sane limits for chamberlin svf and more tests
This commit is contained in:
parent
47ad5610f3
commit
86f93968f7
2 changed files with 34 additions and 17 deletions
|
@ -168,7 +168,7 @@ impl DspNode for SFilter {
|
||||||
for frame in 0..ctx.nframes() {
|
for frame in 0..ctx.nframes() {
|
||||||
let input = inp.read(frame) as f64;
|
let input = inp.read(frame) as f64;
|
||||||
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
||||||
let freq = freq.clamp(1.0, 22000.0);
|
let freq = freq.clamp(2.0, 16000.0);
|
||||||
let res = denorm::SFilter::res(res, frame) as f64;
|
let res = denorm::SFilter::res(res, frame) as f64;
|
||||||
let res = res.clamp(0.0, 0.99);
|
let res = res.clamp(0.0, 0.99);
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ impl DspNode for SFilter {
|
||||||
for frame in 0..ctx.nframes() {
|
for frame in 0..ctx.nframes() {
|
||||||
let input = inp.read(frame) as f64;
|
let input = inp.read(frame) as f64;
|
||||||
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
||||||
let freq = freq.clamp(1.0, 22000.0);
|
let freq = freq.clamp(1.0, 16000.0);
|
||||||
let res = denorm::SFilter::res(res, frame) as f64;
|
let res = denorm::SFilter::res(res, frame) as f64;
|
||||||
let res = res.clamp(0.0, 0.99);
|
let res = res.clamp(0.0, 0.99);
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ impl DspNode for SFilter {
|
||||||
for frame in 0..ctx.nframes() {
|
for frame in 0..ctx.nframes() {
|
||||||
let input = inp.read(frame) as f64;
|
let input = inp.read(frame) as f64;
|
||||||
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
||||||
let freq = freq.clamp(1.0, 22000.0);
|
let freq = freq.clamp(1.0, 16000.0);
|
||||||
let res = denorm::SFilter::res(res, frame) as f64;
|
let res = denorm::SFilter::res(res, frame) as f64;
|
||||||
let res = res.clamp(0.0, 0.99);
|
let res = res.clamp(0.0, 0.99);
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ impl DspNode for SFilter {
|
||||||
for frame in 0..ctx.nframes() {
|
for frame in 0..ctx.nframes() {
|
||||||
let input = inp.read(frame) as f64;
|
let input = inp.read(frame) as f64;
|
||||||
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
let freq = denorm::SFilter::freq(freq, frame) as f64;
|
||||||
let freq = freq.clamp(1.0, 22000.0);
|
let freq = freq.clamp(1.0, 16000.0);
|
||||||
let res = denorm::SFilter::res(res, frame) as f64;
|
let res = denorm::SFilter::res(res, frame) as f64;
|
||||||
let res = res.clamp(0.0, 0.99);
|
let res = res.clamp(0.0, 0.99);
|
||||||
|
|
||||||
|
|
|
@ -247,17 +247,34 @@ fn check_node_sfilter_halsvf_lowpass() {
|
||||||
// (1500, 4), (2000, 8), (3000, 12), (8000, 16),
|
// (1500, 4), (2000, 8), (3000, 12), (8000, 16),
|
||||||
// ]);
|
// ]);
|
||||||
//
|
//
|
||||||
// // High Pass TPT @ 22050Hz
|
// Low Pass Hal Chamberlin SVF @ 22050Hz RES=0.0
|
||||||
// let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 3, 22050.0, 0.0);
|
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 4, 22050.0, 0.0);
|
||||||
// assert_eq!(
|
assert_eq!(
|
||||||
// avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
|
avg_fft_freqs(8.0, &[100, 1000, 4000, 12000, 16000, 20000, 22050], &fft[..]), vec![
|
||||||
// (0, 0), (100, 0), (1000, 0), (4000, 0), (12000, 0),
|
(0, 24), (100, 16), (1000, 16), (4000, 16), (12000, 16),
|
||||||
// ]);
|
(16000, 24), (20000, 24)
|
||||||
//
|
]);
|
||||||
// // High Pass TPT @ 0Hz
|
|
||||||
// let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 3, 0.0, 0.0);
|
// Low Pass Hal Chamberlin SVF @ 22050Hz RES=1.0
|
||||||
// assert_eq!(
|
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 4, 22050.0, 1.0);
|
||||||
// avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
|
assert_eq!(
|
||||||
// (0, 24), (100, 16), (1000, 16), (4000, 16), (12000, 16),
|
avg_fft_freqs(8.0, &[100, 1000, 4000, 12000, 16000, 20000, 22050], &fft[..]), vec![
|
||||||
// ]);
|
(0, 16), (100, 16), (1000, 16), (4000, 24), (12000, 144),
|
||||||
|
(16000, 208), (20000, 24)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Low Pass Hal Chamberlin SVF @ 0Hz RES=0.0
|
||||||
|
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 4, 0.0, 0.0);
|
||||||
|
assert_eq!(
|
||||||
|
avg_fft_freqs(4.0, &[10, 100, 1000, 4000, 12000, 22050], &fft[..]), vec![
|
||||||
|
(0, 0), (10, 0), (100, 0), (1000, 0), (4000, 0), (12000, 0),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Low Pass Hal Chamberlin SVF @ 0Hz RES=1.0
|
||||||
|
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 4, 0.0, 1.0);
|
||||||
|
assert_eq!(
|
||||||
|
avg_fft_freqs(4.0, &[1, 5, 10, 100, 1000, 4000, 12000, 22050], &fft[..]), vec![
|
||||||
|
(0, 56), (1, 0), (5, 0), (10, 0), (100, 0), (1000, 0),
|
||||||
|
(4000, 0), (12000, 0),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue