Csound Csound-dev Csound-tekno Search About

[Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers

Date2025-03-20 00:49
FromRichard Knight
Subject[Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
Hi
I have been doing some work with Shoutcast (internet radio) recently and 
thought it would be fun to make a plugin to stream directly to a server 
from within Csound. The plugin is in my git repo here:
https://git.1bpm.net/csound-shout/about/

I'm running a test at the moment which you can hear here:
http://1bpm.net:8000/salad.mp3

Not tested extensively so interested for feedback if anyone has use for 
it.
Internally it uses LAME to stream as MP3 - might be interesting to 
explore that mechanism between networked Csound instances, as I've had 
difficulty with socksend/sockrecv for audio - seemingly due to the 
bandwidth required.

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2025-03-20 06:45
FromVictor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
That's really interesting. Some years ago, I remember Tarmo set up a stream like that where we could go and interact with the server, submitting code to be played.

Using it as a means of sending audio to other instances is also an interesting idea.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 20 Mar 2025, at 00:49, Richard Knight  wrote:
>
> *Warning*
>
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>
> Hi
> I have been doing some work with Shoutcast (internet radio) recently and
> thought it would be fun to make a plugin to stream directly to a server
> from within Csound. The plugin is in my git repo here:
> https://git.1bpm.net/csound-shout/about/
>
> I'm running a test at the moment which you can hear here:
> http://1bpm.net:8000/salad.mp3
>
> Not tested extensively so interested for feedback if anyone has use for
> it.
> Internally it uses LAME to stream as MP3 - might be interesting to
> explore that mechanism between networked Csound instances, as I've had
> difficulty with socksend/sockrecv for audio - seemingly due to the
> bandwidth required.
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2025-03-20 07:31
FromPhilipp Neumann <0000119f78f3a4f9-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
Hi Richard!
Super interesting work!

But i don’t get how and where you run the Csound file for streaming?

Greetings,
Philipp
> Am 20.03.2025 um 01:49 schrieb Richard Knight :
> 
> Hi
> I have been doing some work with Shoutcast (internet radio) recently and thought it would be fun to make a plugin to stream directly to a server from within Csound. The plugin is in my git repo here:
> https://git.1bpm.net/csound-shout/about/
> 
> I'm running a test at the moment which you can hear here:
> http://1bpm.net:8000/salad.mp3
> 
> Not tested extensively so interested for feedback if anyone has use for it.
> Internally it uses LAME to stream as MP3 - might be interesting to explore that mechanism between networked Csound instances, as I've had difficulty with socksend/sockrecv for audio - seemingly due to the bandwidth required.
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> 

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2025-03-20 08:28
FromTarmo Johannes
SubjectRe: [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
Hi Richard!

Brilliant! This is very nice, thank you! I built in and tested on local openSuse Linux machine with icecast server -  everything went smoothly and worked as expected.
The only thing I noticed is that running this plugin, Csound eats a lot of CPU  - that is a bit of a problem.

It is so convenient to have such and opcode to stream straight from Csound to the broadcasting server! Before I used to use Csound->Jack->DarkIce for sending up the stream but this is so much more convenient.

You mentioned 'might be interesting to
explore that mechanism between networked Csound instances'

- how can the other side to receive the sound from the broadcasing server?

And of course then there is the latency problem, that is at least 5 but probably more seconds.
Just to mention - for low-latency audio transfer I find jacktrip a very good tool or Jamulus platform https://jamulus.io/ if you want to play together with several people (or Sonobus, but then the routing from/to Csound can be more difficult to achineve)

Thanks!
tarmo

Kontakt Philipp Neumann (<0000119f78f3a4f9-dmarc-request@listserv.heanet.ie>) kirjutas kuupäeval N, 20. märts 2025 kell 09:32:
Hi Richard!
Super interesting work!

But i don’t get how and where you run the Csound file for streaming?

Greetings,
Philipp
> Am 20.03.2025 um 01:49 schrieb Richard Knight <richard@1BPM.NET>:
>
> Hi
> I have been doing some work with Shoutcast (internet radio) recently and thought it would be fun to make a plugin to stream directly to a server from within Csound. The plugin is in my git repo here:
> https://git.1bpm.net/csound-shout/about/
>
> I'm running a test at the moment which you can hear here:
> http://1bpm.net:8000/salad.mp3
>
> Not tested extensively so interested for feedback if anyone has use for it.
> Internally it uses LAME to stream as MP3 - might be interesting to explore that mechanism between networked Csound instances, as I've had difficulty with socksend/sockrecv for audio - seemingly due to the bandwidth required.
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2025-03-20 13:38
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
Nice!

tor. 20. mars 2025 kl. 01:49 skrev Richard Knight <richard@1bpm.net>:
Hi
I have been doing some work with Shoutcast (internet radio) recently and
thought it would be fun to make a plugin to stream directly to a server
from within Csound. The plugin is in my git repo here:
https://git.1bpm.net/csound-shout/about/

I'm running a test at the moment which you can hear here:
http://1bpm.net:8000/salad.mp3

Not tested extensively so interested for feedback if anyone has use for
it.
Internally it uses LAME to stream as MP3 - might be interesting to
explore that mechanism between networked Csound instances, as I've had
difficulty with socksend/sockrecv for audio - seemingly due to the
bandwidth required.

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2025-03-20 13:52
FromRichard Knight
SubjectRe: [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
Hi, the streaming happens within Csound itself.
So the connection to the server is setup with the opcodes shoutinit and 
shoutopen , and then you can pass audio to the shoutsend opcode.

There's a simple example in the repository here, which shows 
establishing the connection, and then sending a sound to the server:
https://git.1bpm.net/csound-shout/tree/examples/example.csd



On 2025-03-20 07:31, Philipp Neumann wrote:
> Hi Richard!
> Super interesting work!
> 
> But i don’t get how and where you run the Csound file for streaming?
> 
> Greetings,
> Philipp

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2025-03-20 14:01
FromRichard Knight
SubjectRe: [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers

Hi, thank you, and really interesting to hear you've done things with Csound and streaming before, and glad it is useful!
The MP3 encoding particularly adds some CPU usage but I haven't found it limiting - in fact it seems lower usage than liquidsoap which I'm currently on the same machine to stream static files. But I would like to get to the bottom of it more and see how it can be optimised - what is your ksmps and does that make a difference on the load? Also maybe the quality setting might make a difference, and would you know roughly how much CPU % usage it adds to your csd, just so I get an idea of how bad the problem is? I'm seeing maybe 5% additional CPU on a slow (atom type cpu) box, but with high ksmps.

 

With the idea between networked Csound instances, I was thinking of a new plugin that would send/receive mp3 encoded streams. And you have a great point I didn't consider before about the latency, so maybe that's not such a great idea. These are reallyy useful suggestions, thank you - I will have a look at jacktrip and jamulus.

On 2025-03-20 08:28, Tarmo Johannes wrote:

Hi Richard!
 
Brilliant! This is very nice, thank you! I built in and tested on local openSuse Linux machine with icecast server -  everything went smoothly and worked as expected.
The only thing I noticed is that running this plugin, Csound eats a lot of CPU  - that is a bit of a problem.
 
It is so convenient to have such and opcode to stream straight from Csound to the broadcasting server! Before I used to use Csound->Jack->DarkIce for sending up the stream but this is so much more convenient.
 
You mentioned 'might be interesting to
explore that mechanism between networked Csound instances'
 
- how can the other side to receive the sound from the broadcasing server?

And of course then there is the latency problem, that is at least 5 but probably more seconds.
Just to mention - for low-latency audio transfer I find jacktrip a very good tool or Jamulus platform https://jamulus.io/ if you want to play together with several people (or Sonobus, but then the routing from/to Csound can be more difficult to achineve)
 
Thanks!
tarmo

Kontakt Philipp Neumann (<0000119f78f3a4f9-dmarc-request@listserv.heanet.ie>) kirjutas kuupäeval N, 20. märts 2025 kell 09:32:
Hi Richard!
Super interesting work!

But i don't get how and where you run the Csound file for streaming?

Greetings,
Philipp
> Am 20.03.2025 um 01:49 schrieb Richard Knight <richard@1BPM.NET>:
>
> Hi
> I have been doing some work with Shoutcast (internet radio) recently and thought it would be fun to make a plugin to stream directly to a server from within Csound. The plugin is in my git repo here:
> https://git.1bpm.net/csound-shout/about/
>
> I'm running a test at the moment which you can hear here:
> http://1bpm.net:8000/salad.mp3
>
> Not tested extensively so interested for feedback if anyone has use for it.
> Internally it uses LAME to stream as MP3 - might be interesting to explore that mechanism between networked Csound instances, as I've had difficulty with socksend/sockrecv for audio - seemingly due to the bandwidth required.
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2025-03-20 14:02
FromRichard Knight
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
I did wonder about something interactive like that. That sounds 
interesting, would be intrigued to hear more about that setup Tarmo!

On 2025-03-20 06:45, Victor Lazzarini wrote:
> That's really interesting. Some years ago, I remember Tarmo set up a
> stream like that where we could go and interact with the server,
> submitting code to be played.
> 
> Using it as a means of sending audio to other instances is also an
> interesting idea.
> 
> Prof. Victor Lazzarini
> Maynooth University
> Ireland

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2025-03-20 16:06
FromEduardo Moguillansky
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
If

On Thu, Mar 20, 2025 at 3:13 PM Richard Knight <richard@1bpm.net> wrote:
I did wonder about something interactive like that. That sounds
interesting, would be intrigued to hear more about that setup Tarmo!

On 2025-03-20 06:45, Victor Lazzarini wrote:
> That's really interesting. Some years ago, I remember Tarmo set up a
> stream like that where we could go and interact with the server,
> submitting code to be played.
>
> Using it as a means of sending audio to other instances is also an
> interesting idea.
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2025-03-20 16:11
FromEduardo Moguillansky
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers
If the goal is to broadcast audio over the network I would look into libaao (audio over osc): https://git.iem.at/aoo/aoo,

it is the underlying protocol used by sonobus and in my own experience it offers low latency while being cross-platform than other tools like jack trip.

On Thu, Mar 20, 2025 at 3:13 PM Richard Knight <richard@1bpm.net> wrote:
I did wonder about something interactive like that. That sounds
interesting, would be intrigued to hear more about that setup Tarmo!

On 2025-03-20 06:45, Victor Lazzarini wrote:
> That's really interesting. Some years ago, I remember Tarmo set up a
> stream like that where we could go and interact with the server,
> submitting code to be played.
>
> Using it as a means of sending audio to other instances is also an
> interesting idea.
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2025-03-20 21:54
FromRichard Knight
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Plugin opcodes for broadcasting via Shoutcast and Icecast streaming servers

That seems good and not heard of it before, I will have a look, thanks.

 


On 2025-03-20 16:11, Eduardo Moguillansky wrote:

If the goal is to broadcast audio over the network I would look into libaao (audio over osc): https://git.iem.at/aoo/aoo,
 
it is the underlying protocol used by sonobus and in my own experience it offers low latency while being cross-platform than other tools like jack trip.

On Thu, Mar 20, 2025 at 3:13 PM Richard Knight <richard@1bpm.net> wrote:
I did wonder about something interactive like that. That sounds
interesting, would be intrigued to hear more about that setup Tarmo!

On 2025-03-20 06:45, Victor Lazzarini wrote:
> That's really interesting. Some years ago, I remember Tarmo set up a
> stream like that where we could go and interact with the server,
> submitting code to be played.
>
> Using it as a means of sending audio to other instances is also an
> interesting idea.
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here