It's all about expectation and convention / consensus, also in some respect it's about courtesy to your user, and not irritating them.
Web Pages - No, never.
The experience of opening web page which plays a sound, is widely accepted as negative. You will be hard pressed to find a popular web page/app that does this, Generally this consensus has been formed due to early abuses/over-use when Flash based web sites and poorly conceived web ads were a common experience.
Sometimes thought of as a possible exception, is a game destination page, however, due to the overwhelmingly negative reaction that most people have with unsolicited sound/music, it's better to roll the attract mode / jingles etc, after the user has entered through a static welcoming motif. In other words, just as with video playback, have the user interact with the game before playing sounds at them.
It goes without saying, but always, always, make sound optional, it really doesn't matter how much production value has gone into audio, it's still very much unwelcome on the web.
Consensus is the master here, and unsolicited audio ranks higher than spam as an annoyance, in more polls than I care to mention.
Even if your web app is for specifically playing music, a play button is always the way to go. Note high profile music sites, such as Mixcloud.com, Soundcloud.com and of course, iTunes.
Apps - generally not a good idea, with caveats.
A very well produced, very short jingle on opening ident page, may sound like a nice idea, but after a couple of startups it'll get annoying.
However, if app startup is well managed, ie. app state is saved and restored in it's usual operation, so the user will generally avoid a full startup/ident cycle most of the time, it's not such a problem.
Of course always provide a mute / sound off button.
Apps - Games / "Edutainment"
Startup sounds, music and jingles are relatively common practice among games and children's educational apps.
The user must always have immediate and obvious access to mute / sound off functions, link to any mute buttons / volume controls the device may have, but provide in game controls too, because...
Many people enjoy listening to their own choice of audio as they play games, so check the device and respect any audio that's already playing, if the device will allow you to play audio without interrupting the other channel, be smart and don't play music, just play the environmentals and spot effects.
If you aren't able to play sound without interrupting an existing channel, DON'T PLAY IT.
Always listen to your users
If your app / game does have sound on startup, be careful to make sure your users have a place to feedback and vent, check the consensus among your users, you'll soon know if you have found a sweet spot, or if you're making peoples toes curl.