HeroEngine Forums

HeroEngine Support => General Discussion => Topic started by: Mith-Garth on Apr 01, 18, 02:33:01 AM

Title: Fmod and Audio
Post by: Mith-Garth on Apr 01, 18, 02:33:01 AM
I have been trying to get Audio into project off and on for a couple weeks with no luck. My first question
is which version works with Hero right now? I downloaded a older version of Fmod Studio that i found worked with hero from a three year old post.   However when i 'Build" I only get .bank files not the files shown in the wiki i have read. http://hewiki.heroengine.com/wiki/Audio_tools, I get no .Fev or .fsb files. It also just has a empty properties panel with no selections for the things that the Wiki's say it should have.

I would like to get sound started as i will be investing a lot into recording equipment and buying sounds and music later this year.I am looking at spending about 5k or so on Ambient music and sounds that i have found from various composers and sound effect makers. Also much more on our own set up to record plus paying some local music/composer artist to do some things for me.

It would also be great to add some Ambient sounds now wile building areas to save time later and to help with missing some of those key little ambient sounds that may get forgotten as i move into the next stages of building. Also it would help with making some videos later this year or next year.As i plan to have a very detailed website about the building of my projects which will also discuss and show Hero engine some.  I tried using a .wav direct and it work's when first loaded but won't work again. However i understand Fmod is the way for all the Audio. I just need any advice and pointers on which version to use and what we need to do for it to work with Hero. I need to get it all figured out so hopefully later when we have a massive sound library to set up i can train one of my Minions and let them deal with it. 
Title: Re: Fmod and Audio
Post by: FI-ScottZ on Apr 01, 18, 11:49:42 AM
Yeah, that wiki page is a bit out of date. You'll notice it mentions downloading "FMOD Designer".  That is the older tool, which does produce fev and fsb files.  FMOD Studio produces only bank files and a "strings.bank" file. The version of Studio I used was 1.05.14. 

For Studio, you would create sound banks for your files, categorized however you wanted. I never put sounds in the master bank, and am not sure if that works.  I just created other banks such as "UI" or "TutorialGeneral", and then created the appropriate sound events and assigned them to those banks.  Once the project was built, I used the repo browser to upload the following files all to the same folder (I just used the "Audio" folder):
Master Bank.bank
Master Bank.strings.bank

Attached are some reference pics.  You can see I created the UI and TutorialGeneral banks. Since I plan to have other tutorial banks I created a folder for them, with only one in it now.  On the Events tab, I also grouped events for the sake of organization. The organization of Events is independent of the structure used for the banks, but it is important to note how the events are organized when referencing them in-game.  Then I assigned the events to the appropriate bank (you can select more than one at-a-time to assign them en masse). The fourth and fifth pics are a bonus showing the Mixer window and how I created sound Busses, e.g. Voiceovers, and assigned some events to them. I think these busses are the equivalent to "Categories" used in FMOD Designer, but I have not yet gotten them to work in-game.

Then to use them in-game, I reference the specific bank file, such as TutorialGeneral.bank using the full file path (Audio/TutorialGeneral.bank), and also the Event Path within that file which I want to play.  For FMOD Studio bank files, the event path string must have a format like this:


It will not work without "event:/" at the start. If the event is organized into folders, like I did in pic #2, it would be something like this:


AND they must be FORWARD slashes.  I just determined that from experimentation. That format does not apply if using Designer-created fev files. For them it would be just "Tutorials/General/LINE02".

Finally, to actually play them, there are a few options:

You could create a sound node in an Edit instance of an area (Create-->Audio-->Load Audio, then Create-->Audio) and set its Event Path via Properties Panel. You will also need to set the _audioPitch property to 1 for it to play properly. That approach would be for some permanent sound of an area, maybe to have some background music playing as soon as a player enters it, or to locate sounds of torches or birds nearby where their models are. Whether a sound plays as a postioned 3D sound, or a non-positioned 2D sound has to do with the settings of that event in the FMOD tool.

For dynamic playing of sound, you would use either the FX system, or call manually to the $SOUND system node (client-side), or some custom solution of your own.  Studying the SoundClassMethods script can give you an idea of how it works: it uses the Prop Bucket (http://hewiki.heroengine.com/wiki/Prop_buckets) system to create an HBNode that only exists on that client, so only the local client would hear that sound.

The catch is that the Sound system node code is incomplete. You can see it never specifies the Event Path, so it does not work as-is for FMOD sounds. In fact, the only place in the standard code that the "EventPath" field is ever set is in the FX system file _FX3DSoundFMODClassMethods.  In SoundClassMethods function SetNewSoundSettings() it sets things like Volume and others. That is where it should also be setting the EventPath. So you could either edit that file or create an override of much of that file's code in a script glommed onto the $SOUND system node, which is what we did.

I won't get into the particulars of what we did as we ended up with a pretty serious overhaul, but basically when calling the method you need to specify the event path along with the file resource, and then use that to set the "EventPath" field on the HBNode.

Using the FX system might be easier in the short term.

Title: Re: Fmod and Audio
Post by: Mith-Garth on Apr 01, 18, 06:11:32 PM
Thank's for your great reply. It sure is a pain just to get some simple sounds to work lol.

I also have  1.05.14 studio downloaded.  This will help me get closer to some of it working.
At this point i am not working on code much as i am doing art and world building first.

However later down the time line i plan to hire a few coders on per work contracts.I'll let
them decide how we want to do sound's in scripts and things that need to play sounds.

My goal right now is getting the .bank files set up right when we invest into our sounds later this year.

Plus getting some Ambient sounds working. I'll print off your information and when i take another rest from making art will look into sounds again. The last game engine i worked in just used simple sound files .wav .mp3 etc and just had to use a "Play sound" line in scripts/code.
Title: Re: Fmod and Audio
Post by: FI-ScottZ on Apr 04, 18, 01:06:11 PM
OK, then. The nice thing about using Studio is that it has a lot of bells and whistles.  I and some others went through the manual available from the Help menu and it is pretty easy to learn.
Title: Re: Fmod and Audio
Post by: Mith-Garth on Apr 04, 18, 02:17:11 PM
Yeah i like the studio and the way it work's just have to figure things out with hero on audio.  Your information will help out for sure.

So i am trying to use the simple create Audio to get some Ambient sounds in. However the only options
it gives me is Create-Audio-Load audio. With that it will only allow me load in a .wav type audio file. Which when
setting pitch to 1 will play one time then breaks after that. It won't allow me to change the path or events in properties panel. This is what i have been going round and round with for a bit now lol.

When you say create audio do you mean to select a file or is that another option that i am missing?

Title: Re: Fmod and Audio
Post by: FI-ScottZ on Apr 04, 18, 11:30:35 PM
When you select "Load Audio", does the selection dialog allow you to change the file type it will load?  I haven't messes around with using wav files directly, though if you are indeed loading those then that would explain the lack of even path selection; that would only apply when using FMOD sound files.

Once you have loaded an audio file, you would go again to the "Create --> Audio" menu and you should see the file name that you loaded listed in the popup menu, below the option to "Load Audio". Select the file name to create a node using that sound file.
Title: Re: Fmod and Audio
Post by: Mith-Garth on Apr 05, 18, 12:46:22 AM
The .wav was just testing. I try to load the .bank files. It sees them but i get a error.
From what i understand the .bank is all we add into hero right?  I understand our sounds are in the .banks.
I have Testbank.bank set up with one sound in it called test ambient. This is what has stumped me for a few weeks now.

Edit: AddAsset was called with an invalid fileExtension on the FQN(\world\livecontent\audio\testbank.bank), expected a period followed by three characters.

It won't allow me to create a audio cone with out choosing a .wav sound file. However the .wav i can't edit path or do anything to change out the path or event.  I know hero won't work with direct loaded sounds. So the .wav will play once or loop. However will not work again with out messing with it. Which is fine as i am not trying to get .wav directly to work. Just trying to get a simple audio asset to work and learn to path it to a .bank.

Title: Re: Fmod and Audio
Post by: FI-ScottZ on Apr 08, 18, 12:33:40 PM
I am not sure, but I believe you also need to have the "Master Bank.bank" and "Master Bank.strings.bank" files uploaded. in the same location You could try that.
Title: Re: Fmod and Audio
Post by: Mith-Garth on Apr 09, 18, 07:36:10 PM
Yeah i have all banks in the same folder plus tried to create a audio cone by clicking on any of the banks.
It seem's the create audio is only looking to load a .wav or .mp3,  I may just have to wait until we start to code and do all our sounds that way. Would be nice to have a simple way to add some Ambient audio though.