Getting lost with Linux and Stdin in audio terms. Trying to use rsound.

Sorry to jump in with a question and long post but I need help.

I have been using Linux for quite a few years at home now, but can still get lost very easy, I have Opensuse 11.4 installed on a couple of machines and I am happy with the software, for much of what I do it works fine, Internet, docs etc. Perfectly fine.

Started to try and understand more by obtaining a couple of the Raspberry pi’s and have managed to get a NAS running from one of them, but things do take time with me, I can generally follow Blogs or guides, but!

I have what I thought would be a simple project idea, tried on the rasppi’s failed decided to try it with two PC’s running Linux (Suse).

The idea is to stream microphone audio from each computer to the speaker of the other, i.e. an intercom. Not after high bandwidth, mp3, video or anything complicated just basic speech, low level pcm, such as 16 bit 8 KHz rate type stuff (ALAW?). Delays can be coped with.

I have been searching around and found a package called rsound, done quite a few years ago, seems to have two main parts rsd and rsdplay.

I have installed this on both machines as there is a .rpm for the packages on SUSE but for the life of me can not get it to work.

Both machines use ALSA and kmix.

The package rsdplay says
DESCRIPTION

rsdplay is a simple program designed to stream raw PCM audio, or valid RIFF wave files to an RSound server, using librsound. It primarily receives audio data from stdin.

I have two machines both initially have internal ip’s of 192.168.1.69 and 192.168.1.65, the first is known on the network as Linux-main-pc and the other as Linux-lass

Has anyone used rsound that can help stream the mic audio from one to another. I read the man pages but failed to get any audio from one to the other.

What is stdin in audio does it mean the microphone, line in how to check or how to change.

The end point for me is to try and set up a fixed intercom between my home and my mothers home, to provide her with a degree of permanent contact where if she falls etc. a crash or shout may be heard here.

I have tried Skype, but the computer gets turned off and left off, to much trouble to use it. So my plan would be when I can get it to work is have a rasppi at her house permanently on (2 Watts consumption) it is small discreet and with a small rf module can also provide her with a panic button.

Any and all help appreciated

Cheers

Adrian

It’s been ages since I used Suse … does it use PulseAudio ?

If so, install paprefs

then once configured you can send/recieve audio from/to local devices across a network.

There’s a dutch tutorial (google translated) here:
http://translate.google.com/translate?sl=nl&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwiki.ubuntu-nl.org%2Fcommunity%2FRemotePulseAudio&act=url
and another in English here:

it’s for Ubuntu, but should apply if Suse uses PulseAudio

I think not

The only way I can check for this is to go into kmix and check hardware support
it provides the following
Sound drivers supported: PulseAudio + ALSA + OSS
Sound drivers used: ALSA

So although kmix will use Pulse, Alsa and OSS it is only using ALSA. That’s how I read it anyway.

The raspberry Pi’s also use ALSA as standard so trying to keep it as standard as possible.

Cheers

Adrian

What is the RasPi running as its OS ?

[EDIT]

There’s a ton of stuff online about running PulseAudio on a RasPi

Just saying it’s an option :wink:

I have tried a few things on the Pi without success which is why I followed advice to get something running on PC’s first, you have screens, etc to see messages and it’s easier then headless pi’s, but the PI also runs ALSA.

There are problems with the PI such as it does not have a microphone and you need to use usb sound cards, USB is not the best implementation and most others have failed when trying to do similar.

Hence the reason to use PC initially to prove concept. The Pi runs a flavour of debian, but does not have an .deb for rsound.

So the aim is to solve my issue with rsound

Adrian

OK, I’ll have a play with rsound and see if I can figure it out … may be interesting :slight_smile:

Still reckon you’d be better off just installing PulseAudio in Suse and the pi’s though…

Oddly I’d have expected Suse to be using the PulseAudio sound server by default … otherwise why all the references here:
http://en.opensuse.org/SDB:Audio_troubleshooting

Just because it says it’s using the ALSA sound drivers doesn’t mean it’s not using the PulseAudio sound server

Thanks for saying you will have a look.

Question, if I only have one sound card installed, is the microphone stdin and the speakers stdout?
If then I have multiple sound devices such as a usb audio how do I select a different stdin & stdout?

Adrian

is the microphone stdin and the speakers stdout?
probably .. but the context might help.

Can’t you change the device in either

PulseAudio Volume Control - if you’re running PulseAudio

pavucontrol

or though alsamixer > F6:

alsamixer

In alsamixer when I check the capture tag F4 it lists input source as mic, when I go playback is is master, but think I could change that to pcm if required?

I have checked in the system configuration settings and pulse audio and OSS are not loaded as default.

Adrian

Did F6 allow you to swith to the USB sound device ?

[EDIT]

Let’s be clear about this … are you trying to switch to the USB audio device on the RasPi, or the Suse box ?

At present I am only trying to get it to work between two suse boxes.

As mentioned above, I am trying to run this just on PC’s to see if I can try and prove the idea.

The mention of USB device was because I have had a usb camera and mic connected in the past to the pc. That is now disconnected so at the moment just trying to go pc to pc with no additional sound cards.

Adrian

when you installed rsound, did you install from source ?

When I ran “./configure” it seems to suggest it didn’t find ALSA or PulseAudio on my system

============================
Configuration successful.
============================
 ALSA:            no
 OSS:             yes
 libAO:           no
 PortAudio:       no
 JACK:            no
 Roar VS:         no
 OpenAL:          no
 muRoar:          no
 PulseAudio:      no
 CoreAudio:       no
 libsamplerate:   no
 syslog:          yes

   Prefix: /usr/local
   CC:     cc
   CFLAGS:  -std=gnu99 -Wall -Wextra

Well that’s just plain wrong … I am using PulseAudio and ALSA … so I’m guessing this is broken, at least in Peppermint 4 (Ubuntu 13.04)

When you ran “./configure” did it find ALSA ?

I installed from rpm in suse, (packman repository) so did not see any such messages, sorry.

Adrian

In light of the fact that the rsound code doesn’t seem to be able to configure itself for recent versions of ALSA (at least under Ubuntu)… how confident are you that rsound on your system can “grab” audio from ALSA ?

Ok I have done a few tests, rsd and rsdplay both work.

typing this out helps get it in my head so here goes.

rsd is the player, audio comes out of default speakers.
rsdplay sends to the computer running rsd.

Of my two suse linux boxes both with version 11.4 one runs pulse audio, one runs alsa, no idea why the difference, they just do, must be down to hardware and the installer, I guess.
from the command prompt, if I run
192.168.1.65 ~> rsd

and from the other computer
192.168.1.69~> rsdplay -s192.168.1.65 <test.wav

Then the wave file is sent over the network and is played on the other machine.

This I can run in either direction, so the package must be fine on either computer and does not care, or can cope with pulse on the pulse computer and alsa on the alsa computer as default.

So am I getting confused over this statement
rsdplay reads PCM data only through stdin (default) or a file, and sends this data directly to an rsound server.
Unless specified with --raw, rsdplay expects a valid WAV header to be present in the input stream.

-p/–port: Defines which port to connect to.
Example: -p 18453. Defaults to port 12345.
–raw: Enables raw PCM input. When using --raw, rsdplay will generate a fake WAV header
-r/–rate: Defines input samplerate (raw PCM)
Example: -r 48000. Defaults to 44100
-c/–channel: Specifies number of sound channels (raw PCM)
Example: -c 1. Defaults to stereo (2)
-B: Specifies sample format in raw PCM stream
Supported formats are: S16LE, S16BE, U16LE, U16BE, S8, U8, ALAW, MULAW.
You can pass 8 and 16 also, which is equal to U8 and S16LE respectively.
-h/–help: Prints this help
-f/–file: Uses file rather than stdin
-s/–server: More explicit way of assigning hostname
-i/–identity: Defines the identity associated with this client. Defaults to “rsdplay”

I have been using the command
192.168.1.69~> rsdplay -s 192.168.1.65 --raw -r 44100 -c 2 -B S16LE

and assuming it will pick up my microphone audio and send to the other computer.

Have I been wrong in that assumption, if if so how do I get microphone audio to be stdin?

If it can not be done with this package I will look for another solution.

Cheers

Adrian

Found a way to do it, in fact two methods after more searching of the Internet

192.168.1.69~> arecord -D plughw:0,0 -f S16_LE | ssh -C [email protected] aplay -f S16_LE

This asks for the password to access 192.168.1.65 as it works over SSH. It uses the alsa utilities arecord and aplay

The second method that appears to work, although why I do not know yet

192.168.1.69~> arecord -D plughw:0,0 -f S16_LE | rsdplay -s 192.168.1.65
the above requires rsd running on the remote computer but does not ask for any password.

I am not sure why it works yet as I have not defined the stream as raw pcm, but I am wondering if the arecord is doing this for me?

Cheers

Adrian

Thought I would add a little bit more information to this, as a record for me and if anyone finds it interesting.

The first method using ssh has a typical network data output of 11.4 KiB/s and a typical delay of 3.5 seconds ober my own internal network.

the second method using rsdplay takes the network output to 17 KiB/s but the delay drops to less than 1 second

Thanks for taking the time to post your solution, I’m sure it’ll come in handy for someone :slight_smile: