10.25 Streaming Audio


There are several approaches to capturing streaming audio for you to listen to at a later time. Mplayer, Mplayer, Mplayer provides all that is required and is actively maintained and well used. Coupled with sox, sox, sox you can create ogg files to store on your hard disk and to listen to as you wish.

10.25.1 Using MPlayer


mplayer, mplayer, mplayer sox, sox, 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:// \
    -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, sox, sox, running in a different terminal so you have some idea where to stop the stream:

  $  play xstream.wav

Ref: Tony McNamara

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0