Skip to content

Commit

Permalink
Interpolator: setting up test output in Octave for Allpass, not happy…
Browse files Browse the repository at this point in the history
… with results. issue #67
  • Loading branch information
nwolek committed Dec 31, 2015
1 parent dba25a9 commit 1da0b24
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/Interpolator/InterpolatorTargetOutput.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
output_splinegen = double (1 : 64);
output_cubicgen = double (1 : 64);
output_cosinegen = double (1 : 64);
output_allpassgen = double (1 : 64);
lastout_allpass = 0.0;

% the following function is adapted from gen~.interpolation example from Max 7.1
function retval = interp_hermitegen(v,delta)
Expand Down Expand Up @@ -93,6 +95,17 @@
retval = x + a2*(y-x);
endfunction

% reference: https://ccrma.stanford.edu/~jos/pasp/First_Order_Allpass_Interpolation.html
function retval = interp_allpassgen(v,delta,history)
retval = 0.0;
delta_int = fix(delta);
a = delta - delta_int;
x1 = v(delta_int);
x2 = v(delta_int+1);
out = x1 + a*(x2-history);
retval = out;
endfunction

for i = 1:64
current_delta = 2.0 + i / 64;
output_linear(i) = interp1(x,current_delta);
Expand All @@ -102,6 +115,8 @@
output_splinegen(i) = interp_splinegen(x,current_delta);
output_cubicgen(i) = interp_cubicgen(x,current_delta);
output_cosinegen(i) = interp_cosinegen(x,current_delta);
output_allpassgen(i) = interp_allpassgen(x,current_delta,lastout_allpass);
lastout_allpass = output_allpassgen(i);
endfor

save expectedOutput.mat output_linear
Expand All @@ -111,3 +126,4 @@
save -append expectedOutput.mat output_splinegen
save -append expectedOutput.mat output_cubicgen
save -append expectedOutput.mat output_cosinegen
save -append expectedOutput.mat output_allpassgen

0 comments on commit 1da0b24

Please sign in to comment.