User-Defined Opcode Database

stereoMpan

Middle panorama panning of the 'M' component of a stereo signal

Download UDO File

Description

Rotates the center components of a stereo image, primarily keeping the side components in tact.

Syntax

al, ar stereoMpan ainl, ainr, kangle

Initialization

ainl, ainr -- input audio signal

kangle -- the angle of rotation in degrees, usually in the range of -45 to +45. Negative values result in a rotation rightward. Positive values rotate leftward.

Performance

This opcode uses the 'stereoMS' UDO.

Code

opcode stereoMpan, aa, aak

	ainl, ainr, ktheta xin

	; constants
	ipi		=	3.141592653589793
	iradfac	=	ipi/180

	;compute coeffs
	ktheta	=	iradfac*ktheta
	kstheta	=	sin(ktheta)
	kctheta	=	cos(ktheta)

	;Matrix	L/R	soundin	to	M/S
	ainm, ains	stereoMS	ainl, ainr
	
	;Pan M
	aimagm	=	kctheta*ainm
	aimags	=	kstheta*ainm + ains
	
	;Matrix	back	to	L/R
	aoutl, aoutr stereoMS	aimagm, aimags

	xout aoutl, aoutr

endop	

Examples

instr 1

ainl, ainr ins
aoutl, aoutr stereoMpan ainl, ainr, -45 ; center-pan 45 degrees to the right
outs aoutl, aoutr

endin

Credits

Joseph Anderson and ma++, jan 2011


Previous Home Next
stereoBalance   stereoAsymmetry