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"

Synthesis: Randomise floats and change synth parameters

Two questions - 1. How can I randomise the three notes in my blueprint? It seems like it'd make sense to make a range of floats to switch between and feed into the first note pin but I'm having trouble doing that. 2. How can I alter different synth parameters according to the player's distance to the sound object? Sound object is currently a blueprint actor with the synth component added that plays when the player enters a collision box. Is there some way to feed the players position into the synth preset values, so they change according to the players distance?

alt text alt text

Product Version: UE 4.16
Tags:
bp.jpg (358.5 kB)
synth.jpg (325.2 kB)
more ▼

asked Jul 18 '17 at 08:50 PM in Using UE4

avatar image

Donalf
51 7 14 22

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

1 answer: sort voted first

1: Use the Random Float in Range node.

alt text

2: You can get the distance between two objects if you know their World Location. Use can use the resulting float distance to scale your synth parameters.

( ( Get Player Pawn -> Get Actor Location) - ( Self -> Get Actor Location) ) -> Vector Length

How to get random value from Array:

alt text

more ▼

answered Jul 18 '17 at 10:27 PM

avatar image

BenVlodgi
2.1k 38 17 52

avatar image Donalf Jul 18 '17 at 11:32 PM

Thanks so much BenVlodgi, I got that working with a pitch bend and it's exactly what I wanted :) Regarding the note randomisation - that works but I want to randomise between specific floats - 50, 60 and 70 for example - how could I do that?

avatar image BenVlodgi Jul 19 '17 at 02:58 PM

Create an Int array with those 3 values in it. Then Get a Random Integer between 0 and the Length of that Array - 1, then use that number to get the value of the integer at that index in your array.

This way you could keep adding to that list of possible pitches, and it would still work.

avatar image Donalf Jul 19 '17 at 03:44 PM

Thanks again - I'm having trouble connecting the array to the random integer range, in this blueprint it's playing random notes with a max of 2, rather than the values in the array. Thanks for your patience, getting there :)

alt text

int.jpg (345.1 kB)
avatar image BenVlodgi Jul 19 '17 at 06:59 PM

No problem, happy to help :)

I updated my answer with the solution to this question.

avatar image Donalf Jul 20 '17 at 11:48 AM

Brilliant, thanks! Last question - how can I keep playing random notes until the player leaves the trigger box? It's easy to do with a sound cue, I really need to do get to grips with blueprints properly.

avatar image BenVlodgi Jul 20 '17 at 03:37 PM

You can use a Timer, set to some interval to trigger a new note. Or pick a Random Float to be the time that passes, then ontick add deltatime until you reach that random float value.

avatar image Donalf Jul 20 '17 at 04:37 PM

Thanks for the help! I'll try to get this timer work, looking at the documentation too.

avatar image BenVlodgi Jul 20 '17 at 05:08 PM

No problem :)

How to use Timers

(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