SLMC Forum Index SLMC
Second Life® Music Community Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   Join! (free) Join! (free)
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linux and streaming

 
Post new topic   Reply to topic    SLMC Forum Index -> FAQ
View previous topic :: View next topic  
Author Message
Gath Gothly



Joined: 01 Mar 2009
Posts: 59


Location: Arkansas

PostPosted: Sun Mar 01, 2009 5:48 pm    Post subject: Linux and streaming  Reply with quote

Just because I've spoken with other tech-savvy musicians, but haven't met anyone else besides me streaming with Linux - I figured I'd post a little howto.

Playing music in SL with Linux.

There's lots of write-ups on how to stream with Windows, and even some for Mac... but nothing out there for Linux.  I had to learn on my own.

It's easy to do... in fact in some regards it's easier than with Windows.  It is far easier to troubleshoot issues.

1)  What you'll need.
 * The Linux SL Client, downloadable at http://secondlife.com/support/downloads.php
 * The shoutcast DSP program for Unix/Linux/Mac here http://www.shoutcast.com/download  (Note... tough to find on the page, bottom of the DSP section, right before the DNAS section)
 * A mixer or soundcard that works pretty darn well with Linux (I currently use a little M-Audio usb mixer... works great, ALSA picks it right up no issues, no installation needed - true plug and play)

Basics...
Properly using the Linux SL client is well beyond the scope of this document.  Some caveats to watch out for...
OSS can be a huge pain in your side with SL.  Depending on your sound server... OSS, Pulse, ESD, artsd... you'll have some challenges.  Personally, I use pulseaudio and I use padsp to help get around OSS device locking.  It's as easy as putting LD_PRELOAD=libpulsedsp.so at the top of the secondlife launcher script.  Helps avoid some OSS dev locking issues.  (I theorize, at best here...)

Using the shoutcast DSP is very very simple.  When downloaded and untarred/ungzipd, you'll find a few executables, for instance Linux uses sc_trans_linux.  You'll also find an example conf file and the example playlist file.

Edit the conf file, called sc_trans.conf.
In there, to set up your stream, you at LEAST have to change the ServerIP, ServerPort, and Password.
You can also set stream information, change the playlist to a file other than example.lst, and set your bitrates.  I keep a conf file for each stream I connect to to make things fast.

Now edit your playlist file - called by default example.lst.
In the playlist file goes the absolute path to whatever file you want to play.  You can list a bunch of mp3's here, OR... everything in Linux is a file... so to play guitar... put only "DSP:/dev/audio1".  Note I'm using /dev/audio1 because I plug in an external USB mixer.  If you're using the on-board or primary soundcard... it would be /dev/audio.

Now you're ready to attach to a stream server.
Run... "./sc_trans_linux sc_trans.conf"
It gives you some basic output you can use to debug any issues.  My most frequent issue is forgetting to plug in the mixer.  That makes it barf with ERROR DSP: opening device.  Because... there's no /dev/audio1 yet :p

That's it.  You're streaming live.

Speaking of an external mixer... really quick howto use there.  This is very specific to my setup.

All I have to do is plug in my m-audio mixer via usb.  Wait a tic or two.  now I can use alsamixer to edit the sound on the m-audio with "alsamixer -c1" (first soundcard, which is onboard, is -c0, the maudio I just plugged in is c1... third would be c2... count from zero folks).
I just have to hit tab to get to the recording properties, set the input to capture, and crank that volume up to 11 - rip the virtual knob off!!!)
Note:  From what I read, the newer m-audio mixers work without issue, but older m-audio mixers did need some odd special module to work.


The following is beyond scope... this is just some extra spiffiness for ya.

Ok... so you'd like to test all this without having to connect to a "live" stream.

Easy enough, go back to that spiffy shoutcast download page, and this time grab your very own shoutcast DNAS server for Linux.  sc_serv_Linux.

All that you have to do here is edit MaxUser (do your bandwidth math), Password, and PortBase.  Password is of course the password to the server, and PortBase is of course the Port for the server.
Fire it up with "./sc_serv sc_serv.conf"
There ya go... your very own shoutcast server you can connect to to test your stream against.  Unless you have SICK amounts of UPSTREAM bandwidth, I don't suggest using this.

For instance, I have 16M down, 2M up.  That means due to my 2Mb up, at only 64k bitrate streaming, I can only support 32 users.  This is where that MaxUser thing comes in.  HOWEVER, I also have SL going, my wife is probably on SL as well, and there's TCP overhead to figure in.  All in all, I could probably only really support 20 users without issues.  That's pretty good, just keep in mind most of you don't have good upstream bandwidth.


Troubleshooting.
I won't go through specific troubleshooting steps, just give ya some pointers to how I troubleshoot.

1)  Launch the SL client via command-line.  When you do this, you get the output logs writing to your terminal.  This is VERY handy, because when you stop/start your music in-world, you can see the stream URL.  This will help you know when YOUR stream is on the land, and lets you see if the stream is working or not (it'll say connecting... then disconnected if the stream server is dead)

2) Watch the output from sc_trans_linux (or whatever OS you use).  The output there is usually pretty obvious.

3) The biggest one, and handy for ANYONE, OS irrelevant... hit the stream via http!!!  Shoutcast gives you a nice little webpage app.  If your stream server is "mystreamserver.com:8888", go to "http://mystreamserver.com:8888" in a web browser.  You can see if a stream server is up or down (ie:  connected to our not), and if you have the password, you can do an admin login (username: admin, password: whatever the password is).
In the admin login, you can see what clients are connected, view or tail the server's log, kick people... all kinds of fun stuff.  Play around with it and get familiar with it!!!  I can't stress how handy the logs are on the stream server.  You can use those logs to diagnose connection issues.

4) If you grabbed your own DNAS server, test against it!  Again, you get server output to the command line when you launch it, so use that to help troubleshoot.


Ok... I'm tired of typing now.
Hey... if you're trying to get stuff working, feel free to hit me up in game.  I'm a total Linux nerd, it's been the only OS I use for the past 8+ years.  I like helping people (when I have time).  So do feel free to IM me.

Play hard, party harder - Gath

PS:  Fellow Open Source Enthusiasts... I know, should have written all this up using OSS alternatives.  Frankly, haven't tried yet.  I will at some point though.  Just be patient, and no flaming me for posting the first howto with proprietary software methods.

PPS:  Okay all, stay tuned as I'm currently playing around with JACK, rakarack and oddcastv3-jack to get a cooler setup.
End goal:  Ability to add software effects + equalizer on a per-channel basis, send output to monitor headsets realtime, and stream off to a shoutcast server.  Status:  Working but without acceptable sound quality... playing with limiting xruns while keeping minimal latency in real-time monitoring.  Just a matter of tweaking things.  Also noticed some oddcast crashes in initial testing.
Will post once working.
Back to top
View user's profile Send private message Visit poster's website
Gath Gothly



Joined: 01 Mar 2009
Posts: 59


Location: Arkansas

PostPosted: Tue May 19, 2009 4:08 pm    Post subject: Reply with quote

Just a quick note...

After a hiatus from playing in-world, and many updates to the old lappy, I came back to SL to play a gig, and could not connect to the stream.

sc_trans_linux was segfaulting on me.  I noticed that it would segfault about 9 out of 10 tries to connect.  It worked just fine trying to play an mp3 though.
Not sure if my mp3 libs were updated or what happened, but I found a workaround.
I put a zero-byte mp3 file in my playlist before DSP:/dev/dsp1.  Totally zero byte, as in "touch null.mp3" and stuck it in there above the DSP.  Back to streaming just fine.  Strange.  I guess sc_trans_linux was cool with trying to play an mp3 first (even a null one), then kicking over to the DSP device.
Back to top
View user's profile Send private message Visit poster's website
FedoraJones Popstar



Joined: 20 Aug 2010
Posts: 4



PostPosted: Fri Aug 20, 2010 11:40 pm    Post subject: Reply with quote

Greetings!

Good info here.  I'm just beginning to attempt getting the music streaming stuff setup on my Mandriva 2010.1 install.  Considering that the original post here is over a year old, maybe it's time to update it?  I'd be happy to be a test subject.  heh heh

There have surely been new tools created in the past year, so perhaps it's even more simple to stream music to Second Life via Linux now?


Last edited by FedoraJones Popstar on Tue Jul 26, 2011 3:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
Gath Gothly



Joined: 01 Mar 2009
Posts: 59


Location: Arkansas

PostPosted: Thu Nov 18, 2010 8:56 pm    Post subject: Reply with quote

I don't really get on the forums much anymore, but since that post, I started using oddcast via jackd.  But again, I haven't played in (or even logged into) SL for quite some time now.

Oddcast is pretty slick though, and jackd gives you the ability to route audio in and out like you're dealing with a virtual switchboard.  So I can route my input mics to the input of oddcast and to the output of my monitor headsets at the same time.

In truth though, it's been so long since I set it up, I don't remember what all I had to do.  I set it all up in scripts that still work to this day.  My stream box isn't powered on or I'd look and paste up the configs I've used.  The problem is of course that Jackd is very specific to individual configs and machines.  There's a lot of tweaking and playing as there are a LOT more options and functionality.

Overall, it is far simpler to use that shoutcast plugin, which really hasn't changed much.

I've only used the shoutcast dsp thing and now oddcast.  I haven't found or used any gui tools.  I'm very much a command-line Linux guy anyway.
Back to top
View user's profile Send private message Visit poster's website
zane



Joined: 09 Feb 2010
Posts: 4



PostPosted: Sun Nov 21, 2010 5:03 am    Post subject: Reply with quote

rm -Rf gui

Smile

aptitude is your friend

**
Back to top
View user's profile Send private message Visit poster's website
FedoraJones Popstar



Joined: 20 Aug 2010
Posts: 4



PostPosted: Mon Nov 29, 2010 7:25 pm    Post subject: An update Reply with quote

Hey, Gath, thanks for the reply... I'd forgotten all about this thread.  D'OH!!

At the moment, I do some karaoke, and no DJ'ing.  I have finally settled on using VLC to play media files (mostly .flv's that I've downloaded from youtube which have music an lyrics), and "butt" (Broadcast Using This Tool) to generate the stream.

Those two tools work pretty well.  As an added bonus, butt allows me to record the stream as it goes out so that I can archive it and check it later.

butt can be found at:  http://butt.sourceforge.net/
Yes, I know... funny name.  It's a never-ending source of amusement for me and a friend who also uses it.  "Right, VLC generates the stream, then the stream comes out of your butt and onto the internet."  heh heh

VLC - http://www.videolan.org/vlc/

I hope others find this information to be useful!!
Back to top
View user's profile Send private message
Susannah Avonside



Joined: 12 Jul 2011
Posts: 1



PostPosted: Tue Jul 12, 2011 3:26 pm    Post subject: VLC and Butt Reply with quote

Interesting stuff Fedora, but how do you get VLC to connect to Butt?  I'd like to know as I'm trying to stream music from an old PII system that is too weak to run a Jack/IDJC set up - it runs, but I have serious problem with sound breaking up and all sorts of nasties. (Works well on another machine I have, but I am loathe indeed to use an AMD 2x system with 2 GB of RAM purely for music streaming) \ Given that both VLC and Butt are pretty lightweight that combination might just do the trick.  I used to use the old sc_trans 040 package which worked a treat, but for some reason that no longer works -  keep getting 'permission denied' notices, even when I know the Shoutcast relay is active.

Any information on how to set such a system up would be much appreciated.  I'm on an Ubuntu Linux system, but given that both VLC and Butt are cross platform setup shouldn't vary much.
Back to top
View user's profile Send private message
FedoraJones Popstar



Joined: 20 Aug 2010
Posts: 4



PostPosted: Tue Jul 26, 2011 2:55 pm    Post subject: Re: VLC and Butt Reply with quote

Susannah Avonside wrote:
Interesting stuff Fedora, but how do you get VLC to connect to Butt?

That's the most complicated part of the configuration process, mostly because it involves knowing your audio settings, which are somewhat unique to your system.  It required a bit of trial and error for me.

Basically.... you have to point BUTT at your audio card output.  Open BUTT, click the Settings button on the right side.  On the "Main" tab, look at the top for "Audio Device:"  Choose an option there.

So, you don't connect VNC directly to BUTT... you connect your audio output to BUTT.

Then, the "fun" begins... using your audio mixer to mix the various audio signals.  heh heh  Smile

I hope this helps!  Very Happy
Back to top
View user's profile Send private message
FedoraJones Popstar



Joined: 20 Aug 2010
Posts: 4



PostPosted: Tue Jul 26, 2011 3:03 pm    Post subject: Re: An update Reply with quote

FedoraJones Popstar wrote:
It's a never-ending source of amusement for me and a friend who also uses it.  "Right, VLC generates the stream, then the stream comes out of your butt and onto the internet."  heh heh

In my attempt to be funny, I misrepresented what actually happens.  Oops.  So to clarify...
    o  VLC plays the media file and sends that data to your audio card.
    o  The audio card does its magic to the data and sends audio to its outputs. (hardware and software)
    o  BUTT connects to the software output from the audio card and creates an audio stream that's then sent to the URL you've specified in the BUTT settings.

If I've made yet another error, please feel free to correct me!  Very Happy

Also, a few more random comments while I'm here....

I'm now using Fedora 15 instead of Mandriva on the box (P3 1GHz, 512M RAM) that plays media & generates the audio stream.  I'm running Mandriva 2010.1 on the box (P4 dual core # 3GHz, 4Gb RAM, NVidia GTS250) that is running the SL client.

Both are connected to a router and then to a DSL line.

So, yes I'm using two separate computers, which is more complicated, but it does allow for more flexibility, and if the SL viewer crashes and/or locks up that computer, the audio stream still, um... streams. Smile
Back to top
View user's profile Send private message
Gath Gothly



Joined: 01 Mar 2009
Posts: 59


Location: Arkansas

PostPosted: Mon Aug 13, 2012 3:49 pm    Post subject: Reply with quote

So my streaming box with the jackd/edcast setup is pretty nifty.

It's a small little desktop box, very old and underpowered.  No GUI on it at all.  No monitor/keyboard/mouse on it either.  The only thing plugged into this box is the network cable, power cable, and the maudio external mixer.

So I plop down my lappie, which runs SL.  I do a quick "ssh -X jackd".  The -X option does X11 forwarding back to my laptop, so I can run the gui tool qjackctl.

I have all this scripted, but at that point I run...

qjackctl -s &
...to launch the gui for qjackctl.  I don't really need it, but I like to have it up.

In my script, I sleep 15 seconds to give jackd a chance to start, then automatically patch in my monitor headsets...
jack_connect system:capture_1 system:playback_1
jack_connect system:capture_1 system:playback_2
jack_connect system:capture_2 system:playback_1
jack_connect system:capture_2 system:playback_2

And finally edcast_jack connects to the stream server.
edcast_jack -c $1 -p capture
... where $1 is the name of the stream server config file.

Here's my .jackdrc as an example...
/usr/bin/jackd -R -dalsa -dhw:0 -r48000 -p1024 -n2

It's an odd, one-off setup.  But I dig jackd with the virtual patchbay, allowing me to route my inputs and outputs however I want.  But it's old hat now.  It's been sitting there for years un-touched and it just keeps working perfectly, so I haven't even tried anything else.  Heck, that box still runs Fedora 10.

I guess I'm overdue for finding another cool way to do all this.  I bet there's probably some better tools for jackd now, but I'd like to stick with that - it's nifty as all get out.

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    SLMC Forum Index -> FAQ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Create your own free forum | Buy a domain to use with your forum