# Play audio from audio\_player\_device (verse code)

**URL:** <https://forums.unrealengine.com/t/play-audio-from-audio-player-device-verse-code/825085>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite\
**Created:** [March 26, 2023, 3:22pm UTC](https://forums.unrealengine.com/t/play-audio-from-audio-player-device-verse-code/825085 "2023-03-26T15:22:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![deathberry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@deathberry](https://forums.unrealengine.com/u/deathberry)\
**Post date:** [March 26, 2023, 3:22pm UTC](https://forums.unrealengine.com/t/play-audio-from-audio-player-device-verse-code/825085/1 "2023-03-26T15:22:44Z")

</div>

Hello!  
I’m trying to play a sound from audio\_player\_device.  
I have : (translating fields from french to english, may differ but essentially it is the same)

- created the audio\_player\_device
- set the sound asset to play
- set “Heard by” to “Everyone”
- set “Sound location” to “Local player”

In my code, I have class named countdown\_timer.  
Inside this class, I have a member reference to the audio player device which I manually input from Unreal Editor:

```auto
@editable
    var VfoxSoundOne : audio_player_device = audio_player_device{}

```

Now I have a method PlaySound :

```auto
PlaySound() : void =
      VfoxSoundOne.Play()

```

Then a RunCountdown method which gets called from a countdown\_timer\_device, in its OnBegin override.

```auto
RunCountdown()<suspends> : void =
        loop:
            PlaySound()
            Sleep(TimerTickPeriod)
            set RemainingTime -= TimerTickPeriod
    
            UpdateUI()
    
            # Timer End
            if (RemainingTime <= 0.0):
                if (PlayerUI := MaybePlayerUI?):
                    PlayerUI.RemoveWidget(Canvas)
                break

```

Basically, I have followed this tutorial but I want to add countdown sound.  
After all this, sound is not being played.  
Any idea why?  
Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Tom.Noonan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tom.Noonan](https://forums.unrealengine.com/u/Tom.Noonan)\
**Post date:** [March 28, 2023, 10:18am UTC](https://forums.unrealengine.com/t/play-audio-from-audio-player-device-verse-code/825085/2 "2023-03-28T10:18:53Z")

</div>

It looks like the PlaySound() function call should be taken out of the loop? Is TimerTickPeriod a short amount of time?
