I am trying to implement the resampling algorithm as described in this paper: https://ccrma.stanford.edu/~jos/resample/resample.pdf
I managed to construct the $h$ (windowed sinc) table, and I have implemented the loop. I am having a hard time to compute the $\eta$ interpolation factor and the $l$ index index for the $h$ table. The "fixed point" implementation of the paper is a bit confusing to me.
Looking at figure 7 in the paper, I think the interpolation factor needs to be computed between the $h$ entries instead of between the original samples. However I don't understand how to compute the starting point ($h(0)$). As in the paper, the table only contains the half wing.
I have just started working with audio code, so I might be misunderstanding something fundamental about the paper.
Here's the main code:
Fs = 44100
Fs_prime = 96000
Nz = 13
L = 128
M = (Nz * 2 + 1) * L
def resample(original, windowed_sinc):
ratio = Fs_prime / Fs
t_increment = 1 / Fs_prime
inteval_orig = 1 / Fs
Lo = len(original)
l_half = M // 2
y = np.zeros(int(ratio * Lo + 0.5))
t = 0
l = 0
for n in range(y.shape[0]):
n0 = int(t / inteval_orig)
original_t = n0 * inteval_orig
eta0 = 1 - (t - original_t ) / inteval_orig
eta1 = 1 - eta0
v = 0
eta = eta0
for i in range(Nz):
ni = n0 - i
if ni < 0 or ni >= Lo:
continue
lL = l + (i * L)
print(lL)
if lL + 1 < 0 or lL + 1 >= l_half:
break
v += original[ni] * ( w[lL] + eta * (w[lL + 1] - w[lL]) )
eta = eta1
for i in range(Nz):
ni = n0 + 1 + i
if ni < 0 or ni >= Lo:
continue
lL = l + (1 + i * L)
print(lL)
if lL + 1 >= l_half:
break
v += original[ni] * ( w[lL] + eta * (w[lL + 1] - w[lL]) )
l = (l + n0) % l_half
y[n] = v
t += t_increment
return y