Interesting.
This is a large undertaking. The FSO sound code is only ready for this in spirit. The largest problem for implementing this would be extending the sound information enough to carry the metadata required to do this and to correctly reset channels after having used these more advanced OpenAL features.
The functions in question would be ds3d_play and ds_play, but the problem for you in implementing this feature would be that both functions are actually too low level for what you are wanting to do, so you would have to implement a shimlayer that would allow these soundsets to be implemented using ds3d_play and ds_play.
As far as implementing the interface to this feature, please, please don't use another set of numbers that are interchangeable but orthogonal to the stuff that is in sound.tbl. Instead use names (probably force them to start with
sset_ or something similar (remember identifiers in FSO need to be less than 32 chars)) and modify/extend parse_sound (which is used by the weapons.tbl parser to do a couple of neat tricks with sound filenames already). This will allow a tabler to use a soundset just like they could a filename. Also, remember this is going to basically require that you do this for everything or nothing because otherwise SCP is going to be forever adding support for this feature one location at a time.
As for the proposed table format. I already went over the use of numbers, but I feel so strongly about it I am going to repeat it, just don't number these as well. Also, make sure that this table can be used as a modular table because otherwise this feature is going to be a mod data bug farm. I would also suggest allowing the sets to include sounds based on its filename like weapons.tbl does already. Is the randomize pitch and volume per sound or per soundset?
A better method to define the range the volume, pitch should randomize in would be like so:
+Randomize Pitch: 10.0, 10.0 ;;First value is positive (higher pitched), second value is negative (lower pitched)
;; ex. values of 10.0, 10.0 would result in a pitch range of +10.0% to -10.0% of the sound's original pitch
This is a bad idea. Just make it
+Randomize Pitch: and two numbers between -100 and 100 (or whatever range makes sense). That is, require the tabler to specify a negative number to get a negative pitch shift. This way a tabler (and I know one will ask) can use a +10% to +20% random shift. Also, drop the comma in the data and just make it whitespace because the comma just complicates the parsing of the data and is different than how the rest of the .tbls are parsed.
As for the differentiation between sounds and sound sets, we could overloard the existing sound function(s) with an optional flag:
sound_function( ... , bool Is_a_sound_set = FALSE )
(No, that's not the actual sound function.
)
Not a real fan of this, because the current sound functions already have several default variables, I would prefer if all sounds were assumed to be in a soundset of 1 with the default (read no) variations and they are assigned a name of their specific number.
Lastly... Sound set's might also include sub-groups to be used in particular environments. Although I personally think it would be better to come up with a way to apply distortions to the sounds/sound sets depending on the environment the player is in (read: atmospheric vs. space), for now, it may be good to make an $Environment Group: option.
#Sound Sets
$Set: 0 ;; The ID number for this set
+Cycle: random ;; Will cycle randomly. Defaults to forward cycling (top of the list down)
$Environment: 0 ;; Environment sub group. Defaults to 0 if not specified
$Sound: 10 ;; The ID number of the first sound
+Randomize Pitch: 0.3 ;; Pitch Randomization percentage ( between +/- 30%)
+Randomize Volume: +0.1 ;; Volume Randomization percentage ( up to +10%)
$Environment: 1
$Sound: 11
$Sound: 12
#End
Again. Use names for the Environments and default to the first one listed and let the FREDer pick the environment with a sexp, that way they can do whatever funky thing they want.
Anyway, this is my 30 minute shoot from the hip response to this, hopefully it is useful to you.