On Sat, Apr 13, 2024 at 03:26:38PM +0100, Marco Castorina wrote: > I have coded a prototype which is shared here: > https://gist.github.com/theWatchmen/746f35c349748525b412cfd9466608ce
You'll probably get a better idea of what is going wrong if you decrease the input frequency a bit, e.g. 50 instead of 400. This produces something close to the wanted result, but there is still something wrong. Don't know what it is (and you should find out by yourself), but to me the logic in resample_window_sinc() seems a lot more complex than it should be. The principal way this is supposed to work is quite simple: - for each output sample you use a new filter from the set of 128 by incrementing the index by a fixed value. This may not be an integer, so you need to round. - if the new index moves out of range, subtract 128 and advance by one sample in the input array until the index is within range. So that should be a bit simpler than your current code. Some other (unrelated) hints: - Use the Bessel functions from scipy.special. - If you change sinc = [0]*34 + sinc # TODO(marco): compute correct number of zeros to sinc = [0]*Nzd + sinc then you can replace sincr = np.zeros((L, Nzd)) for l in range(L): for i in range(Nzd): sincr[l][i] = sinc[L*i + l] by sincr = sinc.reshape (Nzd, L+1) sincr = sincr.T This will give you L+1 filters instead of L, but that shouldn't matter. The extra one is just the first shifted by one sample, and if you get the logic right it won't be used. Ciao, -- FA _______________________________________________ Linux-audio-dev mailing list -- linux-audio-dev@lists.linuxaudio.org To unsubscribe send an email to linux-audio-dev-le...@lists.linuxaudio.org