Slackware This Forum is for the discussion of Slackware Linux.
|
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
Due to network maintenance being performed by our provider, LQ will be down starting at 05:01 AM UTC. The exact duration of the downtime isn't currently known. We apologize for the inconvenience.
|
 |
06-24-2011, 01:33 PM
|
#1
|
|
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 2,962
Rep: 
|
send audio over network
I had this post entirely written, but I decided to reframe the question in terms of the solution I'm going to try vs. what else I could be doing. This solution will be replaceable without consequence, or I can extend it to the rest of my network.
I have a laptop that I want to connect to my stereo via USB, and I want the other computers on my network to be able to send sound to it somewhat transparently. By "transparently" I mean that I want to be able to send literally any audio that would go through my local speakers to the stereo via the network. As far as I know, PulseAudio can do this without rebuilding any multimedia packages. No one really has anything good to say about PulseAudio, though.
As of now I'm ready to wipe the laptop (Pentium 4) and put pretty much anything (*nix) on it. I know PulseAudio is pretty easy to get running on *buntu, so I might end up doing that. I just want to be able to turn on the laptop and connect the stereo (in any order) and without doing anything else, have it ready to go on the network. Of course, I'm willing to put in some work to get it running. I prefer Slackware and FreeBSD, but the machine will literally just be there to send sound to the stereo.
Someone on forums.freebsd.org suggested NAS as a solution to a similar problem; however, I can't find anything useful regarding how to configure it, troubleshoot it, etc. I've only found random threads on the web by people who know how to use it or by people who can't find any resources for it.
Anyway, I'll be busy setting up PulseAudio to see how that works out. I can always wipe the laptop later, and I have a Kubuntu boot on my main laptop that I don't really care about.
Thanks!
Kevin Barry
|
|
|
|
06-24-2011, 01:36 PM
|
#2
|
|
Senior Member
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 3,668
|
Icecast?
Also, based on the way you describe your setup, I think it would make more sense to put MPD and the music library on the laptop, and set the laptop up with a web-based MPD frontend. Then the other computers will be able to use their web browsers to remotely control which songs the laptop plays over the stereo.
Last edited by dugan; 06-24-2011 at 01:52 PM.
|
|
|
|
06-24-2011, 06:18 PM
|
#3
|
|
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 2,962
Original Poster
Rep: 
|
Quote:
Originally Posted by dugan
Icecast?
Also, based on the way you describe your setup, I think it would make more sense to put MPD and the music library on the laptop, and set the laptop up with a web-based MPD frontend. Then the other computers will be able to use their web browsers to remotely control which songs the laptop plays over the stereo.
|
Thanks for the suggestions. I'm not setting up a media server, however. Just a sound server. For example, with my solution above (implemented since that post)
I'm able to send my npviewer.bin and DVD sound output to the stereo via wifi. The point being that I'll be able to stream sound to the server.
I set up Xubuntu and PulseAudio on the laptop and the setup works semi-good connecting from my Kubuntu boot, but I'm hoping to not have to set up PulseAudio on my Slackware and FreeBSD machines.
So far I have only a slight lag in sound and it's choppy here and there, but I don't know if that's a WAN problem or the setup I have going.
Kevin Barry
update: It turns out the screensaver, xfce-mixer, and/or xfce-volumed completely bogged down the old laptop (some combination of each at different times.) Fixing those and increasing the priority of both machines with the router got rid of the choppiness in web streaming but not Kaffeine. Dragon Player doesn't have choppy sound and the sync with video is fine. The only problem I have now is snd_usb_audio crashes when I do relatively minor things like click the XFCE menu or open pavucontrol.
Last edited by ta0kira; 06-24-2011 at 08:16 PM.
|
|
|
|
12-27-2012, 10:42 AM
|
#4
|
|
LQ Newbie
Registered: Dec 2012
Distribution: Kubuntu 10.10
Posts: 7
Rep: 
|
vlc, ffmpeg, netcat
Sorry, I know this post is oooooold, but for the benefit of others.
For streaming media content over a LAN I found there are several possible avenues. I haven't tried all of them, so you may want to do a bit of experimentation:
VLC player. Vlc player provides streaming out of the box. I did a little experiment and was able to successfully play an audio file on my laptop which I streamed from my desktop machine - I used VLC player on both machines. See http://wiki.videolan.org/Documentati...ming_HowTo_New
ffmpeg. I haven't tried it myself, but ffmpeg seems to support streaming. See http://ffmpeg.org/trac/ffmpeg/wiki/StreamingGuide
netcat. Netcat is the "swiss army knife" of networking. You can use netcat to stream audio. Excerpt from http://aplawrence.com/Girish/nc.html:
Quote:
Did you know you could stream audio or video on linux without any configuration? Note that this is a push model. So we have to start the streaming client first. This is what you have to do. On the streaming client, setup the listener.
$ nc -l -p 1234 | mplayer -cache 8192 -
This will wait for media from the network to play.
On the streaming server, push the media data (any mplayer playable file) thusly.
$ cat video.mpg | nc <ip/dns of streaming client> 1234
|
I just did a successfull netcat trial using netcat and sox:
On the receiving machine, I used an infinite loop:
$ while true; do nc -l 1234 | sox -t mp3 - -t ossdsp /dev/dsp; sleep 1; done
On the sending machine I sent an mp3 file:
$ cat ./00.mp3 | nc 10.18.22.250 1234
Bingo! Got the sound to play!
Adjusted from http://aeronetworks.ca/ogg2mp3-howto.html
which, sadly, is accessible only from the wayback machine http://web.archive.org/web/200902110...mp3-howto.html
Relevant section:
Quote:
Piping Audio Around the House
Playing audio over a pair of dinky little speakers is not all that satisfying. So how can you get it playing over a proper sound system? The kind that can rattle the walls and break crystal glasses?
Say, all your music resides on a large disk drive on a noisy server machine in the basement, while another silent PC is relatively close to your HiFi system, then you can run a cable from the sound adaptor line out to the auxiliary input of the amplifier, but you then still need a convenient way to send audio from the server over a LAN. This can be done using a combination of Sound Exchange (sox) and Netcat (nc).
On the HiFi connected PC, sox can play a file like this:
sox file.mp3 -t ossdsp /dev/dsp
However, you want sox to play music coming from the LAN, so it needs to be hooked to a server, that will listen for incoming data. Netcat can do that very conveniently.
To make sox and netcat work together, you need to tell sox the incoming file type (-t mp3, or -t vorbis) and you need to tell sox to grab the data from standard input (the empty '-'):
| sox -t mp3 - -t ossdsp /dev/dsp
Then you need to add a netcat listener before the pipe, to listen on a specific IP address and port:
nc -l -w 10 192.168.1.10 -p 12345
To be really good, you need to put an infinite loop around it, so that if netcat or sox exits, that they will start again:
while [ 1 ]
do
nc -l -w 10 192.168.1.10 -p 12345 | sox -t mp3 - -t ossdsp /dev/dsp
done
Put the above at the end of file /etc/rc.d/rc.local and it will always run when the PC is restarted and the PC will play whatever comes over the LAN - so make sure the volume is turned down a bit...
Now, on the server with the music repository, you can use netcat to send the music to the HiFi like this:
cat *.mp3 | nc 192.168.1.10 12345
That will cause netcat to pipe the music from the basement to the HiFi. Some more scripting can make the system run a playlist, or simply play everything at random.
|
As a neat trick, you can also show the actual data on the console whilst it's streaming to the receiver. tee to the rescue:
TTY=`tty`; while true; do cat ./00.mp3 | tee >(xxd > $TTY) | nc 10.18.22.250 1234; sleep 1; done
this sends the mp3 stream to netcat as well as to xxd, which then (in turn) sends the output to the console used. This shows a live hexdump of the data being sent to the playout machine.
HTH
P
Last edited by peter2012; 12-27-2012 at 01:07 PM.
|
|
|
1 members found this post helpful.
|
12-27-2012, 11:25 AM
|
#5
|
|
Senior Member
Registered: May 2005
Location: boston, usa
Distribution: fc-12/ fc-11-live-usb/ aix
Posts: 2,672
|
ive used this on occasion:
Code:
[schneidz@hyper ~]$ cat stuff/netcat.ksh
#!/bin/bash
PL=$(find /root/user/music -name "*.mp3")
NUM=$(echo $PL |wc -w)
{
while true; do
r=$(($RANDOM%$NUM))
s=$(echo $PL |cut -d ' ' -f$r)
echo "HTTP/1.0 200 OK\nContent-Type: audio/x-mp3stream\n\n"
dd if=$s bs=1024
done
} | nc -l -s address -p 8020
else, maybe something like sshfs on the laptop will work so you can play the file as if it is locally stored on the laptop ?
Last edited by schneidz; 12-27-2012 at 11:29 AM.
|
|
|
1 members found this post helpful.
|
12-27-2012, 11:34 AM
|
#6
|
|
LQ Newbie
Registered: Dec 2012
Distribution: Kubuntu 10.10
Posts: 7
Rep: 
|
Thank you so much!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:28 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|