How to play sound - Where to save file

In my game, I want to play a sound when the player touches an object. I added a ‘play sound’ node but as there is no ‘open’ button and instead a drop down, I presume I need to put the sound file in a certain folder so that it will show up in the drop down list? Thanks for any help

P.s. I am aware of the play speaker option but want this sound to play multiple times and would rather duplicate a node then make lots of new speakers in different places

There may be a better way, but this should work:

  • In Blender hit space and type ‘Open Sound’, then simply select the file
  • In outliner, switch to Data-Blocks - Sounds, and enable Fake User, to keep the sound file alive
    Capture
  • Play Sound node will now let you select the sound

Final step:
I have pushed a patch which auto-includes sounds with fake user, so if you use Armory Updater there is nothing to do. If you are on stable, then copy the sound to blend_root/Bundled folder first.

Hi, the armory updater isn’t working for me and just results in armory failing to build at the moment. I did all the steps but for the last one I cant find the folder to add the sounds too. Some of my files have Bundled folders but the game does not, do i make a folder? BTW, currently the game freezes and doesn’t respond when it should play a sound

Thanks

Do you get any error during update? Does reverting to stable make it work again? And what is the error when you try to build the project?

I guess the game freezes because the sound file is not there. Yes, just create a folder alongside the .blend file.

There is no error during updating, when I try to build the project in the updated SDK I get the error that it was unable to bind material to vertex data, it also says that more than 4 bones affected a single vertex and so it took the highest weights. I also get the errors: G:\College\Media\Armory\armsdk\iron\Sources/iron/object/Uniforms.hx:742: characters 41-43 : kha.arrays.Float32Array should be haxe.ds.Vector<kha.FastFloat>
G:\College\Media\Armory\armsdk\iron\Sources/iron/object/Uniforms.hx:742: characters 41-43 : For function argument ‘floats’
G:\College\Media\Armory\armsdk\iron\Sources/iron/system/Input.hx:238: characters 2-5 : Type not found : kha.input.Pen

just before it says build failed.

Before when I presses restore sdk the game would build with the only thing not working being the sound but now when I have pressed it, it no longer knows the play sound node where you specify the file but instead asks for an object similar to play speaker. Did it go back to a much to earlier version?

Hm, did you get armory 0.3 from itch? The kha.arrays.Float32Array should be haxe.ds.Vector<kha.FastFloat> error would indicate you are running 0.2 as a base, otherwise not sure what is going on.

Hi again, I downloaded a fresh copy of version 0.3 and ran the updater which worked fine. I then opened my file and attempted to build, it failed. The errors were failure to bind to vertex which I got rid of my turning on interleaved buffers as well as an error of duplicates of the sound files as I had the bundled folder which was not necessary due to the update. I finally had Haxe errors which I found to be the fault of a bad attempt by me to change the first person controller script which whilst previously working no longer does and so I replaced it with the normal copy.

The game now builds fine and allows me to play but the game still freezes whenever a sound should be played. All the sounds are entered + made a fake user and so I do not understand the issue. After some debugging I have found that it is normally when a sound should be played and disconnecting the sound node often stops it freezing during that collision but there are occasions when a collision which shouldn’t play a sound still freezes.

Thanks

Ah… this is embarrassing…
I should have thought of it sooner but it suddenly occurred to me that certain file types may not be supported yet, upon going pack and looking at your initial instructions I see you were using a .WAV file whilst I was using .MP4.

Good news is that now by using .WAV it works great!

Sorry for the time wasting and thanks again

However, I do have an issue of the sounds only playing for about 2 seconds. For example I have a ticking clock start playing but only the first couple seconds are played before it stops? reason for that?