Memory Address Interpolation Resolution

Algorithm development and general DSP issues

Moderator: frank

Post Reply
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Memory Address Interpolation Resolution

Post by knutolai »

Ignoring the SIN0/1 functioncs and the CHO instructions as an option. Is there any practical way of implementing an increased interpolation resolution from the 256 positions available with the RMPA-instruction (and ADDR_PTR)?

This could be very useful for performing vibrato on shorter buffer segments with other waveforms than a sine.

I have a concept for a method though I'm struggling with finding a good way to write up the code:

* Consider a positive (0 to 1) variable X with a 23-bit resolution (ignoring negative range), and a memory buffer of 1024 samples (~30 ms).
* The addressing resolution directly available with the ADDR_PTR is : 1024 * 256 = 10 + 8 bit = 18 bit (262 144 positions).
* Using the 18 MSB (most significant bits) of X to set the ADDR_PTR would leave 5 leftover LSB bits available for further interpolation resolution.
* Using the 5 LSB (least significant bits) one could crossfade between two RMPA reading from two adjacent ADDR_PTR positions.
* For our 1024 sample (10-bit) buffer and 23-bit variable X this would produce a interpolation resolution of 23 - 10 = 13 bits.

By the way does anyone know the interpolation resolution when using the CHO instructions for vibrato?
Bonus question: Could anyone think of a way to improve this method by allowing a 24-bit bipolar variable for X ( yielding +1 bit resolution)?

Rough, non-functional code to illustrate the idea:

Code: Select all

mem	buffer	1023	; 30 ms buffer
equ	wave	reg0	; 23-bit positive waveform output register 
equ	xfade	reg1	; 5bit crossfade
equ	const	reg2	; adjacent addr_ptr pos offset constant
equ	adja		reg3	; offset addr_ptr pos
equ	mix		reg4	; temporary mix register

; offset constant setup
clr			; clr acc
or	1		; add (1 / 2^23)
wrax	const, 0	; store, clr acc

; Main addres positions
rdax	wave, 0.03125	; scale down to 18 bit
wrax	ADDR_PTR, 1	; store addres position, keep in acc
rdax	const, 1		; add offset 
wrax	adja, 0		; store adjacent position, clear acc

; 5-bit additional interpolation
ldax	wave		; read waveform
and	0b11111		; remove 18 MSB
sof	-2, 0			; bitwise shift remaining 5 bits with 18 [sof -2,0] instructions
...				; 
wrax	xfade, 0		; store, clr acc

; Audio input
ldax	ADCL	; read audio input
wra	buffer, 0	; store to start of buffer, clr acc

; Audio Output
rmpa	1.0		; read first position
wrax		mix, 0	; store, clr acc

ldax		adja			; read adjacent position
wrax		ADDR_PTR, 0	; set second position, clr acc
rmpa	1.0			; read second position
rdax		mix, -1		;  
mulx		xfade		; perform phase inversion crossfade
rdax		mix, 1		; 
wrax		DACL, 0		; output audio, clr acc
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Re: Memory Address Interpolation Resolution

Post by Digital Larry »

I presume you've seen this:

http://www.spinsemi.com/knowledge_base/ ... _technique
http://www.spinsemi.com/knowledge_base/ ... ing_delays

Your question seems to mix two issues.
a) Can I use an arbitrary waveform? answer: yes, see above
b) Can I get more than 256 interpolated points between real samples? answer: probably, although it's not clear what problem you are solving by doing so. I'm not saying that there is no problem, as clearly the fewer interpolation points you have, the more likely you are to hear a glitch. I'm just wondering how you would go about quantifying the problem and subsequently measuring how much improvement whichever approach you used had.
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Re: Memory Address Interpolation Resolution

Post by knutolai »

Hey! :D

Yes I'm aware of these links. What I'm trying to do here is increase the interpolation resolution further beyond what is done automatically: 256 steps with the servo technique (RMPA). Similar to the equation in the link you posted the crossmix of the two RMPA readings form an additional 5-bit interpolator.

Using the servo-technique produces more zipper noise the faster the modulation frequency. If you compare the RMPA and CHO methods side by side you will notice a difference in zipper noise. Likewise one could compare the RMPA method with the method proposed above (if I'm able to get the coding right) to determine if there is any audio quality benefit to increasing the resolution.

Would love to get your opinion on my code or if you have any other methods to propose!
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Re: Memory Address Interpolation Resolution

Post by Digital Larry »

Interesting...
a) I don't think my hearing is all that great
b) I prefer slower modulation speeds
c) I don't spend a lot of time with the FV-1

The concept of what you are doing is the same, it is a 1st order Lagrange interpolation AFAIK, with better resolution to support quickly changing delay times.

https://mathworld.wolfram.com/LagrangeI ... omial.html

This is similar to the more advanced delay objects available in Faust. See:
https://faust.grame.fr/doc/libraries/in ... delays.lib
and
https://ccrma.stanford.edu/~jos/pasp/Av ... nging.html

I think the JOS article, "Avoiding Discontinuities When Changing Delay Time", may be more to the point here. A lot of this stuff is over my head but the way I interpret this, he's saying that within a single sample period, you don't want to change the delay so quickly that the (modulated) time delta between two samples causes it to jump outside of the interpolation window set by the previous sample. So (IMO) it's less a matter of improving the resolution of interpolation and more a matter of limiting how far you can jump in a single sample period and still have the interpolation step work the way it's supposed to.
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Re: Memory Address Interpolation Resolution

Post by knutolai »

Decided to ditch this idea. For anyone who wants to pursue this there is also another thread discussing it here:
http://www.spinsemi.com/forum/viewtopic ... ation#p309
Post Reply