top of page

Export markers

Do you want to request the behavior and performance that is synchronized with the sound?

You can use the ability to export the position and text to AnimationEvent of AnimationClip. Also you can input and output of data Json format. You will give unlimited possibilities to your app. (Synchronized effects, camera work, subtitles, other.)

 

As note, this is not a process in run-time analysis. Such functions FC AudioTools does not provide. This means that it is a method to prepare the data suitable for the sound in advance. However, CPU load at the time of execution by this method will be very small.

You can see an example of this by LoopMusicDemo. Cubes will jump shivering together with the rhythm of the sound.

* By the function limit, in order to see the full demo, it requires the use of Unity5.3 or later.

In addition, you can by using the necessary data in a Json format, will be able to handle it in a way other than AnimationClip. If you want to know these details, please check the Animation Window, Animation Event and AnimatorWindow.

Summary
  1. Create markers on WaveEditor.

  2. Export marker to AnimationClip.

  3. Create Animator Controller.

  4. Create state in Animator Controller, and attach AnimationClip.

  5. Add Animator Component to any GameObject, and set the Animator Controller at Controller parameter.

  6. Write AudioClip play and Animator played code by Script. (example: LoopMusicDemo.cs in LoopMusicDemo)

  7. Write AnimationEvent callback code by Script. (example: AnimationClipEventReceive.cs in LoopMusicDemo)

Export  AnimationClip and AnimationEvent

If you wish to export to AnimationClip , choose File > Export > Markers > AnimtionClip.

Then you will see a dialog that perform some of the settings.

These can be customized for generating a AnimationEvent respectively.

Sample loop event on WaveEditor

Markers event on WaveEditor

Marker event is a callback name should be firing on the marker time.
Loop event is a callback name should be firing at the beginning and end of the loop.

 

Function name of AnimationEvent in default is OnAudioMarkerEvent and OnAudioLoopEvent.

Marker AnimationEvent parameters specification

Function, Function name is firing in your script. The default is OnAudioMarkerEvent.

Float, Not set. reserved parameter.

Int, Marker number. This is the number that is displayed on the marker of WaveEditor.

String, Marker name. If you want to set the free text to an event, you can set the text to the marker.

Object, Not set

Sample loop AnimationEvent parameters specification

Function, Function name is firing in your script. The default is OnAudioLoopEvent.

Float, Not set, reserved parameter.

Int, 0 is loop start point, 1 is loop end point, 2 is clip end.

String, Start event is "loopStart" , End event is "loopEnd" , Clip end event is "clipEnd". There are fix.

Object, Not set.

Json data specification

If you want to trigger an event in its own implementation, you can use the source file of Json format. You can export the Json file. Choose File > Export > Marker > Json from menu.

 

Export not only, also it can be imported. Choose File > Import > Marker > Json from menu.

The import, replaced all existing markers and loops. If each block of the loop and the markers are not present, the replacement will be ignored.

 

Json format of the file has the following structure.

loop, It is a structure that contains the loop information. Each element is as follows.

 

startTime, Representing the loop starting position in time. In seconds.
 

endTime, Representing the loop end position in time. In seconds.

 

startSample, This represents as well as the startTime. However, it expressed as a position on the PCM data. startSample takes precedence over startTime.
 

endSample, This is expressed in the same way as endTime. However, it expressed as a position on the PCM data. endSample takes precedence over endTime.

markers, These are the array containing the individual information of the marker. Each element is as follows.

 

time, It is time to marker. The unit is in seconds.

 

sample, This is similar to the time, indicating the marker position. However, it expressed as a position on the PCM data. sample takes precedence over time.

 

Id, Marker number. This is the number that is displayed on the marker of WaveEditor.

 

text, Marker name. If you want to set the free text to an event, you can set the text to the marker.

file example

bottom of page