Re: [ecasound] creating real-time output mp3

From: Joel Roth <joelz@email-addr-hidden>
Date: Fri Jun 11 2010 - 13:42:31 EEST

On Fri, Jun 11, 2010 at 09:59:30AM +0100, zonyi besk wrote:
> Hi All,
> Most of the problems are solved the main problem is still is live so the
> input files 2 full mp3 files, the output mp3 is mixed of the input files
> would be created in real time.

So inputs will be:


and the output will be a streaming mp3.

Reading 'man ecasoundrc' I find this variable:

          Command for starting mp3 output. Ecasound will write stereo,
          signed, 16bit, little-endian samples to standard output. Sample
          rate is configurable. Before execution, %f is replaced with path to
          the output mp3, %S with sample rate in kHz, and %B with encoding
          bitrate in kbps. Double-quotes and backslash-espacing can be used
          to include white-space to individual parameters.Defaults to lame -b
          %B -s %S -x -S - %f.

Looks like Ecasound pipes its output to lame, which you can configure at will,
possible sending the output through a named pipe or internet socket.

That part of the puzzle you could research using lame only,
then configure Ecasound to run lame with the same parameters.

> I don't know if can be done anyhow:
> -output mp3 file should be created in real time /not in one sec/ but as much
> sec the length the output file
> -via the 2868 port during the process should be changed the volume etc
> parameters, and in the output mp3 file this should be appeared
> This without any audio device eg. soundcard etc. as the output mp3 would be
> streamed to users btw it is controlled from there as well

How much effort are you willing to make?

I expect that buffering and timing issues will make
it more complicated.

To control the audio in 'realtime' I picture that you will
need two streams. One stream will to go the mixologist, who
plays it through a soundcard and listens. The second stream
will be delayed by some seconds. It will get the control inputs and be
delivered to the audience.

When the mixologist adjusts vol or effect parameters, his
machine will associate those control inputs with a time stamp, and
send them back to the streaming machine. The streaming host
will schedule the same control inputs on the second stream.

But hmmm. How can you schedule timed operations when the
streaming machine's audio processing is free-wheeling?

Here is one possible approach.

For the second stream, ecasound sends one second of audio at a
time, streaming it into socket buffers in maybe 0.1s, and then
stops. Any scheduled control inputs are applied, then at
0:00:00.9, the host starts streaming the second second of audio. The
output will appear to be continuous, while stopping and
starting the transport will enable provide opportunities to
synchronize with the control inputs.

You can control Ecasound via perl or python scripts. Nama,
written in perl, uses an event framework to poll the
Ecasound engine at one second intervals (is the engine still
running?) and to schedule command inputs.

Something similar would possibly work for you.

Hope that helps, or at least stimulates your thinking.


> Thanks,
> Zol

Joel Roth
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win:
Ecasound-list mailing list
Received on Fri Jun 11 16:15:01 2010

This archive was generated by hypermail 2.1.8 : Fri Jun 11 2010 - 16:15:01 EEST