forums.xandros.com Forum Index forums.xandros.com
Xandros User Forums
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Recording streaming audio

 
Post new topic   Reply to topic    forums.xandros.com Forum Index -> Multimedia
View previous topic :: View next topic  
Author Message
RobF
Xandrosianling
Xandrosianling


Joined: 27 May 2004
Posts: 456

PostPosted: Sat Oct 08, 2005 2:38 pm    Post subject: Recording streaming audio Reply with quote

I recently spent some time experimenting with ways of recording streaming audio from the Internet using Xandros 3 SE. Here's what I've learned.

I. If you want to record streaming audio from a source on the Internet for which you have a URL (e.g. an http or rtsp link) you can accomplish that with MPlayer, realcap or Streamtuner/Streamripper.


1. MPLAYER is an up and coming multimedia player that's loaded with features but is not always easy to install correctly. You can use it from the command line or from within its GUI. You will also need to download codecs for playing a variety of different audio formats. Links for downloading all of the software mentioned in this post are listed at the end.

Example (all one long line):

mplayer -noframedrop -dumpfile out.rm -dumpstream rtsp://real.npr.na-central.speedera.net:80/real.npr.na-central/me/20050314_me_06.rm

This records the audio stream linked to in RealAudio format in the file out.rm in your current working directory (cwd) until you exit the program (ctrl-Z).


2. REALCAP is a bash shell script that allows you to capture an audio stream from RealPlayer to a file in wav, ogg or mp3 format, with various options for sampling rates and audio quality. To exploit its functionality fully you should have realplay, vsound, lame and oggenc installed.

Example (all one long line):

realcap -c 60 -m 48 -a NPR -t Knuth -d rtsp://real.npr.na-central.speedera.net:80/real.npr.na-central/me/20050314_me_06.rm

This command uses vsound and lame to write about half a minute of this stream at 48 kbps in mp3 format to the file vsound.mp3 in your cwd (after first idling for some 30 secs due to connect and buffering time).


3. STREAMTUNER is an internet audio stream directory browser with GUI that allows you to easily access thousands of audio streams from Internet radio stations and from other audio sources on the Internet. It has a "record" option that will capture the audio stream you're listening to in ogg format. This option requires the presence of Streamripper (you may have to install it separately). Streamtuner/Streamripper rips shoutcast and icecast compatible audio streams to separate subfolders in a folder in your home dir that will be named after the audio source you're ripping (e.g. the radio station).

STREAMRIPPER is the utility that rips the online audio stream to individual ogg files. You can also use it stand-alone from the command line, e.g.

streamripper http://ogg.smgradio.com/vc160.ogg

This command will rip all the songs played on that station in real time to separate tracks in ogg format until you kill the program.


II. If you want to record streaming audio from a source on the Internet for which you don't have a URL (aka "direct stream recording"), you can use arecord, rawrec/rawplay or Krecord.


4. ARECORD records audio files using the ALSA sound system, e.g.

arecord -f cd -t wav -d 45 -D hw:0,0 capture.wav

This command records 45 sec of the currently playing audio stream in CD quality in wav format to the file capture.wav in your cwd. You can play back that file e.g. with RealPlayer.

arecord -f cd -t wav -d 45 -D hw:0,0 | lame -m s --bitwidth 16 -s 44.1 - - | cat > `date +%d%b%y%H%M%S`.mp3

This command records 45 sec of the currently playing audio stream as above, then pipes it to lame to encode it in mp3 format and finally writes it as a date&time-stamped mp3 file to your cwd. You can play it back with xmms or RealPlayer.


5. RAWREC/RAWPLAY is a buffered raw audio recorder/player, e.g.

rawrec -t 30 capture.raw

This command records 30 sec of the current audio stream in raw audio format to the file capture.raw in your cwd. You can play it back with the command "rawplay capture.raw".

rawrec -t 30 | sox -t sw -r 44100 -c 2 - -t cdr capture.cdr

This command records 30 sec in raw audio and then uses sox to convert it to a CD quality cdr file. You can play that back with sox or convert it to something else.


6. KRECORD is a program for recording anything that goes through your DSP (the digital signal processor on your soundcard). It's part of the KDE suite and has some nice features such as an input level indicator and a frequency spectrum display. The former is very handy for setting the proper record input level with the "Capture" slider in the alsamixer console.

To direct record audio with Krecord, open a new file buffer, give it a name with .wav extension, save that, then press the record button. You can watch the record level in the "input level" window. When done, press stop and play back the file e.g. with RealPlayer.


7. AUDACITY is a full-fledged audio editor with a rather complex interface. I have little experience with it. It has a "record" button which presumably allows you to capture in raw audio format whatever audio is passing through the soundcard. In fiddling around with this program for a brief length of time, I did manage just once to accomplish just that. But the recording was horribly distorted, and I don't remember how I got there. I'll fiddle around with it some more.


III. An essential prerequisite for all of this to work is to set up your sound mixer properly. This can be done with the command line utility ALSAMIXER (I use v.1.0.8 ). Alsamixer seems to work reliably whereas Kmixer, a KDE program that's designed to do the same thing in a GUI, doesn't always seem to be reliable, i.e. changes you make in Kmixer don't always seem to jive with the settings shown in the alsamixer display. My sense is that the latter is more trustworthy.

In the alsamixer console you can toggle "View" with the tab key, navigate between devices with the forward and backward keys, turn capture on and off with the space bar, toggle muting with the "m" key and change slider settings with the up and down keys.

The mixer setting that I've found to work for direct stream recording with arecord, rawrec etc. has "Capture" and "Mix" turned on to CAPTUR and "Capture" set to about 60%. All other adjustable sliders are set to about 70% save for "Headphones" (100%). "PCM" definitely must be on, i.e. not muted, whereas for recording the other devices may or may not be muted.

Once you have sound playing through your soundcard, you can use the input level meter in Krecord to check the record level in db (use the log option) while you're adjusting the alsamixer sliders and switches. A setting with the moving horizontal bars being red much of the time (i.e. the peak mostly being between -10 and 0 db) seems to work fine.

My machine is equipped with the Intel 82801DB-ICH4 AC'97 Audio Controller which is integrated into the motherboard and uses the AD1981A sound chip. With other soundcards the alsamixer console may show device names other than "Capture" and "Mix"; in this case turn on capture for "AC'97" and "AC'97 Cap" and turn up the latter's slider.

Good luck,

Robert


List of software mentioned:

oggenc (part of vorbis-tools), arecord, sox, Krecord, and alsamixer are part of the Xandros 3 default install.
Streamtuner, Streamripper, rawrec (includes rawplay), vsound, and Audacity are available via XN from the "Debian unsupported site".

The following can be downloaded from the web and installed via XN:

MPlayer: http://www.xandros.or.id/archive/dists/xxx/main/binary-i386/andrew/mplayer_1.0cvs_i386.deb
MPlayer codecs: http://www2.mplayerhq.hu/MPlayer/releases/codecs/essential-20050412.tar.bz2
(for installations instructions see Arne Anka's post at http://forums.xandros.com/viewtopic.php?t=17983 )
realcap: http://homepage.eircom.net/~wastedyouth/realcap/ (put this shell script into /usr/local/bin)
lame: http://debian.tu-bs.de/mplayer/ftp.nerim.net/debian-marillat/dists/stable/main/binary-i386/
(install lame_3.96-woody1_i386.deb, lame-extras_3.96-woody1_i386.deb and liblame0_3.96-woody1_i386.deb)
Back to top
View user's profile Send private message
blayne
Xandrosianding
Xandrosianding


Joined: 07 Jan 2003
Posts: 650
Location: Lexington Kentucky USA

PostPosted: Sun Nov 13, 2005 10:22 am    Post subject: Reply with quote

Hey, Rob, thanks for that great post. It's so chock-full-of-goodness that it should be maintained as a page in an online Xandros How-To guide. If I can't find a solution on the Xandros user forum, I usually play around with something until I find one decent way to do it, then upload my solution. You have apparently investigated almost all possible solutions and reported the results of each, so we know which application is better depending on the user's needs.

I've been ripping books-on-CD to listen to on my MP3 player. It's fairly straight forward, if a bit tedious. I like simple applications, but in this case a special application that rips and encodes books-on-CD would be nice. It could give the tracks sequential numbers and manage multiple CDs as a single album.

Lately, I've been ripping books-on-cassette. I used krecord (Sound Recorder, supplied with Xandros 3.0). It works well, but I wish it would sense 30 seconds of silence at the end of the tape and stop recording automatically.

It seems that you prefer command line programs to GUI. I can go either way, depending on how easy each is to use, and how reliable. But I'm really more of a hardware guy. You didn't mention one simple hardware solution to ripping streaming audio. It isn't as elegant as the software only solution, but it's guaranteed to work and it is simple. Run a stereo patch cord from your PC's 1/8" stereo headphone jack to the 1/8" stereo line-in jack on your PC or a separate PC. then run your favorite software to record audio. If you can hear it... you can record it.

I'm going to try Audacity now. I understand it's more complicated than krecord, but hopefully it'll have a few features I'd like, such as automatically ending a recording when silence is encountered, and filtering to eliminate tape hiss and other analog artifacts.

Thanks again for a great post.
Back to top
View user's profile Send private message
Clancy
Xandrosianding
Xandrosianding


Joined: 01 Mar 2004
Posts: 902
Location: NSW, Oz

PostPosted: Tue Nov 15, 2005 10:04 pm    Post subject: Re: Recording streaming audio Reply with quote

RobF wrote:
mplayer -noframedrop -dumpfile out.rm -dumpstream rtsp://real.npr.na-central.speedera.net:80/real.npr.na-central/me/20050314_me_06.rm

This records the audio stream linked to in RealAudio format in the file out.rm in your current working directory (cwd) until you exit the program (ctrl-Z).


This also works for streaming RealVideo.
_________________
(expert with questions)
I'm a girl, ask me how.
Back to top
View user's profile Send private message
XandrosAdminAJ
Site Admin
Site Admin


Joined: 03 Jun 2004
Posts: 3580
Location: Saskatchewan, Canada

PostPosted: Sat Apr 14, 2007 8:45 pm    Post subject: Reply with quote

This is dated 2005, but the directions are still current with Xandros 4, so I made it a sticky.
Back to top
View user's profile Send private message Send e-mail
woodsmoke
Xanalandingdonger


Joined: 30 Jul 2005
Posts: 4970
Location: United States

PostPosted: Sat Apr 14, 2007 9:29 pm    Post subject: Reply with quote

thanks arnoldjames

now all I have to do is get an appropriate soundcard... Smile

ain't XANdros great!
woodsmoke
_________________
If the eco-ists would only shut up, I wonder if the sound of their droning would be replaced by the sound of normal people fitting solar panels and making soup from nettles and twigs.(J Clarkson)
Back to top
View user's profile Send private message
RobF
Xandrosianling
Xandrosianling


Joined: 27 May 2004
Posts: 456

PostPosted: Mon Apr 16, 2007 10:26 pm    Post subject: Reply with quote

arnoldjames wrote:
This is dated 2005, but the directions are still current with Xandros 4, so I made it a sticky.

I've recently gone again through the exercise of exhaustively researching how to record streaming audio with a different Linux distro but most of it should also apply to Xandros 4. Give me a week or two, and I'll bring the write up for Xandros up to date.

Robert
Back to top
View user's profile Send private message
woodsmoke
Xanalandingdonger


Joined: 30 Jul 2005
Posts: 4970
Location: United States

PostPosted: Tue Apr 17, 2007 1:44 am    Post subject: Reply with quote

Hi
using my onboard soundcard:

Go to XN, using expert and Debian unsupprted, and download streamripper and Kstreamripper(a KDE front end)..

They won't make a menu item, you have to hunt them up in user/bin but don't go to the trouble.... neither have the proper tabs...

I didn't try streamripper,

I instead went to the administrator console(in Xandros 4 with SP1) and entered my administrator password and then entered:

apt-get install streamtuner streamripper

There was a list of stuff installed, it then said that there was a previous version of stream tuner and did I want to update it and install dependencies..

typed yes...

got a bunch more stuff installed plus, apparently updated XMMS..., mebbe not, but it was going by pretty fast...

had to wait a while for both of the above processes

you could "probably" skip the XN install of stream tuner...

after a while everything installed.

I went to start/programs/multimedia and there was streamtuner's menu item.

Clicked it, and there was streamtuner, a MUCH better and COMPLETE interface, as opposed to the one from XN...I "probably" could have apt-get updated and got the improved tuner, dunno...

anyway.... there is a tab for shoutcast, and I clicked it and got all of the Shoutcast stations....as PLAIN TEXT.... no formatting etc.

Cursored down to find my station and clicked it to highlight it... I later found out that I could have double clicked...

But...clicked it and then clicked LISTEN...and there it was, playing through XMMS.... which is called MP3 player in Xandros....

and is my FAV...player! Smile the Xander Mountain, Tiki Fountain, XMMS sound system bar and grill remember! Laughing

Listened for a while... clicked visualizations and I use GOOM....

and ..... WOAH......the new and improved GOOM is even better than before...this is the ONE visualization for me... !

After I listened for a while...I clicked RECORD....

and a text box appeared and it said in PLAIN TEXT.... "connecting/buffering"...and then "ripping" and showed the title of the song and the number of kb or mb....

I then looked in My Computer/my documents and .... there was a file folder all neatly labled with the Shoutcast/radio station/substream/MP3...

woah!

very gingerly peeked inside...and there were each and every one of the files neatly arranged and named....

Went away and did some stuff, listened while doing so....came back....

Guys....you can put a LOT of songs on your HD with this setup....

I later copied a few to a USB thumb drive and put it in my car radio and there the music was...

DIGITALLY RIGHTS ....well....IDENTIFIED...if it was a DRM song then it was identified, WITH TEXT, on the radio..., if it was a "private lable song"...then it just said "track XY"....

My brand new radio....

EVIDENCE OF RIAA AND SONY AND Microsith's Looooonnngggg reach....

not that I mind the "naming" etc, I expected it, but I DIDN'T expect to find that the "private lable" music WOULDN'T BE NAMED....

GRRRRRRRRRR

Evil or Very Mad Evil or Very Mad Evil or Very Mad Evil or Very Mad Evil or Very Mad

THEIR NEXT STEP....since they can make the radio not NAME...it....is to make the radio ...not PLAY it..... Evil or Very Mad

Anyhow..... I can now spend a little more time listening to tracks while not doing other stuff and when I don't have much to do but drive and listen....

AND THEN... after I've decided on tracks I like... I BUY A CD....OR MAKE A DONATION....

AS SHOULD YOU.....

Because this will <probably> all go away in a short while....when there are Presidential aspirations involved....and Sony et. al can provide UNLIMITED FACE TIME....

to HEdouble hockysticks with you or me...or anybody else except the power brokers involved....

But...back to the point.... stream tuner and stream ripper work like a charm...

AAANNNNDDDD....BACK TO THE RANCH....I restarted the whole operation and stream ripper continued filling the original folder.....

It MAY BE...dunno..... that if there is a "repeat" that it will download it anyway and "possibly" lable it TITLE(2)....dunno....

AND....that may be an advantage of another proggy...it may reject a second copy...or..it may be that streamripper does so...dunno....

I'll have to read around, but do remember something to the effect in prior reading...

A really PROMISING..."ripper/whatever" is, to me...EXAIL.... it apparently gives album covers, etc....and may do the not doing a double rip thing..dunno...

but it looked kinda cool.... but when I read about someone trying to install it at Ubuntu they had to go around their back to get to their elbow to install it....so...I'll probably pass on it unless someone says that it is easier in Xandros...

after all... Xandros is all about easy! Smile

hey....THANKS for the THREAD...!

Didn't need a dedicated card after alll!

a last note...another way to do the above install might be to install streamtuner streamripper from XN and then do apt-get update.. probably samo samo in terms of effort...dunno...

AIN't Xandros grEAT!
woodsmoke
_________________
If the eco-ists would only shut up, I wonder if the sound of their droning would be replaced by the sound of normal people fitting solar panels and making soup from nettles and twigs.(J Clarkson)
Back to top
View user's profile Send private message
XandrosAdminAJ
Site Admin
Site Admin


Joined: 03 Jun 2004
Posts: 3580
Location: Saskatchewan, Canada

PostPosted: Sat Mar 14, 2009 8:48 pm    Post subject: 'icecream' from console - recommended Reply with quote

I;ve been using the command line prog "icecream" which installs just fine from XN.

You use it like this:

Code:
$ icecream -v -t http://website.com/playlist.pls


The -v gives you a verbose mode in the console window.
The -t splits it into tracks.

All you have to do is copy the link location that would initiate live playback on your computer (i.e., in xmms) and paste it after the -t. It will save the tracks from where you initiated the console from. I record mostly classical music myself, and an ocassional talk program. They record to mp3s (or other, see
Code:
$man icecream
for way more options than I know what to do with. The example above does just fine for me.
_________________
War doesn't determine who's right - only who's left.
Back to top
View user's profile Send private message Send e-mail
Emilio123
Xplorer


Joined: 03 Aug 2009
Posts: 19

PostPosted: Thu Aug 06, 2009 8:24 pm    Post subject: Reply with quote

Hi,RobF
thanks for your experiment of recording streaming audio!
It's great help Very Happy
Back to top
View user's profile Send private message
arunkumarrr
Xplorer


Joined: 05 Jan 2010
Posts: 5

PostPosted: Tue Jan 05, 2010 12:23 am    Post subject: Reply with quote

Your experimentation will surely help someone..
Back to top
View user's profile Send private message
gingir
Xplorer


Joined: 18 May 2013
Posts: 8

PostPosted: Sat May 18, 2013 9:17 am    Post subject: Reply with quote

I need a soundcard ...
_________________
Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.xandros.com Forum Index -> Multimedia All times are GMT - 5 Hours
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


Powered by phpBB © 2001, 2005 phpBB Group