This question already has an answer here:
I want to use an object as a clipping mask for another object. So that the sound waves take on that wedge shape and can be animated as moving through the wedge shape, but of course you don't see the wedge, only the red sound waves.
I need this to be a node setup, probably with ID Masks, Object passes, etc. and not with a boolean modifier as those are unpredictable.
I've done a lot of research and gotten very close but still can't quite figure it out!