Page 1 of 1

Priority Left and Right Signal Detection

Posted: Sat Dec 30, 2006 12:41 pm
by Jsteele
Its it possible to have priority given to say the Left channel.

Example:

If no signal detected on the Left channel input then play Right channel output.
If signal detected on Left channel then don

Posted: Sat Dec 30, 2006 2:48 pm
by frank
No reason you can't do this. Just average the left channel and when it drops below a set level, play the right instead. Sounds like you want to do ducking, using level of one signal to control the level of another signal.

I've a few ideas on the code but am away from the office today so can't try them out.

Posted: Thu Jan 04, 2007 5:52 pm
by kradsith
Hey JSteele,

Give this a try

Code: Select all

equ sigin reg0
equ avg reg1

rdax     	adcr,1		; Read Right Channel
wrax 	sigin,1		; Write ACC to sigin
mulx 	sigin           	;square ACC
rdfx 	avg,0.01		;sub sigin from avg, multipy by 0.01 add to reg and put in ACC
wrax 	avg,1          	;write average and leave in ACC

skp	zro,leftchannel	; Right channel is 0, jump to Left Channel

rdax	adcr,1		; Read Right input
wrax	dacr,1		; Write Right input to Right output
wrax	dacl,0		; Write Right input to Left output

skp 	gez, end		; Right channel has priority Skip left Channel and End

leftchannel:

rdax 	adcl,1		; read left input
wrax 	dacl,0		; write Left to Right output
wrax 	dacr,0		; write Left to Left output

end:
this will give priority to the Right channel and then jumps to the Left when no signal. The Signal detection could be tweaked a little better or maybe a little delay to buffer a bit of the left channel to give it some space before letting the Left channel play, Otherwise if the right channel has some low signals it will start stuttering between the two. I haven't got that far in my fiddling.