{"id":19454037,"url":"https://github.com/vurv78/webaudio","last_synced_at":"2025-04-25T04:31:04.132Z","repository":{"id":48344856,"uuid":"361093054","full_name":"Vurv78/WebAudio","owner":"Vurv78","description":"A safe, efficient and powerful replacement for Streamcore that adds playing \u0026 manipulating URL streams through IGmodAudioChannel/BASS","archived":false,"fork":false,"pushed_at":"2024-11-09T05:00:16.000Z","size":468,"stargazers_count":18,"open_issues_count":14,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-03T16:39:46.017Z","etag":null,"topics":["addon","bass","expression2","garrys","garrysmod","glua","gmod","streamcore","webaudio","wiremod","workshop"],"latest_commit_sha":null,"homepage":"https://steamcommunity.com/sharedfiles/filedetails/?id=2466875474","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vurv78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-24T06:57:25.000Z","updated_at":"2024-11-09T05:00:20.000Z","dependencies_parsed_at":"2024-08-06T23:23:29.659Z","dependency_job_id":null,"html_url":"https://github.com/Vurv78/WebAudio","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vurv78%2FWebAudio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vurv78%2FWebAudio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vurv78%2FWebAudio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vurv78%2FWebAudio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vurv78","download_url":"https://codeload.github.com/Vurv78/WebAudio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250754657,"owners_count":21481850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["addon","bass","expression2","garrys","garrysmod","glua","gmod","streamcore","webaudio","wiremod","workshop"],"created_at":"2024-11-10T17:07:14.511Z","updated_at":"2025-04-25T04:31:01.862Z","avatar_url":"https://github.com/Vurv78.png","language":"Lua","readme":"# WebAudio [![Release Shield](https://img.shields.io/github/v/release/Vurv78/WebAudio)](https://github.com/Vurv78/WebAudio/releases/latest) [![License](https://img.shields.io/github/license/Vurv78/WebAudio?color=red)](https://opensource.org/licenses/MIT) [![Linter Badge](https://github.com/Vurv78/WebAudio/workflows/Linter/badge.svg)](https://github.com/Vurv78/WebAudio/actions) [![github/Vurv78](https://img.shields.io/discord/824727565948157963?label=Discord\u0026logo=discord\u0026logoColor=ffffff\u0026labelColor=7289DA\u0026color=2c2f33)](https://discord.gg/yXKMt2XUXm) [![Workshop Subscribers](https://img.shields.io/steam/subscriptions/2466875474?color=yellow\u0026logo=steam)](https://steamcommunity.com/sharedfiles/filedetails/?id=2466875474)\n\n\nThis is an addon for garrysmod that adds a serverside ``WebAudio`` class which can be used to interact with clientside IGmodAudioChannels asynchronously.  \nIt also adds an extension for Expression2 to interact with these in a safe manner.  \n\nYou can consider this as a safe and more robust replacement for the popular Streamcore addon, and I advise you to replace it for the safety of your server and its population.\n``Documentation`` can be found at the bottom of this file\n\nTo convert your Streamcore contraptions to *WebAudio*, see [from Streamcore to WebAudio](https://github.com/Vurv78/WebAudio/wiki/From-StreamCore-To-WebAudio)\n\n## Features\n* Client and Serverside Whitelists, both are customizable with simple patterns or more advanced lua patterns.  \n* The ``WebAudio`` class and api for that allows for interfacing with IGModAudioChannels from the server, changing the volume, position and time of the audio streams dynamically.  \n  * Comes with an Expression2 type that binds to the WebAudio lua class.  \n\n## Why use this over streamcore\nIf you do not know already, Streamcore is a dangerous addon in several ways.\n* Allows for ANYONE to download ANYTHING to everyone on the server's computers.\n* Allows for people to crash / lag everyone easily.\n* ~~Doesn't allow you to disable it.~~ (There is apparently a way to disable streamcore through ``streamcore_disabled``. It was added ~4 years after the addon was created only after people kept bugging the creator that maybe it isn't a good idea to allow people to download ANYTHING to your computer with no shut off switch.)\n\nWebAudio aims to easily solve these issues by:\n* Having proper net limits\n* Using a customizable whitelist for both your server \u0026 its clients.\n* Containing a flexible but safe default whitelist that only allows for large or trusted domains as to not allow for malicious requests.\n\n## Contributing\nSee CONTRIBUTING.md\n\n## Convars\n| Realm  | Name          | Default Value | Description                                                                                                                |\n|--------|---------------|---------------|----------------------------------------------------------------------------------------------------------------------------|\n| SHARED | wa_enable     | 1             | Whether WebAudio is enabled for you or the whole server. If you set this to 0, it will purge all currently running streams |\n| SERVER | wa_admin_only | 0             | Restrict E2 WebAudio access to admins. 0 is everyone, 1 is \u003e=admin, 2 is super admins only.                                |\n| SERVER | wa_stream_max | 5             | Max number of E2 WebAudio streams a player can have                                                                        |\n| SHARED | wa_volume_max | 300           | Max volume of streams, will clamp the volume of streams to this on both the client and on the server                       |\n| SHARED | wa_radius_max | 3000         | Max distance where WebAudio streams can be heard from their origin.                                                        |\n| 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       |\n| CLIENT | wa_verbosity  | 1             | Verbosity of console notifications. 2 =\u003e URL/Logging + Extra Info, 1 =\u003e Only warnings/errors, 0 =\u003e Nothing (Avoid this)    |\n| SERVER | wa_sc_compat | 0 | Whether streamcore-compatible functions should be generated for E2 (for backwards compat) |\n\n## Concommands\n| Realm  | Name                | Description                                                                                                    |\n|--------|---------------------|----------------------------------------------------------------------------------------------------------------|\n| SHARED | wa_purge            | Purges all currently running WebAudio streams and does not receive any further net updates with their objects. |\n| SHARED | wa_reload_whitelist | Refreshes your whitelist located at data/webaudio_whitelist.txt                                                |\n| SHARED | wa_list             | Prints a list of currently playing WebAudio streams (As long as their owner IsValid) with their url, id \u0026 owner|\n| SHARED | wa_help             | Prints the link to the github to your console                                                                  |\n| CLIENT | wa_display          | Displays active WebAudio streams to your screen w/ steamid and stream id                                                                  |\n\n## Functions\n\n``webaudio webAudio(string url)``  \nReturns a **WebAudio** object of that URL as long as it is whitelisted by the server.  \nHas a burst cooldown between calls. If you can't create a webAudio object, it'll error, so check ``webAudioCanCreate`` before calling this! You can create all of your streams in one tick but will have to wait 300ms for each slot to regenerate.\n\n``number webAudiosLeft()``  \nReturns how many WebAudios you can create.\n\n``number webAudioCanCreate()``  \nReturns whether you can create a webaudio stream. Checks cooldown and whether you have a slot for another stream left.\n\n``number webAudioCanCreate(string url)``  \nSame as ``webAudioCanCreate()``, but also checks if the url given is whitelisted so you don't error on webAudio calls.\n\n``number webAudioEnabled()``  \nReturns whether webAudio is enabled for use on the server.\n\n``number webAudioAdminOnly()``  \nReturns 0 if webAudio is available to everyone, 1 if only admins, 2 if only superadmins.\n\n### WebAudio Type Methods\n\n## Setters\n\n``void webaudio:setDirection(vector dir)``  \nSets the direction in which the WebAudio stream is playing towards. Does not update the object.\n\n``void webaudio:setPos(vector pos)``  \nSets the 3D Position of the WebAudio stream without updating it. Does not update the object.\n\n``void webaudio:setVolume(number volume)``  \nSets the volume of the WebAudio stream, in percent format. 200 is 2x as loud as normal, 100 is default. Will error if it is past ``wa_volume_max``.\n\n``void webaudio:setTime(number time)``  \nSets the time in which the WebAudio stream should seek to in playing the URL. Does not update the object.\n\n``void webaudio:setPlaybackRate(number rate)``  \nSets the playback speed of a webaudio stream. 2 is twice as fast, 0.5 being half, etc. Does not update the object.\n\n``void webaudio:setParent(entity e)``  \nParents the stream position to e, local to the entity. If you've never set the position before, will be parented to the center of the prop. Returns 1 if successfully parented or 0 if prop wasn't valid. Does not update the object.\n\n``void webaudio:setParent()``  \nUnparents the stream from the currently parented entity. Does not update the object.\n\n``void webaudio:parentTo(entity e)``  \nAlias of webaudio:setParent(e) Parents the stream position to e, local to the entity. If you've never set the position before, will be parented to the center of the prop. Does not update the object.\n\n``void webaudio:unparent()``  \nAlias of webaudio:setParent(), Unparents the stream from the currently parented entity. Does not update the object.\n\n``void webaudio:setRadius(number radius)``  \nSets the radius in which to the stream will be heard in. Default is 200 and (default) max is 1500. Does not update the object.\n\n``void webaudio:setLooping(number looping)``  \nSets the stream to loop if n ~= 0, else stops looping.\n\n``void webaudio:set3DEnabled(number enabled)``\nBy default WebAudio streams are 3D, so if enabled is 0 it will be set to \"2D\",\nso the sound will be on the player's position if they are within the radius of the stream.\n\n## Special\n\n``number webaudio:pause()``  \nPauses the stream where it is currently playing, Returns 1 or 0 if could successfully do so, because of quota. Automatically calls updates self internally.\n\n``number webaudio:play()``  \nStarts the stream or continues where it left off after pausing, Returns 1 or 0 if could successfully do so from quota. Automatically updates self internally.\n\n``void webaudio:destroy()``  \nDestroys the WebAudio object, rendering it useless. It will silently fail when trying to use it from here on! This gives you another slot to make a WebAudio object\n\n``number webaudio:update()``  \nSends all of the information of the object given by functions like setPos and setTime to the client. You need to call this after running functions without running ``:play()`` or ``:pause()`` on them since those sync with the client. Returns 1 if could update, 0 if hit transmission quota\n\n## Getters\n\n``number webaudio:isValid()``  \nReturns 1 or 0 for whether the stream is valid and not destroyed.\n\n``number webaudio:isParented()``  \nReturns 1 or 0 for whether the stream is parented\n\n``vector webaudio:getPos()``  \nReturns the position of the stream set by setPos. Doesn't work with parented streams since they do that math on the client.\n\n``vector webaudio:getVolume()``  \nReturns the volume of the stream set by setVolume\n\n``number webaudio:getRadius()``  \nReturns the radius of the stream set by setRadius\n\n``number webaudio:getTime()``  \nReturns the current playback time of the stream in seconds.\n\n``number webaudio:getState()``  \nReturns the state of the stream, 0 = STOPPED, 1 = PLAYING, 2 = PAUSED, Use the _CHANNEL* constants to get these values easily. (_CHANNEL_STOPPED is 0 for example)\n\n``number webaudio:getLength()``  \nReturns the playback duration / length of the stream. Returns -1 if we haven't received the length yet.\n\n``string webaudio:getFileName()``  \nReturns the file name of the webaudio stream. Usually but not always returns the URL of the stream, and will return \"\" if we haven't received the filename yet.\n\n``number webaudio:getLooping()``  \nReturns if the stream is looping, set by setLooping\n\n``number webaudio:get3DEnabled()``\nReturns if the webaudio is in 3D mode. This is true by default.\n\n``array webaudio:getFFT()``  \nReturns an array of 64 FFT values from 0-255.\n\n## Ignore System\n\u003e This is a system similar to how you'd use holoVisible to hide holograms from others.\n\n``array webaudio:setIgnored(entity ply, number ignored)``  \nIf ignored is not 0, blocks the given user from hearing the stream. Else, unblocks the user.\n\n``array webaudio:setIgnored(array plys, number ignored)``  \nIf ignored is not 0, sets the stream to ignore certain players. Else, unblocks them all.\n\n``number webaudio:getIgnored(entity ply)``  \nReturns if the user is blocked from hearing the stream. Note this also counts if they purged the webaudio stream themself, but doesn't count if they have webaudio disabled. Set by setIgnored","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvurv78%2Fwebaudio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvurv78%2Fwebaudio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvurv78%2Fwebaudio/lists"}