In guitar(and probably other things as well), there's a term we use, noodling. This is the act of moving up and down the scale without any semblance of melody or pattern. It's 'fucking amazing' to the uninitiated, as it can be done really, really fast(!), but it's annoying as hell to any guitarist of skill. If I had to define musical masturbation, I'd say it's just a nicer way of saying noodling.