Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Music synchronization and callbacks with PostTrigger

0 votes
Hi everybody,

For a musical game developped with Unity3D, I have a background music (used to define the beat) and I need to have some short sequences (a few seconds) launched randomly on the beat.
Those sequences must be synchronized with background music, so I'm using Stinger in Wwise to do launch the sequence on next beat.

OK, It is working fine...except that in Unity, I cannot use events callbackswith posttrigger (so, I cannot know if and when the sequence start playing, the source position, neither the end of the sequence).
It's problematic for me, because each sequence is a short gameplay phase, and I really need this information to be accurate.
I tried to extrapolate those information (on the assumption that next beat corresponds to sequence starting time), but :
1) it is not very accurate and can lead to bugs and errors
2) I need to enter manually custom cues and sequence duration times in Unity...I have a lot of sequence, so it can be fastidious and an errors source

Is there a way to use callbacks (or tho have information about sequences played) with stingers / post triggers ?

I also tried another approach : listening AkCallbackType.AK_MusicSyncBeat events on the background music, and posting the sequence event on the next beat via Unity.
But I'm afraid to encounter synchronization problem with this method...do you think it can be the case ?

Else, would you have a third solution to do this (have a sequence synchronized on background music, and be able to recover playing information, including custom cues) ?

Many thanks in advance for your help
asked Mar 27 in General Discussion by Olivier F. (140 points)

2 Answers

0 votes
Hey olivier,

Sorry if i got you hyped for an answer.

I just encountered the same issue, if you found a solution by now i would be glad to hear about it.

 

Dean
answered Apr 20 by ‪Dean k. (140 points)
0 votes
Hi,

I finally found a solution : using "GetPlayingSegmentInfo" on the background music...
When I receive my beat information, I post the trigger, then, on next beat, I get the segment info (and so, the read position in the background music).
Then I store this information as the "Start Time" of the sequence.
Every time I need to have a relative time in the sequence, I just do "music segment info" - Start Time.

This way, the sequence is launched with stingers, but I have accurate timing for gameplay phases.

Hope it's clear and it helped ;)
answered Apr 21 by Olivier F. (140 points)
...