You are not logged in.

#1 2009-12-06 16:52:33

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

RSound - A very simplistic networked audio framework : [Updated]

Hi, I've been working on an idea which I myself found quite useful over the time, and I've used it daily now for 2 months. I've had breaking problems with every sound daemon out there that does networking (afaik), and I wanted to get better at programming, so I started to write RSound. It is very simplistic (the code base being about 1/6 of esound's).

The server is quite simplistic, and doesn't do any sound mixing by itself, which all other popular sound servers do. RSound only tries to do networked audio, not to workaround legacy sound systems. It attempts to replace esound as the "simple sound server". It does not attempt to replace pulse, other than being far simpler. It also attempts to be platform independent with backend support for ALSA, OSS, libao and PortAudio. The "protocol" is so simple (there isn't really a protocol) that it is possible to create an rsound wav-player in python with approx 10 lines of code.

Clients can be implemented using librsound, an OSS-ish library in style. It is obviously not as advanced (500 sloc), and applications which require sophisticated features from sound APIs, or low output latency will not really work well (Pulse will be a better choise if you really need networked audio in those cases). It will however, work well with audio and video players. Since librsound was combat tested with MPlayer as reference, librsound supports everything that MPlayer needs in its audio stack, and therefore should support the needs of most applications.

The basic package consists of a CLI PCM player (similar to esdplay), and a server. It also provides the library. http://aur.archlinux.org/packages.php?ID=34028
There is an ALSA plugin, but just like with every plugin, it doesn't play nice with everything out there tongue http://aur.archlinux.org/packages.php?ID=35527
For reference, there is an mplayer package with native rsound support. http://aur.archlinux.org/packages.php?ID=33401
An entry in .asoundrc could look like this

pcm.rsound {
 type "rsound"
 host "server"
}

Last edited by Themaister (2010-03-17 19:40:34)

Offline

#2 2009-12-06 19:41:14

HashBox
Member
Registered: 2009-01-22
Posts: 271

Re: RSound - A very simplistic networked audio framework : [Updated]

Very nice, reminds me of a "suckless" pulseaudio tongue

One minor thing that might be interesting to look at is using LD_PRELOAD or something similar to redirect sounds of those apps that can't output to a file or pipe, for example there is an alsa-oss package in Debian that can hook OSS calls in this fashion and redirect it to ALSA, so maybe something similar is possible here big_smile

Offline

#3 2009-12-06 21:43:25

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Indeed, indeed. That is a really nice idea. If you can make apps write their raw audio that would otherwise go to /dev/audio or something of the sort to a file, then you could send that over the network I guess. smile I'll look into it.

Offline

#4 2009-12-07 00:31:07

bluewind
Administrator
From: Austria
Registered: 2008-07-13
Posts: 172
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

KISS network audio, nice!

I don't use ALSA so I ask for OSS support wink. Just dumping the data into /dev/dsp should suffice, I think.
Making the daemon fork into background and creating multiple threads for each connection so you only have to run it once would also be nice.

Perhaps set up a git/hg/bzr repo so others can contribute?

Offline

#5 2009-12-07 01:21:59

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

I'll set up git or something tomorrow I guess. I'll try to add OSS-support, it should be a lot simpler than ALSA at least :3 Maybe the ralsac name will be useless. rsound sounds a bit more backend neutral. smile

EDIT: Git repo is up and PKGBUILD in AUR now pulls from git. http://github.com/Themaister/ralsa

Last edited by Themaister (2009-12-07 12:04:35)

Offline

#6 2009-12-09 16:34:16

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

bluewind wrote:

KISS network audio, nice!

I don't use ALSA so I ask for OSS support wink. Just dumping the data into /dev/dsp should suffice, I think.
Making the daemon fork into background and creating multiple threads for each connection so you only have to run it once would also be nice.

Perhaps set up a git/hg/bzr repo so others can contribute?

Ok, now I think I've added what you requested wink OSS support with one thread per connection to it (same with ALSA version). About forking into background, isn't this done with & ? Or is there something I'm missing.
EDIT: Owh, it was just a simple as if ( fork() ) exit(0); smile

Last edited by Themaister (2009-12-09 17:15:33)

Offline

#7 2009-12-09 20:34:38

bluewind
Administrator
From: Austria
Registered: 2008-07-13
Posts: 172
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Cool, thank you. Works perfectly for stereo files smile
To make it work with mono input you can apply this patch:
http://git.server-speed.net/users/flo/r … 38b81ed243

Offline

#8 2009-12-10 01:08:16

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Nice smile Ah, yes. Thanks for the fix. wink Never tried with mono files. I'm pretty newb with git though. What's the right way to apply patches to the project, btw? I become the author of the patch when I commit this way. :x

I used

git apply rossd.patch
git commit
git push origin master

Guess I should learn some more if I want to use it.
EDIT: Okay, I guess git am did the trick xD

Last edited by Themaister (2009-12-10 01:33:53)

Offline

#9 2010-03-17 19:42:30

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Bump. Updated a lot since last time.

Offline

#10 2010-03-20 12:19:43

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: RSound - A very simplistic networked audio framework : [Updated]

i contribute to an open source set-top box project where we're now offering a mipsel package of rsound/serv. i'm receiving positive feedback so far, here's two small requests you might want to consider:

- could you git-tag your release versions so our buildscript can automatically grab the latest release? the project policy is to only build release versions instead of current, and right now the build breaks when an older release tarball gets deleted on github

- we have a few boxtypes without also/oss, but which do support writing directly to the dvb audio adapter. would it possible to incorporate this scenario? here is an example of this:

http://schwerkraft.elitedvb.net/scm/vie … ibdreamdvd

(see section: CONFIG_API_VERSION == 3)

thx smile


ᶘ ᵒᴥᵒᶅ

Offline

#11 2010-03-20 16:36:05

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Interesting indeed. I'll try to tag more smile I've been working on the v0.6 release, and there are quite a lot of changes, so I'll be sure to tag that.

That dvb example looks very OSS-ish with ioctl() etc, and write(). I guess you only need to write() raw audio to that audiofd. I don't have the hardware, so I doubt I could write the audio backend, but hopefully the oss.c example in the source should help. I've changed the name of the programs to rsd and rsdplay (less to write and resembles the naming scheme of other apps better I think), and changed some of the command line stuff.

Last edited by Themaister (2010-03-20 16:38:43)

Offline

#12 2010-03-21 20:39:03

x0rg
Member
From: Switzerland
Registered: 2009-07-12
Posts: 116

Re: RSound - A very simplistic networked audio framework : [Updated]

is it possible to run mpd on a server and output it to my desktop with RSound?
I know this is possible with pulseaudio, but there it's a bit too complicated for me.....

Offline

#13 2010-03-22 06:33:28

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Yes, you can smile I use it all the time myself.

Install rsound-git on both computers. http://aur.archlinux.org/packages.php?ID=34028
Install the alsa-plugins-rsound-git package on the server http://aur.archlinux.org/packages.php?ID=35527.
Set up an alsa device for rsound in .asoundrc, e.g.:

pcm.rsound {
  type "rsound"
  host "ip of desktop"
}

Configure MPD to use this device, and probably use software mixing as well.

audio_output {
    type        "alsa"
    name        "MPD"
    device        "rsound"
}
mixer_type "software"

Now, you could start the rsound server on your desktop with

rsd -D

and play. tongue

Offline

#14 2010-11-15 05:36:49

akira86
Member
Registered: 2009-01-16
Posts: 121

Re: RSound - A very simplistic networked audio framework : [Updated]

@Themaister : I just want to thank you for your work !!

I used nas to export the sound of mplayer to my server but it didn't work very well (video was jerky and mplayer complained about nas server too slow).

With rsound there is no sound nor video problem, both are perfect :-)

Some idea and comment :

* It should be good if the daemon can log its output to syslog.

* when I tried to apply your mplayer patch it fail at :
-COMMON_LIBS += $(COMMON_LIBS-yes)
+COMMON_LIBS += $(COMMON_LIBS-yes)

which obviously doesn't change nothing (just a space at the end)...
So I think you should remove it from the patch.

* I have a little problem with mplayer, I have to pause the video before seeking ...
Am I the only one ?

Offline

#15 2010-11-15 23:57:47

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

akira86. Thanks smile

Yes, I know the problem. rsd doesn't do mixing (simplicity ... smile), so it opens a new connection. When you seek in mplayer it resets connection (very simple to implement, one goal of rsound). There might be a delay, so you get two connections at a time, for a short period, where initing ALSA or whatever will fail if you can't do mixing in ALSA.
If you use hw:0 or something directly with rsound, you can get issues. Start rsd with --single, which should make sure you only get 1 connection at a time.

I'll have a look at syslog.

EDIT: Mplayer patch in AUR is probably horribly outdated. I should update that :3
EDIT2: Added syslog support. smile --syslog should do the trick. It's detailed in man rsd.
EDIT3: Updated MPlayer patch and mplayer-rsound-svn package. (That was old! hah)

Last edited by Themaister (2010-11-16 19:56:33)

Offline

#16 2010-11-16 16:50:02

cebru
Member
Registered: 2009-06-17
Posts: 39

Re: RSound - A very simplistic networked audio framework : [Updated]

Had this running on my server for a few months, was a good experience.

Offline

#17 2010-11-16 19:51:31

GogglesGuy
Member
From: Rocket City
Registered: 2005-03-29
Posts: 610
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Looks interesting. I've added a dummy output driver to my audio player library so I can play with it later. ( http://code.google.com/p/gogglesmm/wiki … yerLibrary )

Last edited by GogglesGuy (2010-11-16 19:51:56)

Offline

#18 2010-11-17 20:25:13

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Goggles: That looks cool smile
RSound 1.0rc1 is released! tongue
https://aur.archlinux.org/packages.php?ID=33101

Offline

#19 2011-08-11 12:55:53

tri1976
Member
Registered: 2009-09-07
Posts: 152

Re: RSound - A very simplistic networked audio framework : [Updated]

I'd like to stream audio from a microphone and listen to it on a windows machine using program like vlc, is this the software?  Thanks.

Offline

#20 2011-08-11 13:46:30

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: RSound - A very simplistic networked audio framework : [Updated]

Not really, RSound does not have recording facilities. One faint possibility would be recording, dumping it straight to rsdplay, and have it play back on a windows machine running the server, or something, but it's definitely not designed for it.

Offline

#21 2013-08-02 03:12:01

OhneHerren
Member
Registered: 2012-07-09
Posts: 36

Re: RSound - A very simplistic networked audio framework : [Updated]

How might I use rsound in a pulseaudio output sink? Trying to switch the audio output of chromium from local soundcard output to rsound output while chromium is still running, which doesn't seem to be possible with ALSA. Thanks for your work besides; I'm using rsound for linux-to-linux streaming in addition to the OSX flowersound app you wrote which works perfectly by the way. All seamless and minimal and transparent, wonderful.

Only issue I've been having is occasional skipping when streaming audio, not sure where the latency is exactly. What settings should I play with on the rsd receiving server to hopefully ameliorate this, e.g. buffer et cetera? There is something about this in the documentation but I don't quite understand it.

Also, the audio quality when streaming with rsound is not quite as good (though not by much) as a physical connection. Not bothered by this - just streaming the audio track of videos anyway - just wondering what the processes involved are? Is the audio resampled or compressed along the way? Again I've read through the rsound source+documentation but it is a bit beyond me.

Cheers.

Last edited by OhneHerren (2013-08-02 03:29:42)

Offline

Board footer

Powered by FluxBB