MPTK: Use AudioSource

Audio Source Template

MidiFilePlayer and MidiStreamPlayer gameobject contains an AudioSource template. This audio source is used as a template to play each sounds in your Midi File Player. An AudioSource is instantiated when there is the need to play a new wave from the Midi file. AudioSource are automatically deleted at the end of playing.

You can customize this AudioSource to adapt to your need. Picture below is the default configuration deployed with MPTK. Go to Unity documentation to understand how to use it.

Tips:

  • By default Spatial Blend is set to 0. Set to a upper value to change volume accordingly with the distance to the Audio Listener and the Left/Right orientation.
  • Audio Source are created at run time when a new sound is need. So, change the template parameters at edit mode to be sure that changes will be taken into account for all sounds when playing.

 


Leave a Reply

Your email address will not be published. Required fields are marked *