Setting Metasounds Variable

I think I have about 5 MetaSound tutorials on UE Hub at this point, including the Using Presets one :sweat_smile:. Ironically I think the one that’s most help you is still in review.

Okay, so like, I actually think it’s worth backing up and making sure you understand what all those nodes are doing. Usually when I work with stuff I’m less familiar with, I start with “does this simple usage do what I expect.” So like, I actually think it would be worth trying to get steps like “loop one sound 20 times” working before trying to tackle the giant picture, because those are easier to build off of. MetaSounds can do a lot more things than Sound Cues can, but partly because it offers so much more control, it takes a bit more effort to explain to MetaSounds what exactly you want it to do.

That said, I am 90% certain putting ArrayIndex in RandomGet is not doing what you want. That’s not an Array Index input you’re connecting it to, it’s a Seed input, which you probably don’t need to worry about at the moment. Nor is the way you’re using the Shuffle command - you aren’t ever telling it to actually Shuffle. I really recommend putting nodes like this in the simplest context possible, until you are sure you understand what they do. And read the tooltips! There should be tooltips both on the node as a whole and on each input and output: they’re sort of like internal documentation, and in fact a lot of node-specific documentation is pretty much just copying and pasting the tooltips.

(As a very brief summary of Random Get - it’ll pick a new random number each time it’s triggered. So, if you want the Wave Player to play the same sound it did last time, you can just not trigger Random Get again. I.e., this will play you ten of the same random sound in a row:

But I strongly recommend not just copying and pasting it, but trying to spend time to understand why it’s behaving the way it is. I.e., move things around, take things out, make sure it’s still behaving the way you’d expect it to. In particular, I’d pay attention to the difference between the “On Trigger” connection and the “On Reset” connection.)

1 Like

Thank you. How do I see the tooltips?

I’m not finding an answer via searching, and the F1 help button in metasounds goes to an empty page : https://docs.unrealengine.com/5.0/en-US/working-with-audio/sound-sources/meta-sounds

You should be able to see descriptions of the nodes and of individual parameters if you hover your mouse over them

Thank you so much for your advice, it helped tremendously!

Ebuch was able to help me with the random elements, this was the other part of the solution. Randomized Loops - #6 by ebuch

Here are a few minutes of output from the procedural percussion generator. There are a total of 531,441 possible combinations.

It’s mostly the way I’d like it, just gonna start playing with metasounds more and seeing what can be done. Plan on adding some electronic elements with built-in sound generation.

…

3 Likes

Since this thread is pretty fresh, I just wanted to chime in here to say that @lantz.anna_1 you have been tremendously helpful for me as well! I just made a procedural song player using some of the help you gave here

Here’s what I have, I’m curious if you have any thoughts / comments / anything I’m doing here that I could be doing better/worse

Song:

Metasound_Outgame_Quiet_Procedural:
image

Random2WavArrayPlayer:

WavChainer:

RandConcat:

RandWav:

RandIdx:

1 Like

I am having trouble loading new SoundWaves into my metasound. I am succesfully changing floats/ints using this method. But maybe the Set Wave Parameter is not functioning? Is anybody else able to dynamically load soundwaves into their metasound?

The reason it can’t be in a preset array is that I am using SoundWaves recorded by the player in game.


Oooook,

Turns out Set Wave Parameter is only for SoundCues. So don’t use it with MetaSounds. Instead use Set Object Parameter. And don’t forget to also re-trigger the metasound after loading the new wave. Phew!


For any future visitors to this thread—Set Wave Parameter does in fact work with MetaSounds. I’m not sure why it doesn’t work in @Bradical’s setup, but I have had no issues using it for mine.

I believe your MetaSound has to be triggered before using Set Wave Parameter (or any other “Set Parameter” function, for that matter).

Edit: Adding more to this post for additional clarity and helpfulness.

Here is my Blueprint setup:

I schedule my MetaSound to play using Play Quantized on a Quartz clock I’ve set up already. Then I set my MetaSound inputs.

This is part of my “Set Wave Assets and Volumes” function:

I have multiple WaveAsset inputs which are set in this function using the above graph.

Lastly, here is my MetaSound graph to show the inputs. Nothing fancy.

To summarize:

  • Make sure your MetaSound has been triggered before using “Set Parameter” functions.
  • Make sure have inputs set up in your MetaSound for receiving wave parameters—not variables.

I’ll update this post if I’m misinformed, or if things change in the future. Hope it helps!

4 Likes

I have this song rocking in the background on loop… soo good!!

1 Like

I have been trying to get this example to work but the Play Wave trigger wont connect , it says it will cause a loop! lol…very frustrating when a loop is precisely what i want :slight_smile:

update: NM… it was the delayed get …now i get it :slight_smile: got a nice 3-layer music piece i had prepped running great now! thx!

Hi! Do you have any idea why I have these envelopes on mine? This set of nodes don’t seem to do anything so I’m stumped.

This event fires off a metasound if I don’t use any of the nodes with envelopes. I can’t even get a node like yours without the envelopes.

(This is how I felt learning about Blueprint Interfaces… so lost)

Hi
@brianheagney

I assume you created the MetaSoundSource variable and set you metasound asset as the default value. But you need to add an “audio component” to your blueprint or run the a function like “Spawn Sound At Location” to create an instance of an audio component that is using your meta sound asset.

When you drag off from the audio component reference variable the search should give you proper nodes. Also be sure to have the “context sensitive” checkbox activated next to the search bar. :wink:

before you fall into that trap: you can’t call the default OnPlay trigger in the meta sound, use the “play” function for the audio component. Only input triggers you created can be used with the “Execute Trigger Parameter”.

Just for clarification:
Look into Blueprint Interfaces. The envelopes indicate that the node is an interface message function. You can throw any object in the Target input and it will try to find the needed interface class on that object. If your target object doesn’t have the interface added, nothing will happen.
The Yellow input demands an object that is guaranteed to have the right interface class added. So you can’t even put an object reference in there that doesn’t have the interface.
My understanding is that a message function just tries to cast the object to the interface class and calls the function. You can do the same with a “cast to” node and executing the function with the yellow input node.