Well…this seems to work, and could have its uses.
If you output an inverted phase version of the monitor output, that’ll effectively cancel the output. But in-between it also gives you the opportunity to process a copy of the audio from monitor, and mix the processed version into the output. So, after the original is cancelled, all you’re left with is the processed output.
That was wordy, so here’s an example. Append this instrument (and event) to any orchestra, and you instantly have a global volume limiter.
;;make sure this is the highest numbered instrument!
instr 100
aout1, aout2 monitor ;get audio from spout
;;copy audio and limit
areplaceout1 compress aout1, aout1, 0, 90, 90, 100, 0.0, 0.08, 0.08
areplaceout2 compress aout2, aout2, 0, 90, 90, 100, 0.0, 0.08, 0.08
;;phase flip original signal
acancel1 = -aout1
acancel2 = -aout2
;sum
asum1 = areplaceout1 + acancel1
asum2 = areplaceout2 + acancel2
;output - the phase flipped signal should cancel the original,
;leaving just the compressed signal.
outs asum1, asum2
endin
event_i “i”, 100, 0, -1