Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Streaming Audio


Subsections

There are several approaches to capturing streaming audio for you to listen to at a later time. The use of vsound with realplay once worked very well, but recently has started to lag. Instead, mplayer provides all that is required and is actively maintained and well used. Coupled with sox you can create ogg files to store on your hard disk and to listen to as you wish.

Debian Packages: mplayer sox

We can record a live audio stream from the Internet using mplayer. The following example records from TwinCities FM, Wannero, Western Australia (http://www.twincitiesfm.com.au/. You need to interrupt (e.g., Ctrl-C) mplayer at some stage, once enough has been recorded. The sox command then translates the resulting wav file into the more compressed ogg format.

  $ mplayer mms://202.137.109.9:1426/live \
    -nocache -ao pcm:file=xstream.wav -vo null -vc dummy
  $ sox xstream.wav xstream.ogg

You can listen to the audio as it is being captured with the play command from sox, running in a different terminal so you have some idea where to stop the stream:

  $  play xstream.wav

(Thanks to Tony McNamara

for feedback on this page.)

Debian Packages: realplay vsound

Vsound allows you to record the output of any standard OSS program (since they all use /dev/dsp for sound), and hence allows you to capture streaming audio. For example, you might usually listen to streaming audio using realplay. The simplest example is to start up realplay and visit a streaming audio channel you want to record. This will add it to the recent list of locations in the File menu. Then exit from realplay and start up vsound with realplay as the command to run:

  $ vsound --file=stream.ogg --timing realplay

Choose the most recent from the File list and vsound will capture the audio for you. You won't hear anything from your sound system until you exit from vsound since /dev/dsp is being captured by vsound.

Copyright © 1995-2018 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of the open source software Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.