Ruby-Shout

Purpose

ruby-shout lets you send compressed audio over the network to an Icecast streaming media server.

Requirements

libshout 2.0, available from icecast.org. libshout 2 requires the ogg and vorbis libraries.

Summary of usage

This extension follows python-shout fairly closely. You make a Shout object with Shout.new, set its properties, tell it to connect, then send blocks of data, sync and repeat. Disconnect when done.

Usage

See example.rb. Run it like

./example.rb test/test.mp3

Todo

  • proper unit tests (blush)

History & Credits

  • 2001 Jared Jenning built the initial version for libshout 1
  • 2003 Jared Jenning rebuilt ruby-shout for libshout 2 and maintained it to until 2005
  • Yauhen Kharuzhy helped with bugfixes and initial metadata support
  • 2010 “Overlay” (real name unknown to me) patched ruby-shout for ruby 1.9 support, Diego Elio “Flameeyes” Pettenò incorporated patch into the gentoo package. It got removed later on due to some issues.
  • 2010 Niko Dittman re-added the patch and fixed the issues. See “Recent Changes” for details.

Recent Changes

  • Included the ruby 1.9 patch although it seems to have some issues. I hope to have fixed the issues with this:
  • Replaced STR2CSTR for StringValuePtr as STR2CSTR doesn’t work for 1.9 any more
  • Added format = Shout::MP3 to the example as this is absolutely needed by the latest versions of libshout.
  • Added an integration test which builds and installs the gem and plays some sound on a local icecast server. I mainly did that because the old version of ruby-shout didn’t even compile for ruby 1.9. Run with:
rake test:integration

State

I tested this version of ruby-shout to build and run on

  • ruby-1.8.7-p174 [x86_64] OSX 10.6
  • ruby-1.9.1-p378 [x86_64] OSX 10.6
  • ruby-1.9.2-rc1 [x86_64] OSX 10.6
  • ruby-1.9.2-p0 [x86_64] OSX 10.6
  • ruby-1.8.7-p299 [i386] ubuntu 2.6.32
  • ruby-1.9.2-rc2 [i386] ubuntu 2.6.32

License This is a BSD license.

Copyright © 2003-2005, Jared Jennings Copyright © 2010, Niko Dittmann

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the names of the authors nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.