For Each Loop not setting integer parameter for Meta Sound correctly

Hey there,

I’m still pretty new with Unreal Engine and game development as a whole, so please excuse my ignorance if this issue is pretty obvious.

I’ve been trying to set up an “Animal Crossing” talk system that receives a string, that then splits it into each character, to then compare it to a character library/dictionary (which is just an array that has the same indexes as an array set up in a Meta Sound), that then passes all of these to a Meta Sound.

I’ve set up a for each loop that I added a delay to (so after every loop it has a delay before the next, so the audio doesn’t all play at once) which is supposed set an integer input to the Meta Sound. This appears to all work inside the blueprint itself, but as soon as it gets to the Meta Sound it seems to sporadically set the incorrect integer.

This is the correct strings that are printed from the blueprint (prints inverted to the log).
Screenshot 2024-03-08 at 15.58.08

And this is what the Meta Sound prints into the Log .

It appears to have set the very first one to the incorrect character/index and added an additional one at the end.

If continue it with more words/characters it ends up mostly working but then missing some completely.

Is this an issue with the Meta Sound receiving the Integers? It seems to work within the blue print, it just doesn’t work in the Meta Sound.

This is the set up of the initial compare to array then set index.

This is the set up of the loop and setting parameter.

Thank you!

Your delayed for loop might work, but if you’re calling it from a cascade of other loops that aren’t waiting, you’ll basically get a pile of rubbish :slight_smile:

You’re probably getting all the initial values from your waiting loop would generate in quick succession, followed by a random load of rubbish.

So, the recommendation is, run all the loops except your delay loop first to make the output array, then run your special loop.

Hey ClockworkOcean,

Sorry my images might be a little confusing but I think I already have it set up that way.

I have a sequence node before both of these loops which I believe fires of each out in order, unless I’m mistaken and it doesn’t wait for the loop to finish.

I have also tried removing the sequence node and adding the rest after the initials loops completed output, but I was getting the same error.

Do you have any other suggestions on how to order these to make sure that it does happen after it finishes the loop?

Thank you!

Can you show the whole thing, otherwise I’m just guessing? :slight_smile:

Sure, here you go


(Theres an extra little bit at the end that’s for subtitles too)
Theres this in the construction script too.

Also the Meta Sound set up.

In the screenshot it uses the initial sequencer, but I have also attempted to route it from the completed pin of the first loop and it appears to do the same thing.

I just want to clarify, that it all works within the blueprint itself. As soon as it gets to the Meta Sound through the “set integer parameter” node it begins to have the wrong integers. I can test this be adding a print node before the “set integer parameter” node and comparing it to the log in the Meta Sound.

Sorry just realised how low quality that image is. here it is on Blueprintue

1 Like

Thanks.

I still think it’s the delay loop :slight_smile:

Once the system see this latency icon

I doesn’t wait for any time, it just goes directly to the next piece of code.

That means that it’s not going to do the top loop, then the bottom loop. It’s going to run the top loop until it sees the delay node in the macro, then start running the bottom loop. Same again with the delay node there, and jump back to the top loop.

So in fact, you have these two loops firing randomly, sort of riffle shuffled together. Would that account for the strange behavior?

Hmm, I understand that and I was sort of hoping for those two loop nodes to run in tandem as I wanted them to happen at the same time. They do appear to run this way somewhat correctly.
image
The characters and integers do end up lining up somewhat correctly throughout the whole thing and never stop lining up. I’m sure this is a stupid way of setting these up and there is a better way that I’m not aware of.

Regardless, it still seems the error is happening only on the Meta Sound side as it consistently prints out correctly from the blueprint. I have even removed the second delay loop and it still occurs.

Thanks!

1 Like

Noooo idea, sorry :rofl:

I would try just the delay loop and dia index on it’s own, and build up from there.

There’s too much going on to be able to debug.

Hmm alright I seemed to have worked out the issue. I noticed as I was listening to the audio that the background sounds were starting to cut in and out and thought there might be a limit to the amount of sounds playing at once. Turns out the max channels were set to 32 and when I set it higher it all begins to work…

Thanks for your help throughout this. Didn’t think ti would be something so simple.

1 Like

Glad you sussed it out :slight_smile:

@sapukisakeraton1 Hi, it might not be relevant for you by now, but for anyone having that issue:

  1. You should use the SetIntParameter node that says “Target is AudioParameterControllerInterface” and not the “Target is AudioComponent” one (which was used for legacy SoundCues).
  2. Place the Play node before the SetIntParameter node.

This should do the trick…