Jump to content
Martin951

Play custom sound

Recommended Posts

Hello,

first of all, this is not directly LSPDFR related, but since this is the most active DEV forum that I know, I am posting it here. Also I will use all the help in my future projects. (I am an audio designer.)

 

It's quite simple, I have the basics of programming, but it's like jumping to the unknown depths, with a parachute. 

I would like to know, if there is a way to play custom audio (from a folder inside GTA) using LUA (so I can work in realtime inside GTA).

 

I want to make a realistic audio simulation framework, which will simulate acustics, sound echo and so on. Mainly for weapons. I know, i know, we have many realistic sound mods, but it is not dynamic..

 

Can anyone help me with this? Much appreciated!

Share this post


Link to post
Share on other sites

Hello Martin,

 

Lua does not have any native function to play audio, so the easiest way would be to use a library for that. You can find some examples here: https://stackoverflow.com/questions/5365583/how-to-play-sound-in-lua

 

Note that this will play the audio from the GTA V process like any other "frontend" game audio, i.e. you cannot play it from a given game position to adjust for volume etc. These things you would have to implement yourself based on what parameters the library supports and what you can calculate from the game. Playing audio from your disk through the actual game world (i.e. a position in the game world) is possible, but much more complicated.

Share this post


Link to post
Share on other sites

Hmm okay,

 

Nothing is impossible but not for me clearly! Thank you for your answer.

Also, is there a possibility to easily apply audio filter? Like for a vehicle engine.. Agin, dynamically.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×