Sounity
A 3D sound library for FiveM which uses the browsers sound api to produce real 3d sound.
You can configurate many things to “simulate” many different sound sources, even directional sound is possible. More information about all things u can configurate u will find on github.
Please report bugs on github. I will fix bugs asap.
New features, on the other hand, I won’t be adding right away, since my study has started.
Features
- Positional sound
- Positional sound attached to an entity.
- Server-side created sounds are time-synced on every client
- create and use custom Filter/Effects
- Underwater effect
- If the sound source and/or the listener are underwater the sound gets muffled
Preview/Download
Basic Example
Play a sound on a specific location
-- create a sound instance
local soundId = exports.sounity:CreateSound("URL TO AUDIO FILE nui:// supported!", json.encode({
posX = 3,
posY = 5,
posZ = 8,
}));
-- start playback of that sound
exports.sounity:StartSound(soundId);
Create a sound and attach it to the player
-- create a sound instance
local soundId = exports.sounity:CreateSound("URL TO AUDIO FILE nui:// supported!");
-- attach it to the player ped
local ped = GetPlayerPed(source);
local pedId = NetworkGetNetworkIdFromEntity(ped);
exports.sounity:AttachSound(soundId, pedId)
-- start playback of that sound
exports.sounity:StartSound(soundId);