Jump to content

Sound Library Api 1.2.0

$14.99
   (1 review)

1 Screenshot

  • 54.9k
  • 321
  • 60.13 kB
  • Update details
    v1.2.0
    Released
    Download size60.13 kB
    Total versions20
    Time between versions 46 days
    Typical update pace About every 101 days
    Freshness 67 days ago

This area is for discussion and questions. Please use the support area for reporting issues or getting help.

Recommended Comments



supreme

Posted

On 9/25/2023 at 11:58 PM, SH1N3XX1337 said:

encoder site down? will you make one again? cause its useless without

There are some issues with the domain at the moment, will push an update once everything is fixed

Grecords

Posted

Hello. In the Sound Library Api plugin, after the first playback of a random sound, errors begin to appear in the server console.

As I understand it, errors appear every time after playing a sound. Those. If in my configuration the random sound interval is set to 5 minutes, then every 5 minutes when playing sound these errors appear

[04.25 20:20:46] Server Exception: Player Update
[04.25 20:20:46] AssertionException: connection != null
Assertion failure. Value was Null
Expected: Value was not Null
[04.25 20:20:47] Server Exception: Player Update
[04.25 20:20:47] AssertionException: connection != null
[04.25 20:20:47] Assertion failure. Value was Null
[04.25 20:20:47] Expected: Value was not Null
[04.25 20:20:47] at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x00043] in <9b9363fdd7ce4d3aa81e4c2f9c1be714>:0
[04.25 20:20:47] at UnityEngine.Assertions.Assert.IsNotNull[T] (T value, System.String message) [0x0004e] in <9b9363fdd7ce4d3aa81e4c2f9c1be714>:0
[04.25 20:20:47] at Network.BaseNetwork.EnqueueWrite (Network.NetWrite write) [0x00030] in <a02b208c57034562b421a64e117f68fe>:0
[04.25 20:20:47] at Network.NetWrite.Send (Network.SendInfo info) [0x0005d] in <a02b208c57034562b421a64e117f68fe>:0
[04.25 20:20:47] at (wrapper remoting-invoke-with-check) Network.NetWrite.Send(Network.SendInfo)
[04.25 20:20:47] at BaseEntity.ClientRPCSend (Network.NetWrite write, Network.SendInfo sendInfo) [0x00000] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BaseEntity.ClientRPC[T1] (RpcTarget target, T1 arg1) [0x00033] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at PlayerMetabolism.SendChangesToClient () [0x0002d] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at PlayerMetabolism.ServerUpdate (BaseCombatEntity ownerEntity, System.Single delta) [0x0001b] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BasePlayer.ConnectedPlayerUpdate (System.Single deltaTime) [0x00096] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BasePlayer.ServerUpdate (System.Single deltaTime) [0x0020b] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BasePlayer.ServerCycle (System.Single deltaTime) [0x00087] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at ServerMgr.Update () [0x0019b] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
[04.25 20:20:47] UnityEngine.DebugLogHandler:LogException(Exception, Object)
[04.25 20:20:47] UnityEngine.Logger:LogException(Exception, Object)
[04.25 20:20:47] UnityEngine.Debug:LogException(Exception, Object)
[04.25 20:20:47] ServerMgr:Update()

 

supreme

Posted

10 hours ago, Grecords said:

Hello. In the Sound Library Api plugin, after the first playback of a random sound, errors begin to appear in the server console.

As I understand it, errors appear every time after playing a sound. Those. If in my configuration the random sound interval is set to 5 minutes, then every 5 minutes when playing sound these errors appear

[04.25 20:20:46] Server Exception: Player Update
[04.25 20:20:46] AssertionException: connection != null
Assertion failure. Value was Null
Expected: Value was not Null
[04.25 20:20:47] Server Exception: Player Update
[04.25 20:20:47] AssertionException: connection != null
[04.25 20:20:47] Assertion failure. Value was Null
[04.25 20:20:47] Expected: Value was not Null
[04.25 20:20:47] at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x00043] in <9b9363fdd7ce4d3aa81e4c2f9c1be714>:0
[04.25 20:20:47] at UnityEngine.Assertions.Assert.IsNotNull[T] (T value, System.String message) [0x0004e] in <9b9363fdd7ce4d3aa81e4c2f9c1be714>:0
[04.25 20:20:47] at Network.BaseNetwork.EnqueueWrite (Network.NetWrite write) [0x00030] in <a02b208c57034562b421a64e117f68fe>:0
[04.25 20:20:47] at Network.NetWrite.Send (Network.SendInfo info) [0x0005d] in <a02b208c57034562b421a64e117f68fe>:0
[04.25 20:20:47] at (wrapper remoting-invoke-with-check) Network.NetWrite.Send(Network.SendInfo)
[04.25 20:20:47] at BaseEntity.ClientRPCSend (Network.NetWrite write, Network.SendInfo sendInfo) [0x00000] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BaseEntity.ClientRPC[T1] (RpcTarget target, T1 arg1) [0x00033] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at PlayerMetabolism.SendChangesToClient () [0x0002d] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at PlayerMetabolism.ServerUpdate (BaseCombatEntity ownerEntity, System.Single delta) [0x0001b] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BasePlayer.ConnectedPlayerUpdate (System.Single deltaTime) [0x00096] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BasePlayer.ServerUpdate (System.Single deltaTime) [0x0020b] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at BasePlayer.ServerCycle (System.Single deltaTime) [0x00087] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] at ServerMgr.Update () [0x0019b] in <112f84d5c46147d29157a0c5d3a29258>:0
[04.25 20:20:47] UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
[04.25 20:20:47] UnityEngine.DebugLogHandler:LogException(Exception, Object)
[04.25 20:20:47] UnityEngine.Logger:LogException(Exception, Object)
[04.25 20:20:47] UnityEngine.Debug:LogException(Exception, Object)
[04.25 20:20:47] ServerMgr:Update()

 

Fixes will be pushed after easter holiday, thank you for your patience

1st_Negan

Posted

does this work without spawning a boombox or so?

i got another plugin that hooks all newly deployed boomboxes and alters their behavior.
so i need a sound api that does play sound without a boom box

supreme

Posted

1 hour ago, The Governor said:

does this work without spawning a boombox or so?

i got another plugin that hooks all newly deployed boomboxes and alters their behavior.
so i need a sound api that does play sound without a boom box

There is no boombox used

YaMang -w-

Posted

Current Issue: When attacking an NPC while listening to a song (sound) using the Sound Library API, the Kicked: RPC Error in OnProjectileAttack issue occurs. Unloading the Sound Library API will resolve the issue.

  • Like 1
Mozza

Posted

Before i purchased can i get some inforamtion on how you are achieving this. I dont want some hacky shizzle spawning entities/boombox etc, based on the website you are using opus to encode data into the Rust format which it uses for Ingame Voice, so i assume you are using the ingame voice to play custom audio to clients?

Are you truly able to send a Sound to all on server including self? etc 

RickySpanish

Posted

48 minutes ago, Mozza said:

Before i purchased can i get some inforamtion on how you are achieving this. I dont want some hacky shizzle spawning entities/boombox etc, based on the website you are using opus to encode data into the Rust format which it uses for Ingame Voice, so i assume you are using the ingame voice to play custom audio to clients?

Are you truly able to send a Sound to all on server including self? etc 

it spawns an npc under (under the map) and behind the player so it's not visible uses that npc to play the sound then destroys it when the sound is done playing

NINJA WORKS

Posted

I often use Sound Library Encoder, but the website seems to go down frequently. Can you provide applications or technologies related to audio conversion?

Demo_71

Posted

hello there, after some days the plugin is not playing the audio for everyone using the console command audio.message sendall FILENAME, the plugin was working great but for some reason is not anymore, any idea about why is this happening.

supreme

Posted

57 minutes ago, Demo_71 said:

hello there, after some days the plugin is not playing the audio for everyone using the console command audio.message sendall FILENAME, the plugin was working great but for some reason is not anymore, any idea about why is this happening.

Most likely there were changes with the latest rust updates, will investigate soon 

  • Love 1
SocietyTime

Posted

great plugin but sending audio messages doesnt seem to work at all 😞

SocietyTime

Posted

and now its not working at all for some reason. ive even uninstalled all files and restarted server

supreme

Posted

23 hours ago, SocietyTime said:

and now its not working at all for some reason. ive even uninstalled all files and restarted server

Will investigate, thank you

Benjamin Tuttle

Posted (edited)

**EDIT** Was able to replicate this issue with the Kits plugin too, so it may not be isolated to SoundLibrary.

 

Two major bugs with SoundLibrary/HumanNPC compatibility that need to be resolved asap please:

  1. When an NPC is moving and a player gets close and triggers OnEnterNPC, the sound file plays fine but the NPC stops moving and is no longer recognized as an NPC (HumanNPC plugin stops working completely).
  2. When an NPC has a sound file associated with OnEnterNPC, if you remove the NPC before removing the SL sound, the console gets spammed with never-ending errors and it eventually crashes the server with 1000+ console errors per second.  I've attached the console errors.  Thanks!

errors.txt

Edited by Benjamin Tuttle
  • Like 1
ZombZ

Posted

Quote

Failed to call hook 'OnFishCaught' on plugin 'SoundLibraryApi v1.1.7' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.SoundLibraryApi.ProcessAudioEvent (Oxide.Plugins.SoundLibraryApi+AudioEventType audioEventType, BasePlayer player) [0x00012] in <1bd0c9c614924b31a960ea472a09d0ce>:0 
  at Oxide.Plugins.SoundLibraryApi.OnFishCaught (ItemDefinition itemDefinition, BaseFishingRod baseFishingRod, BasePlayer player) [0x00000] in <1bd0c9c614924b31a960ea472a09d0ce>:0 
  at Oxide.Plugins.SoundLibraryApi.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x008b3] in <1bd0c9c614924b31a960ea472a09d0ce>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <42f9bedc659b4f4786eb778d3cd58968>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in <15f61ddda771464d8246ebdce8ff4811>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <15f61ddda771464d8246ebdce8ff4811>:0 

 

Demo_71

Posted

hello there, plugin looks broken after 4th jun update

 

supreme

Posted

an update will be pushed this week

Chill Roleplay

Posted

Could this be used by players to say things to nearby players? I have 2 players who cannot speak and i would love to suprise them with this if you think i can make it work.

MooDDang

Posted

(Note: This message was translated and rewritten by AI. As a non-expert and non-native English speaker, I apologize in advance if the tone sounds overly enthusiastic or unintentionally pedantic!)

Hi supreme,

First of all, thanks for the amazing plugin! I use it heavily on my server.

Recently, I needed to manage hundreds of audio files and build a dynamic tutorial system. To fit my server's needs, I modified the plugin quite a bit. To be completely honest, I did this using Claude (basically "vibe coding" with AI). However, looking at the fixes we made, I realized some of these might be genuinely useful for the official version.

I didn't want to sound arrogant since I used AI to write the code, but I figured it’s best to share these snippets with you. As the expert, you can evaluate what's actually efficient and maybe incorporate them into your future updates if you like them!

Here are the 4 main modifications and the logic behind them:

#### 1. `EntitySpeaker` 3D Spatial Audio Fix (Makes sound follow NPCs!)

**The Context:** I saw an old forum post from 2021 where someone asked if the sound could follow moving NPCs, and you mentioned it unfortunately only follows the player. I really needed this for my custom boss NPCs to roar while running around. After investigating with Claude, we found out why it wasn't working: The `EntitySpeaker` was functioning on the server, but the dummy speaker entity was never network-updated to the nearby clients (missing snapshot).
**The Fix:** By simply adding a loop to send snapshots to the entity's network group subscribers, true 3D spatial audio attached to entities works perfectly now! The sound beautifully follows the NPC as it moves.

```csharp
// Inside EntitySpeaker.Initialize(BaseEntity source)
// ADDED FIX:
List<Connection>? subscribers = source.net?.group?.subscribers;
if (subscribers != null)
{
    for (int i = 0; i < subscribers.Count; i++)
    {
        Connection? connection = subscribers[i];
        if (connection != null)
        {
            speaker.SendAsSnapshot(connection);
        }
    }
}
SetSpeaker(speaker);

```

#### 2. `GetSoundDuration` API for Dynamic Event Sequencing

**The Idea:** When dealing with hundreds of custom voices, hardcoding timers for each sound is a nightmare. I added a method to calculate the exact duration of the `.data` file using `TicksSinceStart`. This makes the plugin highly scalable—for example, custom plugins can fetch the exact length, add a +0.5s buffer, and automatically stop the sound or trigger the next event dynamically.

```csharp
// ADDED METHOD:
private float GetSoundDuration(string name)
{
    if (string.IsNullOrEmpty(name)) return 0f;
    
    List<SoundLibraryPacket>? packets = LoadPackets(name);
    if (packets == null || packets.Count == 0) return 0f;

    // Calculate duration based on the last packet's timestamp
    float duration = (float)(packets[packets.Count - 1].TicksSinceStart / (double)Stopwatch.Frequency);
    return duration < 0f ? 0f : duration;
}

```

#### 3. DeepSea Update NRE Fix (`ProcessAudioEvent`)

**The Issue:** Rust added new DeepSea content, triggering audio events that weren't in the older generated config files. This caused a Null Reference Exception when checking `.IsEnabled`.
**The Fix:** Added null propagation and empty list checks.

```csharp
// Inside ProcessAudioEvent
// BEFORE:
// AudioEvent audioEvent = _pluginConfiguration.AudioEvents[audioEventType];
// if (!audioEvent.IsEnabled) return;

// AFTER:
AudioEvent? audioEvent = _pluginConfiguration.AudioEvents?[audioEventType];
if (audioEvent == null || !audioEvent.IsEnabled)
{
    return;
}
if (audioEvent.Files == null || audioEvent.Files.Count == 0)
{
    return;
}

```

#### 4. `SpeakerBase.Stop()` Queue Clearing Bug

**The Issue:** Calling `Stop()` only stopped the coroutine. If you played another sound immediately after, the previously queued (and supposedly stopped) packets would play all at once.
**The Fix:** Simply clear the packet queue when stopping.

```csharp
public virtual void Stop()
{
    // ADDED FIX:
    _queuedPackets.Clear();

    if (_coroutine == null) return;
    InvokeHandler.Instance.StopCoroutine(_coroutine);
    _coroutine = null;
}

```

*(Optional note: I also added subfolder scanning and memory caching for the audio packets to reduce disk I/O lag when dealing with huge BGM files, but I know that might change your core architecture too much, so I'll leave that up to you!)*

Feel free to use these snippets, rewrite them entirely, or ignore them if they don't fit your roadmap. Thanks again for your awesome work!

  • Love 1

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
  • Like 1

User Feedback

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
2.9m
Total downloads
Customers
11.8k
Customers served
Files Sold
168.4k
Total sales
Payments
3.7m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.