audio synchronize

0 favourites
  • 10 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • Hello everybody. I wanted to know if there is a way to spawn objects or enemies to the beat or bpm of the music? that is, synchronize events based on the beat. I currently use the audio analyzer effect, which works very well, but I couldn't find something that would allow me to spawn in sync with the music. is there any way to do it? Thank you

    Tagged:

  • If you know the BPM of the music you are playing and that it remains constant throughout the song, you can use a timer set at the beat interval to trigger any actions you like.

    of course, if the song has unmetered intros etc this will throw this approach off, but if you are making the music yourself or at least have the files you could determine if this method will work.

    Have a look at this example: 1drv.ms/u/s!AkmrWgxeuxlKhId_MEP6deyfTNJfRw

    Otherwise, you should be able to use the analyser as you have been and trigger spawns on beats directly, or use the analyser to determine the BPM as a song is playing and then use that result.

  • hello, thanks for answering me. yes I create the music so I know the bpm, but they are not always constant. But I don't know the way to synchronize the music with the spawn of the objects. the timer you suggest is good only if the bpm are constant. Isn't there another way to sync the audio being played, regardless of the bpm?

    ps: I'm so sorry for my language, this is google translate. :)

  • Setting up a BPM detector using the analyser is possible but it would be quite complex. If you are creating the music and you know the BPM and when it varies, I would suggest that a better option is to use an array that is populated with the 'Beat Intervals' for each song and then use that in combination with the timer behaviour to trigger your spawns.

    e.g.

    Array(Beat Intervals):

    .44

    .44

    .44

    .44

    .52

    .52

    .52

    etc.

    On Music Playing - Trigger Once:

    - Start timer "beat" for Array.Front (once only)

    - "Array" Pop Front on X axis

    On Timer "beat"

    - Start timer "beat" for Array.Front (once only)

    - "Array" Pop Front on X axis

  • i will definitely try your suggestion. it is very complex I do not know if I am able to do it. i know what arrays are but i never called them in construct. I'll try looking at some tutorials to understand how to do it. I thank you for the answer. Ps: yesterday I did a crazy thing that worked for a few seconds. I created an event with System-every x sedond, and in the values ​​I put (Audio.Playbacktime ("Audio", 0) / 60 is by magic the objects were synchronized in perfect rhythm.

  • Can you write a example? Thank you

  • Have a look at the array tutorials and examples, they will teach you everything you need to know. Then you need to do the math to determine all of the beat intervals in your song. You can do this by following the same math that I have inside of the previous example. You will need to do it for each section of your song if there are tempo changes.

    Then create an array with the sizes, X:as many as you need, Y:1, Z:1.

    and populate the array with your data - you can also look at loading JSON data into an array examples to get the hang of that.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I tried, but I don't think I can. i have my object (bullet) which needs to be spawned in rhythm. i created an array in which i entered these values. there are five songs, so I entered (1.93 for the value 0 of the array, which corresponds to the first element and so for all the others) I entered 1.93 because the BPM of the song are 116. I divided 116 by 60 (seconds) and then my item should spawn every 1.93 seconds. i could insert an every second x, which is what i have done so far, but i wish i had done something better. thanks anyway for the help, I appreciate it very much.

  • I might get around to doing a proper tutorial one day but a bit too busy at the moment. I'm sure if you keep exploring you will work it out :)

  • Thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)