Is streaming audio from my DAW to Discord possible with a discord bot? - node.js

I found out the other day that discord bots had the ability to play audio in stereo which is not possible with a regular discord account. Maybe it could be possible to stream Ableton Live's audio output to a node.js server for a bot to play back in a Discord channel.
I found this plugin : https://listento.audiomovers.com/ which is a good starting point.
This page shows exemples of audio playback code but not live streaming methods https://discord.js.org/#/docs/main/stable/class/PlayInterface?scrollTo=play
The idea is to live stream audio without the delay that could be caused by video with a soft like OBS. And Discord would be a great platform for this as people would be able to react and make music together.
I need help with the structure of all this. Do you think this is possible ?

Have a look at https://rogueamoeba.com/audiohijack/
and it's free alternative https://github.com/mattingalls/Soundflower/releases
If you run your discord bot locally then you can just set Ableton's output to be an input for the bot using one of the above.

I agree, You can use Asio Link Pro Tool The developer gives it out for free and I use it all the time, especially when chaining audio interfaces together to get more inputs. Works great, you can check out a video with Mr. Different TV on Youtube to understand it.
https://give.academy/downloads/2018/03/03/ODeusASIOLinkPro/
https://www.youtube.com/watch?v=emRZxa0pqbs
Unlimited inputs and outputs (>:o)

Related

Alternate ways to play music on discord bot

I am currently using youtube-dl along with ffmpeg to play songs from my discord bot. However, searching for the song, downloading the video and extracting the audio takes a long time.
So I wanted to know if there is any way to speed up the process so the music can be played almost instantaneously.
You could use Lavalink then. You basically have to host a Lavalink server with your bot and it comes with logs which is really good. It handles sending the songs to discord.
https://github.com/Devoxin/Lavalink.py
You could use this as your wrapper for python

Create dynamic audio broadcast stream (node, ffmpeg, ..?)

I have coded a videoboard. Like a soundboard but with video. You go to one URL that's just a black screen and another one which has a list of different videos (sender). When you click one of these videos it plays on the black screen (receiver). If you play 2 different videos at the same time both videos are shown next to each other on the receiver. That's working fine for several months now. It just creates multiple html video-elements with multiple source-tags (x265 mp4 and vp9 webm).
I recently made a discord bot which takes the webm, extracts the opus stream and plays its sound in the voice channel where the bot is connected. This has one disadvantage: It can only play one sound at a time. It happens a lot that there are multiple videos/sounds playing at the same time so this a bit of a bummer.
So I thought I should create a audiostream on the server which hosts the videoboard and just connect the bot to that stream. But I have no clue how to do this. All I know is that it's very likely going to involve ffmpeg.
What would be the best option here? What I think I would need is basically an infinite silence stream and the possibility to add a audio file onto that stream at any point which will play simultaneously with other audio files that were added before and have not ended payback yet. How is that possible? Somehow with m3u8 playlist-files or via rtsp protocol?
Thanks :)
I think it can be helpful for you https://bitbucket.org/kaleniuk_ihor/neuro_vision/src/db_watch/
Also this library was very useful for me https://github.com/kyriesent/node-rtsp-stream you can just install npm i node-rtsp-stream

Stream music from streaming platform (Deezer, Spotify, Soundcloud) to Web Audio API

Do any of you, know a way to get the audio stream of a music platform and plug it to the Web Audio API ?
I am doing a music visualizer based on the Web Audio API. It currently reads sounds from the mic of my computer and process a real-time visualization. If I play music loud enough, my viz works !
But now I'd like to move on and only read the sound coming from my computer, so that the visualization render only to the music and no other sound such as people chatting.
I know I can buffer MP3 file in that API and it would work perfectly. But in 2020, streaming music is very common, via Deezer, Spotify, Souncloud etc.
I know they all have an API but they often offer an SDK where you cannot really do more than "play" music. There is no easy access to the stream of audio data. Maybe I am wrong and that is why I ask your help.
Thanks
The way to stream music to WebAudio is to use a MediaElementAudioSourceNode or MediaStreamAudioSourceNode. However, these nodes will output zero unless you're allowed to access the data. This means you have to set the CORS property correctly on your end and also requires the server to allow the access through CORS.
A google search will help with setting up CORS. But many sites won't allow access unless you have the right permissions. Then you are out of luck.
I find a "no-code" work around. At least on Ubuntu 18.04, I am able to tell Firefox to take my speakers as the "microphone input".
You just have to select the good "mic" in the list when your browser asks for mic permission.
That solution is very convenient since I do not need to write platform-specific binding-code to access to the audio stream

Nodejs Stream User's Webcam

I want to make an Web app which streams user's webcam which broadcast to viewers
like one to many!
I know getuserMedia() will help me to get user's webcam. now how to stream this data with audio.
I google about this i get few result like using WebRTC and peerjs can do this but I need some kick-start guide like some code or documentation!
Well, you can try easyrtc, is a node.js library for giving WebRTC support to your apps. Is open source and packs some cool demos for you to start making awesome stuff.

Audio stream interfacing API's, Tokbox and Twilio

Hi so we have a brain teaser on our hands.
Currently we're attempting to build a conferencing application with Tokbox, the setup is simple and the video conferencing works fine.
However we want to be able to break into voice, so this means if user x and y are video conferencing but user Z doesn't have a computer they can dial in via a twilio phone number, however the issues comes with the audio, we need the twilio audio to be layered into the tokbox audio so everybody can hear each other.
The best solution is to turn off the tokbox audio and let the twilio client handle the audio, via posting tokbox audio through their client, however this seems it would be a slow option.
Ideally tokbox would be able to handle the twilio audio but it currently doesn't have support.
Apart from extending tokbox with a lot of custom code I was just wandering if you guys know anyway of mixing audio into one layer?
With OpenTok's new iOS v2.2 beta or Android v2.2 beta there is an included tutorial that lets you build your own Publisher object so that you can stream your own media (pictures, videos from your phone, etc). You might be able to build you own Publisher object to steam Twilio's audio.

Resources