• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Christian Bahr

Resource contributor
Messages
993
Country
germany
Hi all!

Does anyone know how to attach a sound file to a SimObject with simple means?

I would like to equip one of the Bahrometrix Unliving Horror People with a suitable means of communication, a "moaning sound":

msfs_bahrometrix_horror_people.jpg


But I have no idea how to do it. The SDK says something about the fact that the SimObject folder must be a sound directory and there must be an XML file and the sound file, that's all I know.

Maybe someone has some advice, any help is welcome :)
 
Christian: as far as I know it can't be done directly from an XML file. You will need something like Doug Dawson's sound gauge which provides an interface between XML and a C library, with C doing the actual sound calls. Your zombie will need a full simobject folder structure which includes the \sound folder - see any of the existing default simobjects. The sound library is completely external to the sim, so it should work with MSFS correctly.

OTOH, I know nothing about creating stuff for MSFS and currently refuse to go anywhere near it, so someone who is familiar with it may have different ideas.
 
Hi and thanks DragonflightDesign :)

I had rather thought of something that the sound is played depending on whether the SimObject is moving. In the documentation of the SDK you can read again and again that you can play sounds via Audiokinetic Wwise under special conditions, that was too complicated for me, hence my question about a simple procedure.

I still know Doug Dawson's Sound Gauges very well from the P3D and the Chevrolet Suburban project. They were and are a great help and enrichment 👍

I will take your advice and see to what extent the default Simobjects can contribute something to the solution :wizard:
 
Hi and thanks DragonflightDesign :)

I had rather thought of something that the sound is played depending on whether the SimObject is moving. In the documentation of the SDK you can read again and again that you can play sounds via Audiokinetic Wwise under special conditions, that was too complicated for me, hence my question about a simple procedure.

I still know Doug Dawson's Sound Gauges very well from the P3D and the Chevrolet Suburban project. They were and are a great help and enrichment 👍

I will take your advice and see to what extent the default Simobjects can contribute something to the solution :wizard:
Hi!
In MSFS, any sound can be attached to any object via sound.xml + any fixture or model variables. In order to play custom sounds, you will need to create a bank of these sounds and pack them using Audiokinetic Wwise. You can download several video tutorials on creating sounds for the SDK, everything is described in detail there.
 
Here's a couple more clues - you certainly don't need a 3rd-party C addon...

Firstly there's a question of how you're going to trigger your sound - e.g. you can use a conditional code block in the model XML (see below). If you have animations in your model it would be just as easy to include the sound-triggering code in the <Code> block of the animation.

In model/<your simobject>.xml you need an 'update' section that toggles a variable (in this case L:TRIGGER_MY_SOUND) when you want the sound to play.

Also you need ANOTHER variable that ensures (in your case) the sound only plays once - I've used L:DISABLE_MY_SOUND which is set after the sound plays the first time, (it will initially start as "0"). There may be another template or template-code-parameter specifically designed to execute once on startup but with this generic Asobo_GT_Update you have the flexibility to have any update code you want (it will be called on every update cycle of the sim). The comments I added after "----" will need removing or would cause an XML error.

Code:
<Behaviours>
    <Include Path="Asobo\Common.xml"/>

    <Component ID="make_my_sound">
        <UseTemplate Name="Asobo_GT_Update" >
            <UPDATE_CODE>
                { ANY CONDITION YOU HAVE HERE INCLUDING CHECK (L:DISABLE_MY_SOUND) == 0 } if{
                          (L:TRIGGER_MY_SOUND) ! (&gt;L:TRIGGER_MY_SOUND)    ---- here we are toggling a variable that will be used by the 'sound.xml' config.
                          1 (&gt;L:DISABLE_MY_SOUND)                         ---- here we set a variable to stop the sound being triggered again.
                }
            </UPDATE_CODE>
        </UseTemplate>

    </Component>
</Behaviours>

Then in your sound/sound.xml file you include an entry that 'plays a sound anytime a variable changes' (see reference to "SOUND_CLICK" which is L: var from above, e.g.

Code:
  <SimVarSounds>
      <Sound WwiseData="true" WwiseEvent="button_switch_generic" ViewPoint="Inside" NodeName="LED_switch" LocalVar="SOUND_CLICK" Continuous="false" BreakOnStop="true">
      </Sound>
  </SimVarSounds>

This example plays a sound from a WWise SoundBank, so I haven't fully answered your question - you need a similar "WwiseData="false" sound stanza that plays a 'legacy' wav file - I know that is doable but don't have an example in my project
 
Thanks to everyone here with their useful tips!

@B21-soaring
Thank you for your very detailed information. I have to fight my way through it now, but it seems to be exactly what I'm looking for. It will take some time, but I'll get back to you. Thank you again:)
 
Had found some time and dealt with the example. I don't really understand the structure of the code, because it differs greatly from the format that I normally use for my SimObjects. In addition, I would not like to fall back on legacy techniques and instead use the new and advanced Wwise technique. At this point in time, the zombie has to get by without sound, as adding a sound file seems too complicated to me.

I appreciate your explanations very much, I may come back to them later.


Zombie SimObject Code
Code:
<Component ID="Personen" Node="zombie">
<Visibility>
<Parameter>
<Code>(E:LOCAL TIME, Seconds) 18000 &gt;= (E:LOCAL TIME, Seconds) 86400 &lt;= and (A:AMBIENT PRECIP STATE, mask) 3.0 &lt; and if{ 1 } els{ 0 }</Code>
</Parameter>
</Visibility>
</Component>
 
Not sure if i should post here, i didnt find anything else. I can create my own topic if wanted ^^

Does the way talked about here differ from a simple sound file, like an ambience file, played nonstop on an airfield? Ive searched in the sdk but i also dont really want to go wwise route for something this simple.

No conditions, it should simply play nonstop on an airfield.
 
You are right here with your concern. However, I cannot contribute anything to the solution, because I have been concerned with other things up to now. I would be very happy if we could help clarify something here :)
 
If you code in JavaScript like Asobo/Microsoft push you to do, there may be another possibility that I used in JavaScript for web pages: the use of the JavaScript sound functions.
If it works, it means you don't have to use Wwise for this. The way it works is quite simple, you just have to create a sound object and call the play function on it, something like:

let mySound = new Audio("MySoundFile.wav");
mySound.play();

I didn't test it in MSFS yet, I can't tell if it works or not.

Eric
 
You are right here with your concern. However, I cannot contribute anything to the solution, because I have been concerned with other things up to now. I would be very happy if we could help clarify something here :)

No worries, should i ever find it out i will drop it here :)

If you code in JavaScript like Asobo/Microsoft push you to do, there may be another possibility that I used in JavaScript for web pages: the use of the JavaScript sound functions.
If it works, it means you don't have to use Wwise for this. The way it works is quite simple, you just have to create a sound object and call the play function on it, something like:



I didn't test it in MSFS yet, I can't tell if it works or not.

Eric

Thank you. Would be nice, i know JS but the question would be where this script has to be placed? I wonder what one has to use as entry for this. In the XML, like this? In which one :)


JavaScript:
<xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml"
 src="file.js"
 type="application/javascript"/>
 
I have tested the solution I proposed above and... it doesn't work. It generates a DOM exception, this operation is not supported in MSFS. In other words, we have to use Wwise, no choice.
 
Im not even sure if this is working with scenery. You may have luck with airplanes but ive looked around now for a while, there are 0 examples for anything other than an airplane. Also the doc only talks about the usage in airplanes. No word about anything else.
 
Can it be that Wwise is a standard in game design and that you only have to search the net for tutorials? Maybe the focus on the MSFS SDK isn't all that effective. Perhaps other computer games such as Call of Duty, Skyrim (to name just a few) also use this presumed standard!?
 
To answer my question above about Wwise as the standard in game design itself: Yes, Wwise is the standard when mapping sounds in games. In the post linked by Sasa (Wwise simple setup explained?) there is a link to a tutorial (thanks to hannahs0lo) :)

I took this as an opportunity to register with Audiokinetic and downloaded and installed the current Wwise version. It all worked very well and was also very easy. Then, out of sheer curiosity, I immediately loaded the "WwiseSampleProject" from the MSFS SDK:

msfs_sdk_wwise_sample_audiokentic_wwise.jpg


Here I am now, looking forward to entering a completely new field 😀:wizard:
 
Two bookmarks added to my Firebox ! and with this post: three !!
 
Back
Top