# How can I identify the instrument / audio file that is currently playing?

**URL:** <https://qa.fmod.com/t/how-can-i-identify-the-instrument-audio-file-that-is-currently-playing/19251>\
**Category:** Unity\
**Created:** [September 8, 2022, 10:15pm UTC](https://qa.fmod.com/t/how-can-i-identify-the-instrument-audio-file-that-is-currently-playing/19251 "2022-09-08T22:15:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 9, 2022, 6:09am UTC](https://qa.fmod.com/t/how-can-i-identify-the-instrument-audio-file-that-is-currently-playing/19251/2 "2022-09-09T06:09:51Z")

</div>

Apologies, there is actually a way to retrieve the name.

To retrieve the sound we will need to use a CallBack. More information about Callbacks can be read under [Studio API | Callbacks](https://fmod.com/docs/2.02/api/studio-guide.html#event-callbacks).

Using your event instance you will want to assign it this callback:

> **Sound Callback**
>
> ```auto
> [AOT.MonoPInvokeCallback(typeof(FMOD.Studio.EVENT_CALLBACK))]
> static FMOD.RESULT SoundCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, System.IntPtr instancePtr, System.IntPtr parameterPtr)
> {
> FMOD.RESULT result;
> FMOD.Studio.EventInstance instance = new FMOD.Studio.EventInstance(instancePtr);
> 		
> switch (type)
> {
> case FMOD.Studio.EVENT_CALLBACK_TYPE.SOUND_PLAYED:
> {
> FMOD.Sound sound = new FMOD.Sound(parameterPtr);
> result = sound.getName(out string name, 256);
> if (result != FMOD.RESULT.OK)
> return result;
> Debug.Log(name); 
> break; 
> }
> case FMOD.Studio.EVENT_CALLBACK_TYPE.SOUND_STOPPED:
> {
> FMOD.Sound sound = new FMOD.Sound(parameterPtr);
> result = sound.getName(out string name, 256);
> if (result != FMOD.RESULT.OK)
> return result;
> Debug.Log(name);
> break;
> }
> }
> return FMOD.RESULT.OK; 
> }
> 
> ```

Assing the call back like this:

```auto
		FMOD.RESULT result; 

        _eventIntstance = FMODUnity.RuntimeManager.CreateInstance(_eventRef);

        result = _eventIntstance.setCallback(SoundCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.SOUND_PLAYED | FMOD.Studio.EVENT_CALLBACK_TYPE.SOUND_STOPPED);

		if (result != FMOD.RESULT.OK)
        {
			Debug.Log("Failed to assign Callback with the result: " + result);
			
        }
		else 
			_eventIntstance.start();

```

Again apologies for the confusion. Hope this helps

---

_[View the full topic](https://qa.fmod.com/t/how-can-i-identify-the-instrument-audio-file-that-is-currently-playing/19251)._
