5 Replies - 5884 Views - Last Post: 07 November 2018 - 07:52 AM

#1 Gotti   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 13
  • Joined: 31-January 18

How does audio over a websocket work?

Posted 17 June 2018 - 08:45 AM

Hello, I'm trying to write a script that "Reads" audio over a websocket (specifically over discord websocket) so I can then manipulate that audio and do stuff like record it, and limit the audio levels in the voice channel. I.e. user screams, it'll then mute that user automatically before I can hear their scream.

But first I need to understand how audio works, where can I begin?

Thank you,
Is This A Good Question/Topic? 0
  • +

Replies To: How does audio over a websocket work?

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15114
  • View blog
  • Posts: 60,481
  • Joined: 12-June 08

Re: How does audio over a websocket work?

Posted 17 June 2018 - 11:19 AM

Script in what language and for what platform?
Was This Post Helpful? 0
  • +
  • -

#3 Gotti   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 13
  • Joined: 31-January 18

Re: How does audio over a websocket work?

Posted 17 June 2018 - 11:35 AM

View Postmodi123_1, on 17 June 2018 - 11:19 AM, said:

Script in what language and for what platform?

Doesn't matter I could write it in Python, Java, C#, or Go. And for the discord app PC or Mac Platform.

Thank you,
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15114
  • View blog
  • Posts: 60,481
  • Joined: 12-June 08

Re: How does audio over a websocket work?

Posted 17 June 2018 - 11:44 AM

Okay.. so not locked into a 'script'. Fair enough.

I would suggest starting by looking up existing tools, libraries, sdks, etc that can take an audio stream and do analysis. 'audio analysis tutorial'

If you are building a discord app from the ground up I would head to their dev page and see what information on audio is available off the bat.

If you want this running - free floating - from an existing discord app/web page load.. well.. that's going to be a different bucket of tuna to sift through.
Was This Post Helpful? 1
  • +
  • -

#5 Gotti   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 13
  • Joined: 31-January 18

Re: How does audio over a websocket work?

Posted 17 June 2018 - 11:52 AM

View Postmodi123_1, on 17 June 2018 - 11:44 AM, said:

Okay.. so not locked into a 'script'. Fair enough.

I would suggest starting by looking up existing tools, libraries, sdks, etc that can take an audio stream and do analysis. 'audio analysis tutorial'

If you are building a discord app from the ground up I would head to their dev page and see what information on audio is available off the bat.

If you want this running - free floating - from an existing discord app/web page load.. well.. that's going to be a different bucket of tuna to sift through.


Thank you for your time and detailed response. Much appreciated.
Was This Post Helpful? 0
  • +
  • -

#6 Sheepings   User is offline

  • D.I.C Lover
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,260
  • Joined: 05-December 13

Re: How does audio over a websocket work?

Posted 07 November 2018 - 07:52 AM

Unless you can redirect the audio stream through another audio playback device (like an audio bridge app, from a user sound card, through a bridge app, and then onto Discord, you'll find it hard to manipulate Discords audio channels directly but not indirectly, and I'll explain why.

This approach could take weeks pinvoking alone!!

The reason this is likely an impossible project is because of this approach plus the Discord desktop app is only a web-based platform. The developers wrapped the Discord web application in a wrapper inside a Chromium browser-control inside of a C++ application. Thus limiting your ability to manipulate its core code since wrappers don't necessarily expose the real classes, and thus limiting what you can do with its desktop application.

However if you change your approach. A better angle for you to tackle this project, would be to use Discords already available API and webhooks in conjunction with this D.I.C tutorial, to deafen [mute] users who appear above a certain dB+1 sound amplification range. You'll need to implement some type of audio bridge to make what you want to do plausible and yet achievable. The reason Discord made their application in this way was to retain control of all functionality, security and to protect their source code from external manipulation.

Keep in mind, whenever you reroute audio from the internet, you cause delay and that results in latency in time transmission. Hope you find this somewhat helpful.

And I just realised this topic is months old. Could have swore this was a new topic :S
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1