Libreplay - a lib to save realplay output

Motivation

When you use realplay, sometimes you would like to save the sound that you ear, to be able to listen to it later in time. But realplay doesn't have a save or export button, so how to do it ?

It seems hard, if not impossible.

So I decided to kick some code for a very tiny utility that would do this kind of things.

libreplay will save the output of realplay in a raw format, so you can do what you want with this uncompressed data later in time.

Download

libreplay-0.1.tar.gz (very small file)

libreplay is in the public domain.

Installation

Just do a make in the directory, should be alright. There will be the file libreplay.so which contains everything usefull.

Configuration

This works only on linux with oss. If you can't use it, try to contact me.

Usage

You must set the variable LIBC_PATH to the place where your libc is (something like /lib/libc.so.6). If you are under bash, just do export LIBC_PATH=/lib/libc.so.6 (replace /lib/libc.so.6 by your libc of course).

Do LD_PRELOAD=./libreplay.so realplay in the directory where libreplay is and then it will create a file /tmp/sed.pipo where the output of realplay will go instead of /dev/dsp. It will create /tmp/sed.pipo.mixer too, because realplay opens /dev/mixer and outputs zeros if it can't find it. It will overwrite /tmp/sed.pipo each time you play a new stream.

The output is a raw file, use sox or you favorite conversion program to transform it into a format you like more.

libreplay will tell you the format (8 or 16 bits), the sample rate and the number of channels of the stream.

It has been tested against realplayer 8.

Problems ?

Contact me so I can help you.

It should be very easy to read the code and know what's going on.

To be quick, we use the preload facility to catch open, close and ioctl to let realplay think it is talking to /dev/dsp where in fact it outputs sound into a regular file.

Final word

Could it be easy for realplay to know it is not talking to /dev/dsp ? Well, I don't know... and I don't care. I want to control what happens inside my computer.


Contact: sed@free.fr

Creation time: Fri, 29 Nov 2002 22:08:22 +0100

Last update: Fri, 29 Nov 2002 22:08:22 +0100