I have an ultrasonic sensor on top of my monitor to tell the computer when I'm in front of it or not. If music is playing when I walk away from my computer, it pauses the music player. When I return, it starts playing again. It will also wake the monitors from power saving mode when I return, too.
Which gives me this idea to train my loud music playing neighbor to behave. A sensor listens for his music to go beyond a certain level and triggers my Pi to play loud music back to him. Then stop and check if he has lowered his volume, else rinse and repeat. I know its evil, but apartments in Montreal are so bad.
If you're in a cube I wonder if you'd be better suited to an IR-beam break? If you have to walk through an "entrance" you could detect that happening pretty easily - although you'd want to avoid flaps to handle the case of somebody leaving too.
https://www.michevan.id.au/content/are-you-there/