x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to set up an Integer for a Sound Cue Switch Node?

Hi, I'm trying to set up a Sound Cue with a Switch node that is driven by an integer value from the My Character Blueprint.

I'm trying to set up a system that plays footstep sounds based on the type of surface my character is on. The sounds are triggered from Animation notifies (on the walk and run animations).

How can I use an integer to control the Switch node in a Sound Cue?

Thank you!

alt text

Product Version: Not Selected
Tags:
audiocueswitch.jpg (197.2 kB)
more ▼

asked Apr 27 '14 at 08:41 PM in Using UE4

avatar image

Daphnis26
277 23 26 36

avatar image ewitti Dec 17 '15 at 06:30 AM

I've grappled with this for ten minutes myself so I just wanted to add: If you use the soundcue's Switch node be sure that the blueprint that's playing the sound sets the Switch node's Int param to something - its default value is not 0 as you would normally expect from an Int variable.

Example:

I have a soundcue that consists of a starting track and a looping body.

alt text

alt text

When my game starts I first assign the soundcue to the audiocomponent that will play it, and then I set the Int param to zero. If you do not set the Int param to zero (or any output pin you want) the sound will not play. I then use a delay node to determine when to switch to the looping part of the soundcue.

Hope this helps others in the future.

screencaps.png (104.7 kB)
screencaps2.png (116.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

I do it like that: If someone needs it :) alt text

clipboard-3.jpg (39.8 kB)
more ▼

answered Oct 19 '16 at 09:02 PM

avatar image

Taratus
67 13 18 26

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered Apr 27 '14 at 08:51 PM

avatar image

Shadowriver
37.2k 936 172 1116

avatar image Daphnis26 Apr 27 '14 at 08:52 PM

Thanks, how could I set this up in a blueprint?

audiocomponent.jpg (39.4 kB)
avatar image Shadowriver Apr 27 '14 at 11:34 PM

You forgot to set sound

avatar image Daphnis26 Apr 27 '14 at 11:50 PM

I'm sorry but I don't understand. What do you mean I forgot to add sounds in the audio component?

avatar image Shadowriver Apr 27 '14 at 11:51 PM

Audio Component it self is useless, you ned to set sound in it and play that sound in it :)

avatar image Daphnis26 Apr 27 '14 at 11:57 PM

I think I see what you're getting at. Could you please show me what you mean? Just for context, I have the sounds set up in the footsteps sound cue because that cue is being triggered by event notify's by the walk and run animations. Here's my audio component properties, am I doing something wrong? alt text

audiocomponent.jpg (110.4 kB)
avatar image Daphnis26 Apr 28 '14 at 12:00 AM

Are you asking me to add sounds to play in the graph? Wouldn't that defeat the purpose of triggering sounds from my animation?

avatar image Shadowriver Apr 28 '14 at 12:02 AM

Ok it seems got sound set :> Do you play sound from Component with play function?

avatar image Daphnis26 Apr 28 '14 at 12:07 AM

Sorry, perhaps I wasn't very clear about my end goal. Currently I have notify's set up in my animations to play the footstep sound cue. I've added the switch in the sound cue and would like to control the integer required for the switch from my character blueprint. How can I do this?

avatar image Shadowriver Apr 28 '14 at 12:16 AM

Then make your animation play sound in audio component, as audio component seems to be only way to set those parameters

avatar image Daphnis26 Apr 28 '14 at 12:23 AM

Ahh ok I'll look into this. I'm confused though because according to the documentation the Switch node in an audio cue is driven by an integer. Is there no way to get an integer to control the switch node?

avatar image Daphnis26 Apr 28 '14 at 12:24 AM
avatar image Shadowriver Apr 28 '14 at 12:28 AM

You need to set that parameter each time the ground changes

avatar image Daphnis26 Apr 28 '14 at 12:58 AM

Yes, but how do I set the parameter? Could you please show me an example?

avatar image Shadowriver Apr 28 '14 at 01:00 AM

......with Set Int Parameter? you already doing that

avatar image Daphnis26 Apr 28 '14 at 01:14 AM

It doesn't work.

avatar image Shadowriver Apr 28 '14 at 01:19 AM

Ok let me clear something out, what you expect from "Set Int Parameter"? That you gonna set integer varable in it and then when you change that varbale it will automaticly apply? if yes that does not how it works, you need to do this set on every time oyu want to change that paameter. IF not then make sure you using right audio component right sound cue and right parameter name.

avatar image Daphnis26 Apr 29 '14 at 08:40 PM

Sorry I'm lost, these tips are too abstract for me to follow.

avatar image Daphnis26 Apr 28 '14 at 01:16 AM

If you were to implement such a system, how would your graphs look? Have you gotten this to work?

avatar image Shadowriver Apr 29 '14 at 08:40 PM

just use go to "Components" ass Audio Component and then in blueprint you should have variable created with that component instance, use it to set soundscue inside it with Set Sound

https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Engine/Components/UAudioComponent/SetSound/index.html

and then use Set Int Parameter to set parameter in cue

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Success!

So I still haven't found a way to control that darn switch node, however I was able to create a custom notify event to use with my animation. I'll include a snapshot of my notify for anyone trying to do the same. The sound cue here is determined by an Integer value from the MyCharacter blueprint.

https://www.unrealengine.com/blog/crash-course-in-animation-notifies

alt text

footstepsnotify.jpg (144.8 kB)
more ▼

answered Apr 28 '14 at 07:42 AM

avatar image

Daphnis26
277 23 26 36

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question