How to make music start at begin, then stop at trigger?

I’ve been trying to make this ambience play at the beginning, and then when you hit this trigger, it stops. I’ve been using this method but it hasn’t been working. Every time I play it, I get errors once I’m done saying things like, “Error Accessed None ‘Ambience’ from node Set Sound in graph ‘EventGraph’ in blueprint ThirdPersonExampleMap”
I’d really like help and I’ve been spending maybe an hour on this problem.

Seeing your blueprint(s) would help greatly! Access None errors generally mean that variables you are using (in this case Ambiance which you have plugged into the ‘Set Sound’ node in the Event Graph of your ThirdPersonExampleMap) is not properly instantiated.

Creating a variable and declaring it’s type as your particular sound does not mean that it has access to that sound (even though you can use it’s values when pulling off the pin.)

a declaration specifies properties of an identifier: it declares what a word (identifier) means.

You must put a “live” object into a variable to make it valid. It appears, from what little information you provide, that you simply created a variable, declared it as your sound file then are trying to run it. What you should do, if using the ‘Create Variable’ route, is to ‘Set’ your variable to the sound file in the Begin Play node. However, what you see in the link you provided is an ‘Audio Component’ which is different than creating a variable. To use an audio component, in the component list of your Blueprint, add the Audio Component and name it what you want (Ambiance for example.) Then in the Default Settings of that component you can Set the sound file of that component. The component should show up in the list under your variables in the category ‘Components’. You can drag this into your event graph as a ‘Get’ and use it to Play/Stop your sounds properly (because you ‘Set’ the component file in the defaults area for that component.)

Hope this help! If it does, please do me a favor and accept the answer by clicking the check mark next to the answer. You’ll know you got it right when the answer (and it’s comments) turn green! Note that if a comment is made after you accept an answer it automatically unaccepts the answer! Thanks! Let me know if you have any other questions.

Jesse

First of all, my blueprint is similar to this:

Second, it isn’t working… I see the Default Value when I click on it, but it doesn’t allow me to place in the WAV file. I’ve tried quite a few times.

Ok, well “similar” isn’t exact. I have a 40+ video series on creating an RTS game and even though I spell everything out in each video, people still insist that “I did exactly like you did!” yet often times when I walk through it with them, they realize they forgot something. So “similar” can end up being vastly different.

With that said, try creating a Sound Cue using your WAV file and try using that instead. Also, ensure that your file follows these standards: Audio Files | Unreal Engine Documentation

While you can use a straight WAV file in an audio component, if it’s not to UE4 specs, the system won’t recognize it. See if a sound cue works instead, if not you may need a different/better WAV file.

When I say similar, I mean the same only with my sound file.
Also, in the Default Value area, nothing appears there. There isn’t the sample content noises either. And one more thing, how do you change a WAV into a sound cue?

You don’t really ‘change’ it into a sound cue, it’s a separate file. Right-click your WAV file in the editor and at the top is the option to make a sound cue from the audio file.

As far as not seeing anything in the list is rather odd. I would still suggest finding another test file (or creating one) that fits the UE4 specs in their docs (link posted above) and try again with that. If the new properly encoded file still doesn’t work then perhaps file a Bug Report but seeing as I just was able to do it fine in my editor (v 4.10.2) I don’t think it’s an editor bug.

I’m using v 4.10.4 I believe. Not completely sure. I do see the list, but I don’t see any files in it, including the starter content files.

Shouldn’t be a difference in this from 4.10.2 - 4.10.4…

I don’t understand what you mean by you “see the list, but don’t see any files in it”? A ‘list’ would indicate items are contained within, like a ‘Shopping List’ or a music ‘Play List’.

Take a look at this image. It shows the 2 test audio files I have… Well 1 audio file and a sound cue made from that audio file.

Well, I’ve tried it multiple times and it still isn’t working. I’ve checked if the file is compatible, and it is. I made it a sound cue, but it still isn’t on the list. I tried changing in in Audacity again, but it still doesn’t work. I have no idea why…

Hello? Please help if you can!