Sound Library Api

Sound Library Api 1.1.4

Optional Dependencies
https://umod.org/plugins/human-npc
Sound Library Api allows you to store & play recorded sounds for players, attach them to npcs, trigger them via in-game events
1665222537423.png

Use Sound Library API Encoder which allows you to convert any audio file to our own format (after converting the file, rename it and move it to /data/SoundLibraryApi):
Sound Library Encoder
Configuration:
Code:
{
  "Scheduled message interval (seconds)": 900.0,
  "Speaker Distance (The higher the number, the further away is the speaker resulting in a quieter voice)": 5.0,
  "Audio events": {
    "ScheduledMessage": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "Welcome": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "PatrolHelicopter": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "Airdrop": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "CargoShip": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "Chinook": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "CrateHack": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "MissionStarted": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "MissionFinished": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    },
    "MissionFailed": {
      "Enable audio event": true,
      "Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
      "Audio files": [
        "placeholder1",
        "placeholder2"
      ]
    }
  }
}

[CENTER]Language:[/CENTER]
[code]{
"NoPermission": "<color=#e3e3e3>You do not have permission to use this command</color>",
  "AlreadyRecording": "<color=#e3e3e3>You're already recording. Please save or cancel your previous recording before starting a new one.</color>",
  "InvalidAddSyntax": "<color=#e3e3e3>Invalid Syntax. Ex: <color=#de8732>/sl add soundname</color></color>",
  "AddAlreadyExists": "<color=#e3e3e3>This sound already exists. </color><color=#e3e3e3>Please add <color=#de8732>overwrite</color> to your arguments to allow overwriting an existing sound.</color><color=#e3e3e3>Ex: <color=#de8732>sl add {{0}} overwrite</color></color>",
  "AddRecording": "<color=#e3e3e3>You can now start recording.\n</color><color=#e3e3e3>The recording will automatically start once your start sending audio.\n</color><color=#e3e3e3>Once you have completed you can use <color=#de8732>/sl save</color> or <color=#de8732>/sl cancel</color>.\n</color><color=#e3e3e3>You can listen to your recording using <color=#de8732>/sl play</color>\n</color><color=#e3e3e3>If you want to rerecord your recording use <color=#de8732>/sl reset</color></color>",
  "NotRecording": "<color=#e3e3e3>You're not currently recording.</color>",
  "RecordingSaved": "<color=#e3e3e3>We have saved your recording as '{0}'</color>",
  "CanceledRecording": "<color=#e3e3e3>We have canceled your recording</color>",
  "ResetRecording": "<color=#e3e3e3>Your recording has been reset.</color>",
  "PlayInvalidSyntax": "<color=#e3e3e3>Invalid Syntax. Ex: <color=#de8732>/sl play soundname</color> - to play the sound with the given name.</color>",
  "NoSoundFileFound": "<color=#e3e3e3>No sound file found with name '{0}'</color>",
  "HelpText": "<color=#e3e3e3>Allows players to record sound that can be played back to a player\n<color=#de8732>/sl add soundname</color> - to start the creation of a new sound.\n<color=#de8732>/sl npc add hookActionType fileName</color> - to add one or more filenames to a human npc (hook action types are: <color=#de8732>OnUseNPC/OnEnterNPC/OnLeaveNPC/OnHitNPC</color>)\n<color=#de8732>/sl npc remove hookActionType fileName</color> - to remove a filename from a human npc (hook action types are: <color=#de8732>OnUseNPC/OnEnterNPC/OnLeaveNPC/OnHitNPC</color>)\n<color=#de8732>/sl save</color> - to save your recorded sound.\n<color=#de8732>/sl reset</color> - to clear your current recording.\n<color=#de8732>/sl cancel</color> - to cancel your recording and not save.\n<color=#de8732>/sl play</color> - to player your current recording back to you.\n<color=#de8732>/sl</color> - to view this help text again.</color>",
  "AudioMessagesHelpText": "<color=#e3e3e3><color=#66B2FF>/audio send playerName audioName</color> - Sends an audio message to a player</color>\n<color=#e3e3e3><color=#66B2FF>/audio sendall audioName</color> - Sends an audio message to everyone on the server\n<color=#e3e3e3><color=#66B2FF>/audio sendlooped playerName audioName 2 (loop times amount)</color> - Sends a looped audio message to a player\n<color=#e3e3e3><color=#66B2FF>/audio sendalllooped audioName 2 (loop times amount)</color> - Sends a looped audio message to everyone on the server\n<color=#e3e3e3><color=#66B2FF>/audio files</color> - Shows a list of all audio files on the server\n<color=#e3e3e3><color=#66B2FF>/sl</color> - Shows the help page for the Sound Library API\n<color=#e3e3e3><color=#66B2FF>/audio help</color> - Shows these help messages",
  "PlayingText": "<color=#e3e3e3>Playing the file with the name of <color=#de8732>{0}</color></color>",
  "PlayingAudioMessageText": "<color=#e3e3e3>Playing the file with the name of <color=#66B2FF>{0}</color></color>",
  "InvalidTarget": "<color=#e3e3e3>Invalid target, try using his steamid/name</color>",
  "NullFileName": "<color=#e3e3e3>This file name is null, use /audio files</color>",
  "AvailableFileNames": "<color=#e3e3e3>Available files:\n<color=#66B2FF>{0}</color></color>",
  "FileNameNotFound": "<color=#e3e3e3><color=#66B2FF>{0}</color> does not exist, use <color=#66B2FF>/audio files</color></color>",
  "NpcNotFound": "<color=#e3e3e3>Couldn't find any human npc, make sure you have created one using <color=#de8732>/npc_add</color> and you are looking at it!</color>",
  "InvalidHookActionType": "<color=#e3e3e3><color=#de8732>{0}</color> is invalid, list of hook action types:<color=#de8732>\nOnUseNPC\nOnEnterNPC\nOnLeaveNPC\nOnHitNPC</color></color>",
  "NpcSoundAdded": "<color=#e3e3e3><color=#de8732>{0}</color> was added and will play when <color=#66B2FF>{1}</color> is triggered</color>",
  "NpcSoundRemoved": "<color=#e3e3e3><color=#de8732>{0}</color> was removed from this NPC!</color>",
  "FileNameAlreadyAdded": "<color=#e3e3e3><color=#de8732>{0}</color> was already added to this NPC!</color>"
}

Human NPC Integration example:
Code:
{
"Npc Data": {
    "303133854": {
      "Action type of the npc & Filenames that are played": {
        "OnUseNPC": [
          "testing",
          "testing"
        ]
      }
    },
    "986905907": {
      "Action type of the npc & Filenames that are played": {
        "OnEnterNPC": [
          "testing"
        ]
      }
    },
    "1543143931": {
      "Action type of the npc & Filenames that are played": {
        "OnHitNPC": [
          "messagesound"
        ]
      }
    },
    "1205925446": {
      "Action type of the npc & Filenames that are played": {
        "OnUseNPC": [
          "testing",
          "pop"
        ],
        "OnHitNPC": [
          "testing"
        ]
      }
    },
    "45461627": {
      "Action type of the npc & Filenames that are played": {
        "OnUseNPC": [
          "messagesound"
        ],
        "OnHitNPC": [
          "messagesound"
        ]
      }
    },
    "942954162": {
      "Action type of the npc & Filenames that are played": {
        "OnHitNPC": [
          "waveeffect",
          "messagesound"
        ],
        "OnEnterNPC": [
          "messagesound"
        ]
      }
    }
  }
}

OnUseNPC.png

Recording & Playing Audio Files Video:
Human NPC Integration Video:

Permissions:

soundlibraryapi.use - In order to use /sl
soundlibraryapi.audio - In order to use /audio
Console Command:
audio.message​

Information

Author
supreme
First release
Last update
Rating
4.00 star(s) 4 ratings

Latest Release v1.1.4

Released
May 8, 2024 at 3:03 PM
Rating
0.00 star(s) 0 ratings


More resources from supreme

  • Rock Paper Scissors
    Rock Paper Scissors
    Allows players to invite others, gamble scrap & play rock, paper, scissors, the winner gets it all
  • Skin Perks
    Skin Perks
    Skin Perks allows you to modify and give certain stats to a skinned item
  • Furnace Stacks
    Furnace Stacks
    Allows players to stack furnaces
  • Barrel Stacks
    Barrel Stacks
    Barrel Stacks is a Rust plugin that allows players to stack barrels on top of each other!
  • Chest Stacks
    Chest Stacks
    Allows players to stack chests

Sound Library Api by supreme
© chaoscode.io Mar 4, 2021

Latest reviews

developer is great worked with me to help find the solution i was searching for. AND the mod works great, takes a bit of troubleshooting but once you get it working, i have no complaints 10/10 would buy again.
I can play midi files over instruments without issue.

I have now been troubleshooting this plugin for 2 hours straight. I followed instructions 100% to the best of my ability. I played the music so loud for the last 2 hours my wife is ready to divorce me. I set Stereomix RealTekR Audio as input and speakers RealtekR Audio as output just like in the video. I am the only person on my server at the moment. Server is running average fps of 50. Only 105,000 entities. My ping to server is 35ms. My internet is 110mbps download and 30mbps upload

Game sounds and everything else except voice volume is at 0 just like in the plugin how-to video (had to pause video to see that). Everything else on my pc that could utilize mic / speakers is shutoff. During my troubleshooting restarted my server, reloaded the plugin multiple times, even restarted my PC twice and made sure everything that might want access to my headset, mic, and realtek speakers is turned off.

I also tried using my headset mic to my realtek speaker a few times which yielded the EXACT same results.

Literally, no joke... spent 2 solid, focused, no pee break, no eating, no nothing but focusing on troubleshooting.... two hours on this.

trying to record YouTube music just like in the plugin video with realtek as input and output dozens of times. Also tried to record some HD level music as well. Tried multiple things dozens of times each.



Stutters like mad... every, single, time with the exact.... same.... stutters.. I really want this to work. NPCs play it back without issue but the stutters are just too much. It handled my voice ok in a 3 second clip... however, music = no.
awesome plugin players loved it, waiting for more features!
EPIC PLUGIN!!!
It's not the perfect way to play the music because of the shit rust limitations but at least recorded sounds are good and everything is smooth 99% of the time. Also supports an option to play sounds to all players and also for in-game events (only 4 for now) but if have support for more native in-game events in the future than the plane, drop, welcome, ch47 would be great. Keep the good work!