Log in

View Full Version : [TEC] AmbientVolume controller


gap
07-06-12, 03:32 PM
Hi there,

I am currently working on importing a SHIII unit in SH5. Among other things, I am trying to set the volume of its sounds. For doing it I am using the AmbientVolume controller, that allows us to change sound volumes depending on both camera and parent object's location.

Its main parameters are sorted in arrays. Each array is composed by an identifier (making reference to SounSource identifiers in the same dsd file) and by a group of volume modifiers for different camera and object position:


ObjectAboveWater
ObjectBelowWater
CameraAboveWater
CameraBelowWater
CameraInterior
CameraSonar


So far so good. I'm experiencing a couple of shortcoming though:

- whenever I set two or more sounds to share the same identifier, trying to set their volume as a group, SounSource stops working and they can be heard "normally" in game as if the controller wasn't there.

- If I am not mistaken, sound modifier parameters seem to be expressed as percentages of the original volume (0=silent, 1=100%); nonetheless, everytime I try to set a value <1, instead of being reduced sounds are zeroed. In other words, the controller behaves like an on/off trigger.

Did anyone else experiment with it? I wonder whether I am missing something, or peraphs AmbientVolume is no longer fully supported by SH5? :hmm2:

TheDarkWraith
07-06-12, 03:40 PM
AmbientVolume controller works fine in SH5. Take a look at FX update, it uses it for the flares, debris, torp explosion, etc.. Sounds more like you're using an illegal identifier. What identifiers are you using? You did add your sounds to the Sh.sdl file correct?

gap
07-06-12, 03:45 PM
Another quick question on sounds:

I wish some sounds to be triggered by particle generators (splashes, wakes, etc), i.e. being played during the lifespam of particles, and stopping particles desappear.

I am sure something like this is feasible, but I have no clue on how to do it. Until now simply giving these sound the same parent IDs as the particle generator tha should trigger them, didn't give the expected results.

Probably I could get inspired by some existing unit, but if in the meanwhile some good-hearted oldtimer will read this thread, his help will be much appreciated! :)

TheDarkWraith
07-06-12, 03:51 PM
Another quick question on sounds:

I wish some sounds to be triggered by particle generators (splashes, wakes, etc), i.e. being played during the lifespam of particles, and stopping particles desappear.

I am sure something like this is feasible, but I have no clue on how to do it. Until now simply giving these sound the same parent IDs as the particle generator tha should trigger them, didn't give the expected results.

Probably I could get inspired by some existing unit, but if in the meanwhile some good-hearted oldtimer will read this thread, his help will be much appreciated! :)

The sound has to be attached (it's parent node) to the type 4/100 node of the particle (if you want the sound to be associated with just the particle) or of the particle generator (thus sound is played where the type 4/100 node's location is)

gap
07-06-12, 03:55 PM
AmbientVolume controller works fine in SH5. Take a look at FX update, it uses it for the flares, debris, torp explosion, etc.. Sounds more like you're using an illegal identifier. What identifiers are you using? You did add your sounds to the Sh.sdl file correct?

Yes I did, and for any other purpose they play correctly in game.

As for identifiers, I am using custom ones. Suspecting that this could have been the reason, I tried to change them with standard ids (iirc Propeller, or Engine), and it didn't make any difference.

I'll try again anyway. Thanks!

TheDarkWraith
07-06-12, 03:59 PM
Yes I did, and for any other purpose they play correctly in game.

As for identifiers, I am using custom ones. Suspecting that this could have been the reason, I tried to change them with standard ids (iirc Propeller, or Engine), and it didn't make any difference.

I'll try again anyway. Thanks!

For 'normal' sounds Effect is the correct identifier. For underwater sounds hy2 is the correct identifier.

gap
07-06-12, 04:00 PM
The sound has to be attached (it's parent node) to the type 4/100 node of the particle (if you want the sound to be associated with just the particle) or of the particle generator (thus sound is played where the type 4/100 node's location is)

Is this enough? Are there no special names/settings to be given in .sdl file? No special identifier to be set in SoundSource controller? No other controller in .dsd file to be associated with generator's ID?

gap
07-06-12, 04:01 PM
:hmmm:For 'normal' sounds Effect is the correct identifier. For underwater sounds hy2 is the correct identifier.

Ah okay, I'll try it and report back in a few... thank you very much! :salute: :up:

EDIT:

WHY hy2? Isn't it hyd? On the unit I am workin on the Identifier hyd seems to work correctly.... :hmmm:

TheDarkWraith
07-06-12, 04:05 PM
Is this enough? Are there no special names/settings to be given in .sdl file? No special identifier to be set in SoundSource controller? No other controller in .dsd file to be associated with generator's ID?

That is all. It's really that simple to add new sounds (besides needed entries in DSD file and Sh.sdl also) :yep:

Your SoundSource, AmbientVolume, and SonarTarget entries parent ID will be what I spoke about above.

gap
07-06-12, 04:17 PM
Sorry, one more question:

according to your experience, is sounds volume, especially on hydrophone, somehow related to ship's current speed? Perhaphs through the ShipSound controller (StdByMaxRpm parameter)? If so, is there any way to set sounds free from this constrain?

TheDarkWraith
07-06-12, 04:26 PM
WHY hy2? Isn't it hyd? On the unit I am workin on the Identifier hyd seems to work correctly.... :hmmm:

hy2 is what all the stock DSD files in SH5 are using for underwater (hydrophone) sounds. It appears they made a change to the game engine and hy2 is the new underwater identifier. No idea what happens if you use hyd.

Sorry, one more question:

according to your experience, is sounds volume, especially on hydrophone, somehow related to ship's current speed? Perhaphs through the ShipSound controller (StdByMaxRpm parameter)? If so, is there any way to set sounds free from this constrain?

If the sound's SoundSource identifier is Effect or hy2 it's free of this constraint. I've found that only sounds made through a controller (i.e. ShipSound) have this constraint.

gap
07-06-12, 04:53 PM
hy2 is what all the stock DSD files in SH5 are using for underwater (hydrophone) sounds. It appears they made a change to the game engine and hy2 is the new underwater identifier. No idea what happens if you use hyd.

It works too. Tested several times during these days. Also imported units contained in OHII do use this identifier and by the way with no exception they miss the SonarTarget controller, with no apparent problem.


If the sound's SoundSource identifier is Effect or hy2 it's free of this constraint. I've found that only sounds made through a controller (i.e. ShipSound) have this constraint.

So maybe I know what is happening: probably sh5 sound's volume can be modified only once. In other words, you can't apply a sound modifier on top of another one.
My sounds, not having the hy2/Effect identifier, are subject to the ShipSound controller. That's why SoundVolume behaves like a switch: everytime it tries to change the volume for the second time, sound aren't played at all. This is the theory. Now it has to be proved or controverted in practice.

Here comes my next question: what if I want to set two or more groups of sounds having different SoundVolume settings, since we have only the "Effect" option for non hydrophone identifiers? Is it possible that devs din't think about it? :hmm2:

TheDarkWraith
07-06-12, 04:58 PM
Here comes my next question: what if I want to set two or more groups of sounds having different SoundVolume settings, since we have only the "Effect" option for non hydrophone identifiers? Is it possible that devs din't think about it? :hmm2:

You create another type 4/100 node that has the parent of the original type 4/100 with 0 for position and rotation data. Now you set your next sound to this (it's ID). You keep adding type 4/100 nodes to the main 4/100 node for each sound you need a SoundVolume controller to work on :up:

structure would look like this:

main 4/100 node - SoundSource, AmbientVolume, SonarTarget
|
- child 4/100 node - SoundSource, AmbientVolume, SonarTarget
|
- child 4/100 node - SoundSource, AmbientVolume, SonarTarget
|
etc.

gap
07-06-12, 05:37 PM
You create another type 4/100 node that has the parent of the original type 4/100 with 0 for position and rotation data. Now you set your next sound to this (it's ID). You keep adding type 4/100 nodes to the main 4/100 node for each sound you need a SoundVolume controller to work on :up:

structure would look like this:

main 4/100 node - SoundSource, AmbientVolume, SonarTarget
|
- child 4/100 node - SoundSource, AmbientVolume, SonarTarget
|
- child 4/100 node - SoundSource, AmbientVolume, SonarTarget
|
etc.

Yep, I thought of this easy method just after pushing the "Submit Reply" button :oops:

As for hydrophone sounds, it seems we don't need to resort to the node structure you have depicted. I got several hydro-sounds linked to the very same parent node playing at once, by simply putting a SonarTarget controller after each SoundSource entry in DSD file. But, since they had different min and max radius set in sdl file, I had to sort them from the lowest (on top) to the loudest, otherwise only the loudest, the one having the highest maximum range set in sdl, was played.

P.S. as suggested by you, I've tried to switch to "Effect" the identifier of sounds whose volume I wanted to change. But something was wrong:

they started to be played in sonar room (where their volume was set to 0) while on external camera their audible range was greatly shortened (ignoring sdl ranges). On the other hand, external cam above water volume was set to .5, and this time the sound was audible, but I couldn't hear any differece with the underwater volume that was set to full (1). I am missing something, or for what I am trying to do the Effect identifier doesn't work either... :shifty:

TheDarkWraith
07-06-12, 05:48 PM
what exactly are you trying to do :06:

TheDarkWraith
07-06-12, 06:35 PM
Here are all the identifiers one can use:

DiveIn
ToSurface
WaveLap
ElectricEx
DieselEx
DieselUw
Propeller
TorpDoor1
Shipwake
DieselInsideSub
ElectricInsideSub
AmbientRadioRoom
AmbientKitchenRoom
RainLocal
hyd
DepthCranks
Sink
Engine
mix
ShipwakeBowSlow
ShipwakeBowFast
ShipwakeSternSlow
ShipwakeSternFast

gap
07-06-12, 06:50 PM
what exactly are you trying to do :06:

A bit complex to explain. I am trying to do some experiments with the whale whose conversion to SH5 was kindly granted by Jimbuna.

I got out simplifying by a strong measure its file structure. Originally the 3D model was contained in a dat file located in the library folder, and attached to the main unit's dat file as a dummy. It meant a double set of DAT, DSD and VAL, files. For sure there was a reason for doing it so, but for me it was quite difficult to track down the problem that made it to ctd on hydrophone station.

Now, the unit is working correctly (no more ctds, detectable on hydrophone, etc.), and I am giving it the final touches. As for sounds this is the plan:

work done

1) I've split the external song sound in 6 different was files sampling different wavelenght ranges, each with different min an max radius set in sdl, since (in real life and by a human ear) low frequencies should be heard from as far as 10 km or so, while high wavelenghts travel much lesser distances. I got out reproducing this effect in game, and I have to say that it is very nice. Besides this, I made the song sounds audible only underwater and, only the two lowest samples, inside the submarine. I wish to reduce a bit the volume of the sounds audible through the hull, but whenever I try, they "desappear".

2) The hydrophone song sound was split in 4 sub-sounds, following the same method as above, but with longer min and max ranges set in sdl file. As lon as I tested them, they worked like a charm. Obviously they are heard only on hydrophone, and at the maximum volume allowed by their ranges.

to do

3) a blowhole spout sound was added to the sdl file, and should be triggered by the corresponding particles. Should be audible only above water, on external camera.

4) taislapping and breaching sounds were also added to the sdl, and should be triggered by the corresponding particles, when the unit crosses given depths below or above the sea level. They should be audible both under and above water and, in lesser measure, inside the sub.

5) finally, a weak wake sound should loop while the whale is moving. This is the only sound tha should depend on unit's speed.

That's all :D

gap
07-06-12, 06:56 PM
Here are all the identifiers one can use:

DiveIn
ToSurface
WaveLap
ElectricEx
DieselEx
DieselUw
Propeller
TorpDoor1
Shipwake
DieselInsideSub
ElectricInsideSub
AmbientRadioRoom
AmbientKitchenRoom
RainLocal
hyd
DepthCranks
Sink
Engine
mix
ShipwakeBowSlow
ShipwakeBowFast
ShipwakeSternSlow
ShipwakeSternFast

Okay, thank you very much!
May I ask wich ones would you use for the sounds I described below?

TheDarkWraith
07-06-12, 07:17 PM
Okay, thank you very much!
May I ask wich ones would you use for the sounds I described below?

I would use Effect but it all depends on how the file is setup :hmmm:

gap
07-06-12, 07:43 PM
I would use Effect but it all depends on how the file is setup :hmmm:

I was testing your latest UI version :D

What do you mean by "how the file is set up"? :hmmm:

TheDarkWraith
07-06-12, 08:13 PM
I was testing your latest UI version :D

What do you mean by "how the file is set up"? :hmmm:

Is it a unit? If so, what type? I'd have to see the file(s) in order to make an educated guess. You'll figure it out :yep:

Everything working fine with the new version of my UIs mod? Able to get hydro follow target working?

gap
07-06-12, 08:29 PM
Is it a unit? If so, what type?

Yep, at the time being it is a ship, but if possible the next step should be converting it into a submarine. The first attemp to do it ended with a CTD before the test mission could end loading :doh: ...but this is another story!

I'd have to see the file(s) in order to make an educated guess. You'll figure it out :yep:

I don't want to abuse your patience, but if you want I can upload somewhere the files of the last working version, and provide you with the link :)


Everything working fine with the new version of my UIs mod? Able to get hydro follow target working?

Yes sir, just finished the last test. I'll post a report in the appropriate thread :up:

Trevally.
07-07-12, 03:13 AM
This is sounding really good Gap - looking forward to seeing and hearing it:yeah:

gap
07-07-12, 11:12 AM
This is sounding really good Gap - looking forward to seeing and hearing it:yeah:

Thank you mate,

yes it sounds (sic!) good, and it can get better with your help!

My goal is achievng a template, as complex as it is allowed by SH5 limits, for creating new similar environmental units.

The web is full of royalty free 3d models. We should "only" create the animations, import them in the existing dat, remove some controllers when unneeded, finetune the remaining ones, create new sounds and textures if requested, remap IDs, carry on a few more tasks that I can't think of right now, and tadah, the new unit would be ready... :know:

Animations apart, I think the rest of the process is not that complex, provided that we can start from a good template, and thanks to TDW, with a few adjustements one day we will be able to convert these units in GR2 format.

The same goes for naval units. They are much more complex than environmental units, but with the great work done by TDW, Rongel, Uekel, SteelViking and many more, I think that most of the secrets for importing existing dat ships, or even for creating new ones, today are no more a mistery.

The next challenge will be converting them too in GR2 format. Probably we will encounter many drawbacks, but as said by TDW in another thread, this goal is certainly attainable, especially -I believe- if we will manage once more to work as a team and to share information.

Another big challenge will be creating/importing AI and human playable submarine units. AFAIK, only Privateer managed to do it for SH5. There are some pictures and videos (http://www.subsim.com/radioroom/showthread.php?t=170937) of his imported submarine on this forum, but I never managed to find the respective download.

The idea to convert the whale into a submarine unit, is also dictated by my desire to understand the essential parts of those units, in therms of SH5 file structure and controllers. Infact this sub-whale should be an extremely stripped-down version of a "true" SH submarine, carrying just the vital stuff on her.


Finally, why am I writing such a long post, besides being affected by a chronic long-windedness? :D

I am sure you are aware of the few and modest ideas contained in this post. If there were many persons working on adding stuff to the game (new units, new fixes, new features, etc), my words could be dismissed as pleonastic. Too bad, things are not so :-?

Really, my first and ambitious goal is to cast again some interest on the great work started one year ago or so. I can rember, after the first discoveries on how to import dat units, someone was forecasting that dozens of people would have put themselves at job on this matter.

After the first wave of enthousiasm, off the first group of "ship importers" afaik only Uekel is still active in this sector. Worse, no new names have emerged in the meanwhile, and the ship importing thread (http://www.subsim.com/radioroom/showthread.php?t=182667) is totally deserted.

Right now, there is much expectation on this neat piece of coding by TDW: the GR2 reader/importer. I strongly hope that the same story is not going to repeat with it: many people wishing, (very) few people doing.

Don't take me wrong: I understand that people got their own lives and their day by day duties. I respect this fact and I am not complainig on anyone in particular, for that matter. On the other hand there are high hopes on the future of this game; though I feel that the real draw-back to its further development, even worse than its initial buggy state, is the lack of active modders in this community.

Even after several years spent playing SHIII, IV and 5, many say that they would start modding the game, if they didn't miss the needed skills. But skill is something you develop with your time, if you want.

I, for one, started hanging around this community only 18 months ago. I didn't know anything at that time, since I was approaching SH5 for the first time. Moreover I had never played/modded any other game of the series. Nevertheless, by reading this forum and through direct experience, little by little I started learning the basic architecture of this game, and far from having a complete picture, I am still doing it.

Anyone can do the same, by giving up some of the time spent playing the game in favour of reading on it, and creating his first simple mods to share with the community. Doing it, some people ended by stopping playing, for focusing primarily on modding activities. This approach can reward us as much as playing the game itself, in therms of personal satisfaction and general aknowledgement, but surely noone is requested to be so drastic.

Let's be honest. In the last say... 12 months, most of the mods released for SH5 were created by a fistful of persons. More or less half of them, I think, were by TDW... Come on guys, we can't leave these people alone. Without our help their efforts will be in vain, and very soon this game will start dying in a long agony :yep:

Trevally.
07-07-12, 12:19 PM
There have been so many ships imported to SH5 now the list is too big to list:O:

The next big stage for SH5 is converting these into nice shiny GR2 ships.
Yes they could but it'll take a little work. You would need the test version that the testers are currently using for one. Two, you would take an existing ship GR2 file and merely import new vertex data into it for all the meshes (thus replacing the existing vertex data). Three, you would have to change all the existing materials used to reflect the materials of the new unit. Four, you would need to add new bones as needed (which is a snap to do with the app). It's not as hard as it sounds :)

Starting a thread where this could be discussed would, I am sure see many modders joining in and new ones starting. A guide could then be written with all the info gained. (Im sure TDW would love to see more people using his new tool after all the effort that went into making it).:hmmm:

TheDarkWraith
07-07-12, 12:22 PM
(Im sure TDW would love to see more people using his new tool after all the effort that went into making it)

Would be nice but not needed :yep: The app isn't finished yet, still chugging along on it. Making that tool made me a better a programmer and in the end that's what it's all about. If you don't try and better yourself everyday you are wasting your life away :)

Trevally.
07-07-12, 01:33 PM
Would be nice but not needed :yep: The app isn't finished yet, still chugging along on it. Making that tool made me a better a programmer and in the end that's what it's all about. If you don't try and better yourself everyday you are wasting your life away :)

:up:

If it is still not finished - perhaps you could also plan into it a "click here" button to convert dat ships to gr2:D

gap
07-07-12, 01:50 PM
:up:

If it is still not finished - perhaps you could also plan into it a "click here" button to convert dat ships to gr2:D

Good idea!
programmers tend to make things more complicated than they are in reality! :haha:

Trevally.
07-07-12, 03:01 PM
http://img707.imageshack.us/img707/2933/sh5img20120707204624.png

"Towards thee I roll, thou all-destroying but unconquering whale; to the last I grapple with thee; from hell’s heart I stab at thee; for hate’s sake I spit my last breath at thee. Sink all coffins and all hearses to one common pool! and since neither can be mine, let me then tow to pieces, while still chasing thee, though tied to thee, thou damned whale! Thus, I give up the spear!"

http://img861.imageshack.us/img861/8331/sh5img20120707204519.png

gap
07-08-12, 10:26 AM
"Towards thee I roll, thou all-destroying but unconquering whale; to the last I grapple with thee; from hell’s heart I stab at thee; for hate’s sake I spit my last breath at thee. Sink all coffins and all hearses to one common pool! and since neither can be mine, let me then tow to pieces, while still chasing thee, though tied to thee, thou damned whale! Thus, I give up the spear!"

Thank you Trevally!
nice screenshots and neat quotation :sunny:

wasn't Moby Dick a sperm whale? I should have a 3D model of it hanging somewhere on my HD :)

Madox58
07-08-12, 04:29 PM
Nice gap,
:salute:

I could have helped you alot on the whale conversion had I known that's what you were working on.
:yep:

I was there when ref created it so could have pointed you to any detail you needed about it.
:)

But the learning is most of the fun anyway.
:yeah:

gap
07-08-12, 04:41 PM
Nice gap,
:salute:

I could have helped you alot on the whale conversion had I known that's what you were working on.
:yep:

I was there when ref created it so could have pointed you to any detail you needed about it.
:)

But the learning is most of the fun anyway.
:yeah:

Thank you Privateer!

In general I try doing stuff by myself before disturbing other people and asking for their help.
Nevertheless you can still provide a valuable support, since there is a lot that I've to learn yet, and a lot to do before this whale import could be considered ready :up:

Madox58
07-08-12, 04:46 PM
PM with any help you need at anytime Mate.
:yep:

Never to busy to try to answer questions.
To busy to get anything done? Yes.
But never to busy to answer questions.
:haha:

gap
07-08-12, 05:25 PM
PM with any help you need at anytime Mate.
:yep:

Never to busy to try to answer questions.
To busy to get anything done? Yes.
But never to busy to answer questions.
:haha:

Thank you sir! :salute:
A PM is flying to your home :D

gap
07-09-12, 03:36 PM
I am a bit stuck with particle-triggered sounds... :-?
Here's what I did so far:

1) I extracted an audioclip from footage available on the web, and saved it as wav file. Since I wanted it to be a 3d sound, I made sure to choose a mono format:

http://img137.imageshack.us/img137/5130/quicktime.jpg


2) I moved my wav file into the data\sound folder, and created in sh.sdl a new entry pointing to it. Settings as below:

http://img338.imageshack.us/img338/3757/sdlf.jpg


3) I then added a SoundSource controller into the unit's dsd file, making reference to the sound. Chose "Effect" as sound identifier:

http://img811.imageshack.us/img811/3001/soundsource.jpg


4) Finally, I set the FastParticleGenerator in val file that I wanted to be triggering the new sound as parent id of the respective SoundSource:

http://img822.imageshack.us/img822/8984/33024575.jpg


5) The tail splash particle generator is set to be triggered when model's height is between ±10 cm:

http://img546.imageshack.us/img546/7974/heighcontrol.jpg

The correct functioning of the FastGenHeightControl can be ascertained in game. I would expect the new sound to follow the same behaviour as the slpash particles, but during my tests in game I couldn't hear any splash sound. :nope:

Switching SoundSource's parent id to particle generator's parent id in val file (the node called "Splash_right") or to the omonymus node in unit's dat file (the one locating the fx within 3d model), didn't work either.

I've also tried to uncheck the Play property into sh.sdl, but with not apparent result.

The only way to hear the sound is game, is setting tle Loop property (also in sh.sdl) to true, when Play is checked too. As you can easily imagine this gives a continuous splash sound that is not the result I was looking for... :shifty:

Any ideas from the community? I depend on you, guys! :D