# How to simply play a sound?

**URL:** <https://forums.unrealengine.com/t/how-to-simply-play-a-sound/369347>\
**Category:** Audio\
**Tags:** fobjectfinder, unreal-engine, question\
**Created:** [September 4, 2016, 2:51pm UTC](https://forums.unrealengine.com/t/how-to-simply-play-a-sound/369347 "2016-09-04T14:51:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_ccd1615d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ccd1615d](https://forums.unrealengine.com/u/anonymous_user_ccd1615d)\
**Post date:** [September 4, 2016, 2:51pm UTC](https://forums.unrealengine.com/t/how-to-simply-play-a-sound/369347/1 "2016-09-04T14:51:30Z")

</div>

I seached around and found only strange solutions; Whats the simplest way to play a Sound with c++?  
I already found the function UGameplayStatics::PlaySound 🙂

![105638-tmp1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/1/c2187057d6f04dfeeb03c13a14ed55fddec558b1.png)

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [September 4, 2016, 3:17pm UTC](https://forums.unrealengine.com/t/how-to-simply-play-a-sound/369347/2 "2016-09-04T15:17:28Z")

</div>

UGameplayStatics::PlaySound2D (it changed name i think) is the simplest. I guess you got might have issue with getting USoundBase object?

Simplest way to get it is to simply make a editor editable USoundBase\* varable (with EditAnywhere) in class make a blueprint out of it and set sound asset to that varbale in editor so you don’t need any messy referencing code

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ccd1615d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ccd1615d](https://forums.unrealengine.com/u/anonymous_user_ccd1615d)\
**Post date:** [September 4, 2016, 3:35pm UTC](https://forums.unrealengine.com/t/how-to-simply-play-a-sound/369347/3 "2016-09-04T15:35:20Z")

</div>

Thanks for your fast answer, thats a good idea and works great, but actually I’m spawining my actor dynamically. Any idea on how do it this way?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ccd1615d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ccd1615d](https://forums.unrealengine.com/u/anonymous_user_ccd1615d)\
**Post date:** [September 4, 2016, 4:23pm UTC](https://forums.unrealengine.com/t/how-to-simply-play-a-sound/369347/4 "2016-09-04T16:23:46Z")

</div>

I finally found it myself. It can be instanciated like this:

```
static ConstructorHelpers::FObjectFinder<USoundBase> Soundf(TEXT("/Game/Sounds/backgroundsound"));

class USoundBase* Sound = Soundf.Object ;

```

---

<div class="post-metadata">

**Author:** ![TinkrDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TinkrDev](https://forums.unrealengine.com/u/TinkrDev)\
**Post date:** [October 16, 2018, 11:21pm UTC](https://forums.unrealengine.com/t/how-to-simply-play-a-sound/369347/5 "2018-10-16T23:21:25Z")

</div>

Thanks, it works for me=)
