Garry's Mod

Garry's Mod

26 ratings
[E2] WebAudio
2
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Fun, Realism
File Size
Posted
Updated
0.083 MB
24 Apr, 2021 @ 10:55am
11 Sep, 2022 @ 8:28pm
39 Change Notes ( view )

Subscribe to download
[E2] WebAudio

In 1 collection by Vurv
Expressive Alpha Testing
23 items
Description
WebAudio
Wiki[github.com]
This addon adds a serverside WebAudio class which can be used to interact with clientside IGmodAudioChannels asynchronously.
It also adds an extension for Expression2 to interact with these in a safe manner.

This is essentially a safe and more robust replacement for the popular Streamcore addon, since it is much more secure and customizable.

Why use this instead of Streamcore?
Streamcore is a dangerous addon.
It has no whitelist, meaning anyone can force everyone on the server to download ILLEGAL CONTENT or grab everyone's IP Addresses through links like grabify.
Server owners aren't safe either, streamcore easily allows you to crash everyone on it through spamming net messages.

In fact, this addon was made out of frustration over how low effort / terrible streamcore is and how the author does not care about the security of people's games whatsoever after years of reports over these vulnerabilities.

WebAudio easily solves this through a whitelist, active development and flexible but strong limits.

WebAudio has much more features.
Have you ever wanted to pause a stream while it was playing?
Maybe turn up the volume higher because it was too quiet?
Maybe even getting the current playback time or FFT values of the stream?
You can easily do all of this + much more with WebAudio.[github.com]

Features
  • Client and Serverside URL whitelists, both are customizable with simple patterns or more advanced lua patterns.
  • The WebAudio type in Expression 2 that adds the ability to change sounds in a 3D space, or change it's volume, position and time whilst the music is playing.
  • Easy to use Lua api that tries to mirror the IGModAudioChannel type.

I want to contribute!
Then use the Github page! https://github.com/Vurv78/WebAudio
Pull request anything you like, just make sure to see CONTRIBUTING.md

I've found a bug!
You can report bugs by either posting a report on the Github page[github.com], or by starting a new conversation on this page.
Make sure to be detailed and concise in your bug reports, so that they can be serviced easier!

ConVars
This is a list of ConVars that you can change to configure the addon to your liking.
Realm
Name
Default Value
Description
SHARED
wa_enable
1
Shared convar that allows you to disable WebAudio for the server or yourself depending on whether it is executed in the client or server console
SERVER
wa_admin_only
0
Allows you to set WebAudio E2 access to only Admins or Only Super Admins. (0 for Everyone, 1 for Admins, 2 for Super Admins).
SHARED
wa_volume_max
300
Shared convar that allows you to set the maximum volume a WebAudio stream can play at.
100 is 100%, 50 is 50% and so on.
Helps to prevent nasty earrape music being played too loudly
SERVER
wa_stream_max
5
Serverside convar that allows you to set the max amount of streams a player can have at once
SHARED
wa_radius_max
3000
Allows you to set the maximum distance a stream can be heard from. Works on your client.
SHARED
wa_fft_enable
1
Whether FFT data is enabled for the server / your client. You shouldn't need to disable it as it is very lightweight
CLIENT
wa_verbosity
1
Verbosity of console notifications. 2 => URL/Logging + Extra Info, 1 => Only warnings/errors, 0 => Nothing (Avoid this)

Console Commands
This is a list of Concommands to use with this addon as a server owner and a user.

Realm
Name
Description
SHARED
wa_purge
Purges all currently running streams and makes sure you don't get any useless net messages from them.
SHARED
wa_reload_whitelist
Reloads your whitelist at data/webaudio_whitelist.txt
SHARED
wa_list
Prints a list of currently playing WebAudio streams (As long as their owner IsValid) with their url, id & owner
SHARED
wa_help
Prints the link to the github to your console
CLIENT
wa_display
Displays active WebAudio streams to your screen w/ steamid and stream id

Function Docs
Function documentation has moved to only be on Github[github.com].
< >
52 Comments
Vurv  [author] 27 Jan @ 4:36pm 
You need to elaborate how it "stopped working". Please make a github issue, or join the discord and explain.

The addon hasn't been updated in 5 months, so.
Vờyҝ 26 Jan @ 8:31am 
After the latest updates, it stopped working, can you fix it? Writes time out to the console.
Vurv  [author] 24 Nov, 2022 @ 1:56pm 
I'm not entirely sure, prob something to do with if it's mono audio, I know for sure one source that doesn't work with webaudio right now is mattjeanes' ytdl api, which outputs mp3s that don't support 3D mode.
Rezerkity 24 Nov, 2022 @ 3:35am 
Can you give me information on which audio file types function in 3D?
Vurv  [author] 23 Nov, 2022 @ 11:47pm 
That error is because webaudio needs to format the streams in 3D mode in order to use things like setPos, direction, etc, and the given audio format you sent can't be played in 3D mode, unfortunately.

It'd need quite the refactor to allow for creating either 3D or 2D mode webaudios. I didn't want to design it like this in the first place because I knew if I did, people would ask why 3D-only functions weren't working for their 2D-mode streams..
nahu 23 Nov, 2022 @ 7:47pm 
I keep getting the BASS_ERROR_NO3D error, any idea as to why that could be?
Vurv  [author] 20 Nov, 2022 @ 6:23pm 
Tried it in game, made a webaudio object with an invalid url which would give BASS_ERROR_FILEFORM, and it recycles the webaudio id so I get more streams to use. Are you on the latest version of webaudio?
Rezerkity 20 Nov, 2022 @ 4:49pm 
Purge doesn't do anything for me online, but I imagine it works in singleplayer. My issue is that once a link errors, such as the constant BASS_ERROR_FILEFORM issues, unless I rejoin the server or the server has a full cleanup, the webaudio remains and takes up a slot, and there's no way to remove it via commands or E2. I'm also unsure of how to deal with the BASS_ERROR_FILEFORM issue, it's always either that, or the whitelist complaining (which is unusual as we use the default whitelist, and I format my links the same as the tutorials on github suggest).
Vurv  [author] 20 Nov, 2022 @ 3:48pm 
They should be automatically clearing themselves if they error, that's odd. If you have control of the server box, you can use `wa_purge`. Note this is only on server since on your client `wa_purge` would only stop them on your client.
Rezerkity 20 Nov, 2022 @ 9:03am 
Is there a way to reset a player's webaudios, such as a command to destroy them all? When I'm using webaudio, and trying to make it work, I get a lot of errors through, well, trial and error. Every time I've hit my limit, I have to rejoin the server to try again due to webaudios being created that never expire.