Client for opus server #509
-
I have an opus server and am trying to build a client on an arduino that can connect to the server and decode the opus stream that the server is serving. Which tool should I use for this within this library? |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 2 replies
-
I don't really know what "opus server" means and you need to identify the following
Based on the answers the implementation might be trivial or more involved... |
Beta Was this translation helpful? Give feedback.
-
Let me back up a bit and give you a larger picture of what I currently have and the direction I want to go.
I currently have a windows c# app that leverages bass.net(https://www.un4seen.com/) for creating audio streams and doing mixing. Today that library streams to a usb sound device(codec) that coverts the audio to analog and sends it to remote amplifiers.
I am looking to move the transfer of audio to digital over IP, without using the usb codec. The Bass.net lib supports taking the stream and making it available to clients as a server. The clients are typically based on the same bass.net library to decode the stream. The clients connect to the server and consume tcp packets from the server. Its not celar to me at this point if the clients pull the audio from the server, or if they simply register to receive pushed tcp packets. I will provide the key functions below so you can get an idea of how things operate.
I plan to continue to use the bass.net and c# app as the encoding and server end. But we want to use Arduino based devices as the decoders. So, I need a library that can connect to the server to get the stream via tcp. To be honest I don’t have a clear understanding of all the moving pieces after the server. I am confident that I can encode my current stream and expose it in the server. But beyond that it’s a bit of a mystery and I am hoping to find something that will handle most, if not all, of the client side to recreate the stream. I also haven’t decided what I want to do with the stream after its decoded on the client side just yet. But I would expect something like feeding it out via I2S. But that part isn’t important at the moment.
According to the folks at Bass.net, I would simply use their method BassEnc.BASS_Encode_ServerInit to take my stream and initialize a server to make it available to clients. Seems pretty simple. They recommended their add on for OPUS as the encoder for this server as it gave a good mix of latency and bandwidth usage. BassEnc_Opus.BASS_Encode_OPUS_NewStream Latency is important since I will have multiple clients receiving the audio, and they need to be close to synchronous. So, while low latency isn’t the key requirement, controlled latency across clients is, as the clients will be in ear shot of one another so I don’t want an echo or reverb issue.. They claim that addon uses “OGG Containers”, if that helps you.
If I were to use their solution on the client side I would have been using Bass.BASS_StreamCreateURL to connect the client to the server to get the tcp stream. And I will probably build a test client using that method just to prove out the pipe.
So basically I am looking for that client functionality in an Arduino architecture.
All the commands I listed above can be seen here:
http://bass.radio42.com/help/#
Granted, this is probably still a bit vague, but your lib is the closet I have come to an opus solution for Arduino so I am hoping I can use it, without a heavy lift. If you have any other architecture recommendations let me know.
From: Phil Schatzmann ***@***.***>
Sent: Friday, December 9, 2022 12:40 AM
To: pschatzmann/arduino-audio-tools ***@***.***>
Cc: gdcircuit ***@***.***>; Author ***@***.***>
Subject: Re: [pschatzmann/arduino-audio-tools] Client for opus server (Discussion #509)
I don't really know what "opus server" means and you need to identify the following
* what communication protocol does the server need: e.g. http ?
* what container format is used: e.g. ogg
Based on the answers the implementation might be trivial or more involved...
—
Reply to this email directly, view it on GitHub <#509 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAYBDCTXYDFSN4BNS7REGZLWMLAZNANCNFSM6AAAAAASYXE65U> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AAYBDCTXSMJRUYMXODYMQBLWMLAZNA5CNFSM6AAAAAASYXE65WWGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAIJOM2.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
If I got it right, you need to write the server part yourself: so to make things easy I would start with
On the Arduino side you can just use the stream-url-i2s examples... |
Beta Was this translation helpful? Give feedback.
-
Ok, I could do that. But which library do I use on your side to get data from the server?
|
Beta Was this translation helpful? Give feedback.
-
Just this project! E.g with this example sketch https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-stream/streams-url_wav-i2s In the next steps you would just replace the decoder (see Wiki)... ps. Just another thought: If you just want to send audio wirelessly, you could use Bluetooth A2DP to avoid any programming on the host side... |
Beta Was this translation helpful? Give feedback.
-
I am starting to think I have the basic premise wrong. After installing the lib , I tried to simply verify the sketch you pointed to below in the arduiono ide. But I am getting the following error. Is this lib only for esp32 devices? I am using a MKR board.
|
Beta Was this translation helpful? Give feedback.
-
A bit part of the library is processor independent. I never tested this library on any MKR board and you might need to do the necessary definitions in the AudioConfig.h yourself. The processor which supports all functionality of the library is the ESP32 It should not be too difficult to add support for this board as well, but you would need to volunteer to test and debug some issues... |
Beta Was this translation helpful? Give feedback.
-
I am a bit new to Arduino. But I notice that most audio streaming solutions are on wifi versions of Arduino. I have an ethernet shield that I have been running a web server on. Is there some significance to streaming only working on wifi and not ethernet?
|
Beta Was this translation helpful? Give feedback.
-
Just these two:
#include <SPI.h>
#include <Ethernet.h>
Its amazing how after so much searching into audio streaming and Arduino, I keep landing back on your site. You seem to be the only game in town. 😊
From: Phil Schatzmann ***@***.***>
Sent: Sunday, December 11, 2022 2:43 PM
To: pschatzmann/arduino-audio-tools ***@***.***>
Cc: gdcircuit ***@***.***>; Author ***@***.***>
Subject: Re: [pschatzmann/arduino-audio-tools] Client for opus server (Discussion #509)
I would expect that they all use the same API and there is a chance that you just need to activate the funtionality in my framework.
What library do you need to use with your ethernet shield ?
—
Reply to this email directly, view it on GitHub <#509 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAYBDCVEPZZTDNYA3ELFHS3WMYVENANCNFSM6AAAAAASYXE65U> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AAYBDCRJ5VOOYDLMC3V3QNTWMYVENA5CNFSM6AAAAAASYXE65WWGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAIK474.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
I don't really know what "opus server" means and you need to identify the following
Based on the answers the implementation might be trivial or more involved...