Skip to content

PFScripts/pf_audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Native Audio API

An easy way for developers to implement native audio on their projects!

Information

  • FiveM: Works out of the box.
  • RedM: Should work out of the box but since I can't test it out, if someone find any errors just open a ticket on our discord.
  • Stop/Pause: Stop or Pause an audio thats already playing its not supported.
  • Loop: Looping an audio is not supported.

FAQ

Is this built from scratch?

Nah I just went through Manason code and adapt it for my own needs and likings, also I wanted to expand this to RedM soo yea, Ill leave the repo of his audio api bellow.

How can I add new audio?

1. If you never worked with native audio before i advice you to check this FiveM Forum Thread.

2. You'll need a tool like the one below or just make everything on your own from scratch 🤓.

3. After you're done with you're files, create a new folder in audios folder with you're native audio content. The scructure of the audios folder should be as bellow.

/audios
  /newAudioFolder1
    /audiodirectory
    /data
  /newAudioFolder2
    /audiodirectory
    /data
  /newAudioFolder3
    /audiodirectory
    /data

Client Features

PlayAudio

Plays an audio not located within the 3D world.

  exports.pf_audio:PlayAudio({
    bank = 'example_audiobank',
    soundset = 'example_soundset'
    name = 'example_audio'
  })

PlayAudioFromCoords

Plays an audio from a specific coordinate located within the 3D world.

  exports.pf_audio:PlayAudioFromCoords({
    bank = 'example_audiobank',
    soundset = 'example_soundset'
    name = 'example_audio',
    coords = vec3(0, 0, 0),
    range = 10
  })

PlayAudioFromEntity

Plays an audio from a specific entity located within the 3D world.

  exports.pf_audio:PlayAudioFromEntity({
    bank = 'example_audiobank',
    soundset = 'example_soundset'
    name = 'example_audio',
    entity = PlayerPedId()
  })

Server Features

PlayAudio

Plays an audio not located within the 3D world for a specific client or to all clients.

  -- Specify the player source or leave it -1 to play the audio for all the clients.
  exports.pf_audio:PlayAudio(source, {
    bank = 'example_audiobank',
    soundset = 'example_soundset'
    name = 'example_audio'
  })

PlayAudioFromCoords

Plays an audio from a specific coordinate located within the 3D world to all clients.

  exports.pf_audio:PlayAudioFromCoords({
    bank = 'example_audiobank',
    soundset = 'example_soundset'
    name = 'example_audio',
    coords = vec3(0, 0, 0),
    range = 10
  })

PlayAudioFromEntity

Plays an audio from a specific entity located within the 3D world to all clients.

  exports.pf_audio:PlayAudioFromEntity({
    bank = 'example_audiobank',
    soundset = 'example_soundset'
    name = 'example_audio',
    entity = GetPlayerPed(1)
  })

About

Simple API for playing simple audio data files!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages