[PLUGIN] Play Sound Files From Disk (OGG)

These nodes are all in Rama’s BP library now, check it out! (39) Rama's Extra Blueprint Nodes for You as a Plugin, No C++ Required! - Blueprint - Unreal Engine Forums


Hey everyone!

I was listening to an audiobook yesterday and thought it would be cool to build an immersive environment (campire w/ old man storyteller) for listening to audiobooks in VR. Seemed like a nice little side project to promote my game and get something finished and released early on. I looked around but didn’t find any way to play a sound file from disk, which of course would be the ideal way do a VR audiobook player. I did find this helpful code from @keru in his forays into making a music player, and using that I was able to whip up a couple of blueprint nodes.

Play Sound From Disk Blueprint Lib

Github Repo
Zip File Download

This plugin provides two blueprint nodes, Play Sound At Location From File, and Play Sound Attached From File. They are identical to Play Sound At Location and Play Sound Attached except that they take a file path rather than a sound asset.

Thanks to @keru for the sound loading code, and @Rama for the blueprint library plugin example code.

Future Work

  • Currently this doesn’t have the other nodes, like those for playing Dialogue. It should be very easy to implement those, feel free to submit a pull request!

Edit: Links added.

Edit: There was no bug (there is no spoon, Neo). User error. The time is in seconds. For some odd reason I figured it would be 0-1. Derp. Plugin works!

Posting here too to bump for publicity. Thank you! :slight_smile:

This is a really awesome. I can think of hundreds of ways to utilize this. Thanks!

Thanks guys for the kind words :slight_smile: Glad you like it.

BTW I had added another BP node after I made the initial post - it just returns the SoundWave object instead of playing it directly.

I looked into setting up the Dialogue nodes as well, but it seems like they don’t load a sound directly anyway, so the node for loading to a SoundWave should be sufficient to use the Dialogue BP nodes already.

I’ll be looking into adding MP3 decoding support to the plugin sometime soon.

Massive thanks go to @keru for his original snippet for loading Ogg files into a SoundWave, and to @Rama for his BP library plugin, which I used as an example to set this one up.

MP3 support would make it perfect. Good luck and keep us posted!

It’s a tricky situation due to the patent issues with MP3 - there are few libs with compatible licensing (LAME, for instance, is LGPL for encoding, but GPL for decoding - d’oh). Can’t wait until it expires - I guess it’s 2017 in the US and a bit sooner elsewhere.

I think it should be appropriate to use a LGPL DLL linked against a UE4 plugin, but I’m no lawyer or LGPL specialist. I think it works because the plugin code is open, though. Not sure.

In any case, I’ll try to provide MP3 support through an LGPL library and leave it at that (I’m not super concerned about having the MP3 people come after me, honestly…worst case I have to take the plugin down).

Awesome n00854180t. This is exactly what I needed to build a prototype for a Mood Jukebox. I eventually want to wire up a online music service like Spotify.

Cool idea!

BTW if you use Rama’s BP library, both this plugin and the load (dds) texture from disk plugins are integrated there now.

THNX